tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
yosys: Add yosys-symbiflow-plugins
OllieB
4 years ago
12cc34ce
20409633
+173
-1
7 changed files
expand all
collapse all
unified
split
maintainers
maintainer-list.nix
pkgs
development
compilers
yosys
default.nix
plugins
bluespec.nix
ghdl.nix
symbiflow-pmgen.patch
symbiflow.nix
top-level
all-packages.nix
+6
maintainers/maintainer-list.nix
···
8874
8874
githubId = 72201;
8875
8875
name = "Ole Jørgen Brønner";
8876
8876
};
8877
8877
+
ollieB = {
8878
8878
+
email = "1237862+oliverbunting@users.noreply.github.com";
8879
8879
+
github = "oliverbunting";
8880
8880
+
githubId = 1237862;
8881
8881
+
name = "Ollie Bunting";
8882
8882
+
};
8877
8883
olynch = {
8878
8884
email = "owen@olynch.me";
8879
8885
github = "olynch";
+43
-1
pkgs/development/compilers/yosys/default.nix
···
6
6
, fetchFromGitHub
7
7
, flex
8
8
, libffi
9
9
+
, makeWrapper
9
10
, pkg-config
10
11
, protobuf
11
12
, python3
12
13
, readline
14
14
+
, symlinkJoin
13
15
, tcl
14
16
, verilog
15
17
, zlib
18
18
+
, yosys
19
19
+
, yosys-bluespec
20
20
+
, yosys-ghdl
21
21
+
, yosys-symbiflow
16
22
}:
17
23
18
24
# NOTE: as of late 2020, yosys has switched to an automation robot that
···
32
38
# yosys version number helps users report better bugs upstream, and is
33
39
# ultimately less confusing than using dates.
34
40
35
35
-
stdenv.mkDerivation rec {
41
41
+
let
42
42
+
43
43
+
# Provides a wrapper for creating a yosys with the specifed plugins preloaded
44
44
+
#
45
45
+
# Example:
46
46
+
#
47
47
+
# my_yosys = yosys.withPlugins (with yosys.allPlugins; [
48
48
+
# fasm
49
49
+
# bluespec
50
50
+
# ]);
51
51
+
withPlugins = plugins:
52
52
+
let
53
53
+
paths = lib.closePropagation plugins;
54
54
+
module_flags = with builtins; concatStringsSep " "
55
55
+
(map (n: "--add-flags -m --add-flags ${n.plugin}") plugins);
56
56
+
in lib.appendToName "with-plugins" ( symlinkJoin {
57
57
+
inherit (yosys) name;
58
58
+
paths = paths ++ [ yosys ] ;
59
59
+
buildInputs = [ makeWrapper ];
60
60
+
postBuild = ''
61
61
+
wrapProgram $out/bin/yosys \
62
62
+
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \
63
63
+
${module_flags}
64
64
+
'';
65
65
+
});
66
66
+
67
67
+
allPlugins = {
68
68
+
bluespec = yosys-bluespec;
69
69
+
ghdl = yosys-ghdl;
70
70
+
} // (yosys-symbiflow);
71
71
+
72
72
+
73
73
+
in stdenv.mkDerivation rec {
36
74
pname = "yosys";
37
75
version = "0.12+54";
38
76
···
98
136
postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc";
99
137
100
138
setupHook = ./setup-hook.sh;
139
139
+
140
140
+
passthru = {
141
141
+
inherit withPlugins allPlugins;
142
142
+
};
101
143
102
144
meta = with lib; {
103
145
description = "Open RTL synthesis framework and tools";
+1
pkgs/development/compilers/yosys/plugins/bluespec.nix
···
5
5
stdenv.mkDerivation {
6
6
pname = "yosys-bluespec";
7
7
version = "2021.09.08";
8
8
+
plugin = "bluespec";
8
9
9
10
src = fetchFromGitHub {
10
11
owner = "thoughtpolice";
+1
pkgs/development/compilers/yosys/plugins/ghdl.nix
···
5
5
stdenv.mkDerivation {
6
6
pname = "yosys-ghdl";
7
7
version = "2021.01.25";
8
8
+
plugin = "ghdl";
8
9
9
10
src = fetchFromGitHub {
10
11
owner = "ghdl";
+15
pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch
···
1
1
+
diff --git a/yql-qlf-plugin/Makefile b/ql-qlf-plugin/Makefile
2
2
+
index 2819055c9fe..0e391581012 100644
3
3
+
--- a/ql-qlf-plugin/Makefile
4
4
+
+++ b/ql-qlf-plugin/Makefile
5
5
+
@@ -55,10 +55,6 @@ VERILOG_MODULES = $(COMMON)/cells_sim.v \
6
6
+
$(PP3_DIR)/mult_sim.v \
7
7
+
$(PP3_DIR)/qlal3_sim.v \
8
8
+
9
9
+
-retrieve-pmgen:=$(shell mkdir -p pmgen && wget -nc -O pmgen/pmgen.py https://raw.githubusercontent.com/SymbiFlow/yosys/master%2Bwip/passes/pmgen/pmgen.py)
10
10
+
-
11
11
+
-pre-build:=$(shell python3 pmgen/pmgen.py -o pmgen/ql-dsp-pm.h -p ql_dsp ql_dsp.pmg)
12
12
+
-
13
13
+
install_modules: $(VERILOG_MODULES)
14
14
+
$(foreach f,$^,install -D $(f) $(DATA_DIR)/quicklogic/$(f);)
15
15
+
+106
pkgs/development/compilers/yosys/plugins/symbiflow.nix
···
1
1
+
{ fetchFromGitHub
2
2
+
, gtest
3
3
+
, lib
4
4
+
, python3
5
5
+
, readline
6
6
+
, stdenv
7
7
+
, which
8
8
+
, yosys
9
9
+
, zlib
10
10
+
, yosys-symbiflow
11
11
+
}: let
12
12
+
13
13
+
src = fetchFromGitHub {
14
14
+
owner = "SymbiFlow";
15
15
+
repo = "yosys-symbiflow-plugins";
16
16
+
rev = "35c6c33811a8de7c80dff6a7bcf7aa6ec9b21233";
17
17
+
hash = "sha256-g5dX9+R+gWt8e7Bhbbg60O9qa+Vi6Ar0M1sHhYlAre8=";
18
18
+
};
19
19
+
20
20
+
version = "2022.01.06";
21
21
+
22
22
+
# Supported symbiflow plugins.
23
23
+
#
24
24
+
# The following are disabled:
25
25
+
#
26
26
+
# "ql-qlf" builds but fails to load the plugin, so is not currently supported.
27
27
+
#
28
28
+
# "UHDM" doesn't currently build, as the work to package UHDM and surelog has
29
29
+
# not (yet) been undertaken.
30
30
+
plugins = [
31
31
+
"design_introspection"
32
32
+
"fasm"
33
33
+
"integrateinv"
34
34
+
"params"
35
35
+
"ql-iob"
36
36
+
# "ql-qlf"
37
37
+
"sdc"
38
38
+
"xdc"
39
39
+
# "UHDM"
40
40
+
];
41
41
+
42
42
+
static_gtest = gtest.dev.overrideAttrs (old: {
43
43
+
dontDisableStatic = true;
44
44
+
disableHardening = [ "pie" ];
45
45
+
cmakeFlags = old.cmakeFlags ++ ["-DBUILD_SHARED_LIBS=OFF"];
46
46
+
});
47
47
+
48
48
+
in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
49
49
+
pname = "yosys-symbiflow-${plugin}-plugin";
50
50
+
inherit src version plugin;
51
51
+
enableParallelBuilding = true;
52
52
+
53
53
+
nativeBuildInputs = [ which python3 ];
54
54
+
buildInputs = [ yosys readline zlib ] ;
55
55
+
56
56
+
# xdc has an incorrect path to a test which has yet to be patched
57
57
+
doCheck = plugin != "xdc";
58
58
+
checkInputs = [ static_gtest ];
59
59
+
60
60
+
# ql-qlf tries to fetch a yosys script from github
61
61
+
# Run the script in preBuild instead.
62
62
+
patches = lib.optional ( plugin == "ql-qlf" ) ./symbiflow-pmgen.patch;
63
63
+
64
64
+
preBuild = ''
65
65
+
mkdir -p ql-qlf-plugin/pmgen
66
66
+
''
67
67
+
+ lib.optionalString ( plugin == "ql-qlf" ) ''
68
68
+
python3 ${yosys.src}/passes/pmgen/pmgen.py -o ql-qlf-plugin/pmgen/ql-dsp-pm.h -p ql_dsp ql-qlf-plugin/ql_dsp.pmg
69
69
+
'';
70
70
+
71
71
+
# Providing a symlink avoids the need for patching the test makefile
72
72
+
postUnpack = ''
73
73
+
mkdir -p source/third_party/googletest/googletest/build/
74
74
+
ln -s ${static_gtest}/lib source/third_party/googletest/googletest/build/lib
75
75
+
'';
76
76
+
77
77
+
makeFlags = [
78
78
+
"PLUGIN_LIST=${plugin}"
79
79
+
];
80
80
+
81
81
+
buildFlags = [
82
82
+
"PLUGINS_DIR=\${out}/share/yosys/plugins/"
83
83
+
"DATA_DIR=\${out}/share/yosys/"
84
84
+
];
85
85
+
86
86
+
checkFlags = [
87
87
+
"PLUGINS_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
88
88
+
"DATA_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
89
89
+
( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
90
90
+
# sdc and xdc plugins use design introspection for their tests
91
91
+
+ (lib.optionalString ( plugin == "sdc" || plugin == "xdc" )
92
92
+
":${yosys-symbiflow.design_introspection}/share/yosys/plugins/")
93
93
+
)
94
94
+
];
95
95
+
96
96
+
installFlags = buildFlags;
97
97
+
98
98
+
meta = with lib; {
99
99
+
description = "Symbiflow ${plugin} plugin for Yosys";
100
100
+
license = licenses.isc;
101
101
+
platforms = platforms.all;
102
102
+
maintainers = with maintainers; [ ollieB thoughtpolice ];
103
103
+
};
104
104
+
}))
105
105
+
106
106
+
+1
pkgs/top-level/all-packages.nix
···
13315
13315
yosys = callPackage ../development/compilers/yosys { };
13316
13316
yosys-bluespec = callPackage ../development/compilers/yosys/plugins/bluespec.nix { };
13317
13317
yosys-ghdl = callPackage ../development/compilers/yosys/plugins/ghdl.nix { };
13318
13318
+
yosys-symbiflow = callPackage ../development/compilers/yosys/plugins/symbiflow.nix { };
13318
13319
13319
13320
z88dk = callPackage ../development/compilers/z88dk { };
13320
13321