about summary refs log tree commit diff
path: root/pkgs/development/compilers/yosys
diff options
context:
space:
mode:
authorHenner Zeller <h.zeller@acm.org>2023-04-15 19:21:55 -0700
committerAustin Seipp <aseipp@pobox.com>2023-04-26 01:47:32 -0500
commit123b92da6c94e3a63758d1aecf5f6fc5996d150a (patch)
tree48e76ec3fbd035bbe62caa08735efd21555264d0 /pkgs/development/compilers/yosys
parente3032b1d788cc798127cd265acff5333090b1374 (diff)
yosys-symbiflow: 2023.02.08 -> 1.20230425
The plugin now has a tagged version that is based on the date.
Previously, we had to use a random commit and manually choose the
relevant date. Now, we use the official tag as a version here
and to fetch from git.

While at it: fix the tests - somewhere over the course of the
lasts year, the tests stopped being run. Fixed now.
Diffstat (limited to 'pkgs/development/compilers/yosys')
-rw-r--r--pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch15
-rw-r--r--pkgs/development/compilers/yosys/plugins/symbiflow.nix47
2 files changed, 26 insertions, 36 deletions
diff --git a/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch b/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch
deleted file mode 100644
index 8af0f86a89b40..0000000000000
--- a/pkgs/development/compilers/yosys/plugins/symbiflow-pmgen.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/yql-qlf-plugin/Makefile b/ql-qlf-plugin/Makefile
-index 2819055c9fe..0e391581012 100644
---- a/ql-qlf-plugin/Makefile
-+++ b/ql-qlf-plugin/Makefile
-@@ -55,10 +55,6 @@ VERILOG_MODULES = $(COMMON)/cells_sim.v         \
-                   $(PP3_DIR)/mult_sim.v        \
-                   $(PP3_DIR)/qlal3_sim.v       \
-
--retrieve-pmgen:=$(shell mkdir -p pmgen && wget -nc -O pmgen/pmgen.py https://raw.githubusercontent.com/SymbiFlow/yosys/master%2Bwip/passes/pmgen/pmgen.py)
--
--pre-build:=$(shell python3 pmgen/pmgen.py -o pmgen/ql-dsp-pm.h -p ql_dsp ql_dsp.pmg)
--
- install_modules: $(VERILOG_MODULES)
- 	$(foreach f,$^,install -D $(f) $(DATA_DIR)/quicklogic/$(f);)
-
diff --git a/pkgs/development/compilers/yosys/plugins/symbiflow.nix b/pkgs/development/compilers/yosys/plugins/symbiflow.nix
index 1ff817a82969e..f383efbd44e8b 100644
--- a/pkgs/development/compilers/yosys/plugins/symbiflow.nix
+++ b/pkgs/development/compilers/yosys/plugins/symbiflow.nix
@@ -8,19 +8,22 @@
 , zlib
 , yosys-symbiflow
 , uhdm
+, capnproto
 , surelog
+, antlr4
 , flatbuffers
+, pkg-config
 }: let
 
+  version = "1.20230425";
+
   src = fetchFromGitHub {
-    owner  = "chipsalliance";
-    repo   = "yosys-f4pga-plugins";
-    rev    = "08430ec4f53d1cf9d6a2091211d6c5ce501d5486";
-    hash   = "sha256-xCFi8OrNfsKt7bVSYJ/yuBify/pyCU1rI16gaCBgil8=";
+    owner = "chipsalliance";
+    repo  = "yosys-f4pga-plugins";
+    rev   = "v${version}";
+    hash  = "sha256-KNkmhvpKTby85P88+DqCOOGxIKpzbw5KF9ymqy40pfw=";
   };
 
-  version = "2023.02.08";
-
   # Supported symbiflow plugins.
   #
   # The following are disabled:
@@ -38,7 +41,7 @@
     "systemverilog"
   ];
 
-  static_gtest = gtest.dev.overrideAttrs (old: {
+  static_gtest = gtest.overrideAttrs (old: {
     dontDisableStatic = true;
     disableHardening = [ "pie" ];
     cmakeFlags = old.cmakeFlags ++ ["-DBUILD_SHARED_LIBS=OFF"];
@@ -49,23 +52,26 @@ in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
   inherit src version plugin;
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ python3 ];
-  buildInputs = [ yosys readline zlib uhdm surelog ];
+  nativeBuildInputs = [ python3 pkg-config ];
+  buildInputs = [
+    yosys
+    readline
+    zlib
+    uhdm
+    surelog
+    capnproto
+    antlr4.runtime.cpp
+  ];
 
   # xdc has an incorrect path to a test which has yet to be patched
   doCheck = plugin != "xdc";
   nativeCheckInputs = [ static_gtest ];
 
-  # ql-qlf tries to fetch a yosys script from github
-  # Run the script in preBuild instead.
-  patches = lib.optional ( plugin == "ql-qlf" ) ./symbiflow-pmgen.patch;
-
+  # A Makefile rule tries to wget-fetch a yosys script from github.
+  # Link the script from our yosys sources in preBuild instead, so that
+  # the Makefile rule is a no-op.
   preBuild = ''
-    export LDFLAGS="-L${flatbuffers}/lib"
-    mkdir -p ql-qlf-plugin/pmgen
-  ''
-  + lib.optionalString ( plugin == "ql-qlf" ) ''
-    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
+    ln -s ${yosys.src}/passes/pmgen/pmgen.py pmgen.py
   '';
 
   # Providing a symlink avoids the need for patching the test makefile
@@ -83,10 +89,9 @@ in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
     "YOSYS_DATA_DIR=\${out}/share/yosys/"
   ];
 
+  checkTarget = "test";
   checkFlags = [
-    "YOSYS_PLUGINS_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
-    "YOSYS_DATA_DIR=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
-    ( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin"
+    ( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin/build"
       # sdc and xdc plugins use design introspection for their tests
       + (lib.optionalString ( plugin == "sdc" || plugin == "xdc" )
         ":${yosys-symbiflow.design_introspection}/share/yosys/plugins/")