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