about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/yosys
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/yosys')
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/default.nix6
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/synlig-makefile-for-nix.patch66
-rw-r--r--nixpkgs/pkgs/development/compilers/yosys/plugins/synlig.nix73
4 files changed, 144 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/development/compilers/yosys/default.nix b/nixpkgs/pkgs/development/compilers/yosys/default.nix
index ae7a653d7473..0ea755f7348b 100644
--- a/nixpkgs/pkgs/development/compilers/yosys/default.nix
+++ b/nixpkgs/pkgs/development/compilers/yosys/default.nix
@@ -71,13 +71,13 @@ let
 
 in stdenv.mkDerivation rec {
   pname   = "yosys";
-  version = "0.33";
+  version = "0.34";
 
   src = fetchFromGitHub {
     owner = "YosysHQ";
     repo  = "yosys";
-    rev   = "${pname}-${version}";
-    hash  = "sha256-3MsWF161pqqeAbmeTlkQY6UpU4pq1WT0XXK9yciwt0M=";
+    rev   = "refs/tags/${pname}-${version}";
+    hash  = "sha256-GHDsMBj7DRb9ffESgzd1HzDAA6Cyft5PomidvIMzn9g=";
   };
 
   enableParallelBuilding = true;
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
index 481d2475907c..2afa372b6ec4 100644
--- a/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
@@ -7,20 +7,16 @@
 , yosys
 , zlib
 , yosys-symbiflow
-, uhdm
-, capnproto
-, surelog
-, antlr4
 , pkg-config
 }: let
 
-  version = "1.20230808";
+  version = "1.20230906";
 
   src = fetchFromGitHub {
     owner = "chipsalliance";
     repo  = "yosys-f4pga-plugins";
     rev   = "v${version}";
-    hash  = "sha256-wksAHLgLjVZE4Vk2QVcJN1mnQ9mxWCZHk55oO99cVJ0=";
+    hash  = "sha256-XIn5wFw8i2njDN0Arua5BdZ0u1q6a/aJAs48YICehsc=";
   };
 
   # Supported symbiflow plugins.
@@ -37,7 +33,6 @@
     # "ql-qlf"
     "sdc"
     "xdc"
-    "systemverilog"
   ];
 
   static_gtest = gtest.overrideAttrs (old: {
@@ -56,10 +51,6 @@ in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
     yosys
     readline
     zlib
-    uhdm
-    surelog
-    capnproto
-    antlr4.runtime.cpp
   ];
 
   # xdc has an incorrect path to a test which has yet to be patched
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig-makefile-for-nix.patch b/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig-makefile-for-nix.patch
new file mode 100644
index 000000000000..7d1f407d6fdc
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig-makefile-for-nix.patch
@@ -0,0 +1,66 @@
+diff --git a/Makefile b/Makefile
+index 4c96ae7..9e1a2e3 100755
+--- a/Makefile
++++ b/Makefile
+@@ -3,7 +3,7 @@
+ # Setup make itself.
+ 
+ .ONESHELL:
+-override SHELL := /bin/bash
++SHELL := bash
+ override .SHELLFLAGS := -e -u -o pipefail -O nullglob -O extglob -O globstar -c
+ 
+ # Unset all default build- and recipe-related variables.
+@@ -315,7 +315,6 @@ endif
+ GetTargetStructName = target[${1}]
+ 
+ makefiles_to_include := \
+-	third_party/Build.*.mk \
+ 	frontends/*/Build.mk \
+ 	tests/*/Build.mk \
+ 	lib/*/Build.mk
+diff --git a/frontends/systemverilog/Build.mk b/frontends/systemverilog/Build.mk
+index acd9cb6..c039994 100644
+--- a/frontends/systemverilog/Build.mk
++++ b/frontends/systemverilog/Build.mk
+@@ -1,6 +1,7 @@
+ t       := systemverilog-plugin
+ ts      := $(call GetTargetStructName,${t})
+ out_dir := $(call GetTargetBuildDir,${t})
++mod_dir := third_party/yosys_mod
+ 
+ cxx_is_clang := $(findstring clang,$(notdir ${CXX}))
+ 
+@@ -13,9 +14,9 @@ ${ts}.sources := \
+ 	${${ts}.src_dir}uhdm_ast_frontend.cc \
+ 	${${ts}.src_dir}uhdm_common_frontend.cc \
+ 	${${ts}.src_dir}uhdm_surelog_ast_frontend.cc \
+-	${$(call GetTargetStructName,yosys).mod_dir}const2ast.cc \
+-	${$(call GetTargetStructName,yosys).mod_dir}edif.cc \
+-	${$(call GetTargetStructName,yosys).mod_dir}simplify.cc
++	$(mod_dir)/const2ast.cc \
++	$(mod_dir)/edif.cc \
++	$(mod_dir)/simplify.cc
+ 
+ define ${ts}.env =
+ export PKG_CONFIG_PATH=$(call ShQuote,${$(call GetTargetStructName,surelog).output_vars.PKG_CONFIG_PATH}$(if ${PKG_CONFIG_PATH},:${PKG_CONFIG_PATH}))
+@@ -35,8 +36,8 @@ endif
+ endif
+ 
+ ${ts}.cxxflags = \
+-	-I${$(call GetTargetStructName,yosys).src_dir} \
+-	-I${$(call GetTargetStructName,yosys).mod_dir} \
++	-I$(shell yosys-config --cxxflags) \
++	-I$(mod_dir) \
+ 	-D_YOSYS_ \
+ 	-DYOSYS_ENABLE_PLUGINS \
+ 	$(shell ${${ts}.env}; pkg-config --cflags Surelog) \
+@@ -55,7 +56,7 @@ ${ts}.ldflags = \
+ 	$(shell ${${ts}.env}; pkg-config --libs-only-L Surelog) \
+ 	${build_type_ldflags} \
+ 	${LDFLAGS} \
+-	-Wl,--export-dynamic
++	$(shell yosys-config --ldflags --ldlibs)
+ 
+ ${ts}.ldlibs = \
+ 	$(shell ${${ts}.env}; pkg-config --libs-only-l --libs-only-other Surelog) \
diff --git a/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig.nix b/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig.nix
new file mode 100644
index 000000000000..ccbf88159313
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/yosys/plugins/synlig.nix
@@ -0,0 +1,73 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, pkg-config
+, antlr4
+, capnproto
+, readline
+, surelog
+, uhdm
+, yosys
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "yosys-synlig";
+  version = "2023.10.12";  # Currently no tagged versions upstream
+  plugin = "synlig";
+
+  src = fetchFromGitHub {
+    owner  = "chipsalliance";
+    repo   = "synlig";
+    rev    = "c5bd73595151212c61709d69a382917e96877a14";
+    sha256 = "sha256-WJhf5gdZTCs3EeNocP9aZAh6EZquHgYOG/xiTo8l0ao=";
+    fetchSubmodules = false;  # we use all dependencies from nix
+  };
+
+  patches = [
+    ./synlig-makefile-for-nix.patch  # Remove assumption submodules available.
+  ];
+
+  nativeBuildInputs = [
+    pkg-config
+  ];
+
+  buildInputs = [
+    antlr4.runtime.cpp
+    capnproto
+    readline
+    surelog
+    uhdm
+    yosys
+  ];
+
+  buildPhase = ''
+    runHook preBuild
+    make -j $NIX_BUILD_CORES build@systemverilog-plugin
+    runHook postBuild
+  '';
+
+  # Very simple litmus test that the plugin can be loaded successfully.
+  doCheck = true;
+  checkPhase = ''
+     runHook preCheck
+     yosys -p "plugin -i build/release/systemverilog-plugin/systemverilog.so;\
+               help read_systemverilog" | grep "Read SystemVerilog files using"
+     runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/share/yosys/plugins
+    cp ./build/release/systemverilog-plugin/systemverilog.so \
+           $out/share/yosys/plugins/systemverilog.so
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "SystemVerilog support plugin for Yosys";
+    homepage    = "https://github.com/chipsalliance/synlig";
+    license     = licenses.asl20;
+    maintainers = with maintainers; [ hzeller ];
+    platforms   = platforms.all;
+  };
+})