about summary refs log tree commit diff
path: root/pkgs/development/compilers/yosys
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/yosys')
-rw-r--r--pkgs/development/compilers/yosys/default.nix176
-rw-r--r--pkgs/development/compilers/yosys/fix-clang-build.patch42
-rw-r--r--pkgs/development/compilers/yosys/plugin-search-dirs.patch45
-rw-r--r--pkgs/development/compilers/yosys/plugins/bluespec.nix33
-rw-r--r--pkgs/development/compilers/yosys/plugins/ghdl.nix47
-rw-r--r--pkgs/development/compilers/yosys/plugins/symbiflow.nix99
-rw-r--r--pkgs/development/compilers/yosys/plugins/synlig.nix102
-rw-r--r--pkgs/development/compilers/yosys/setup-hook.sh5
8 files changed, 0 insertions, 549 deletions
diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix
deleted file mode 100644
index 3205f5b22dcd..000000000000
--- a/pkgs/development/compilers/yosys/default.nix
+++ /dev/null
@@ -1,176 +0,0 @@
-{ stdenv
-, lib
-, abc-verifier
-, bash
-, bison
-, boost
-, fetchFromGitHub
-, flex
-, libffi
-, makeWrapper
-, pkg-config
-, python3
-, readline
-, symlinkJoin
-, tcl
-, verilog
-, zlib
-, yosys
-, yosys-bluespec
-, yosys-ghdl
-, yosys-symbiflow
-, enablePython ? true # enable python binding
-}:
-
-# NOTE: as of late 2020, yosys has switched to an automation robot that
-# automatically tags their repository Makefile with a new build number every
-# day when changes are committed. please MAKE SURE that the version number in
-# the 'version' field exactly matches the YOSYS_VER field in the Yosys
-# makefile!
-#
-# if a change in yosys isn't yet available under a build number like this (i.e.
-# it was very recently merged, within an hour), wait a few hours for the
-# automation robot to tag the new version, like so:
-#
-#     https://github.com/YosysHQ/yosys/commit/71ca9a825309635511b64b3ec40e5e5e9b6ad49b
-#
-# note that while most nix packages for "unstable versions" use a date-based
-# version scheme, synchronizing the nix package version here with the unstable
-# yosys version number helps users report better bugs upstream, and is
-# ultimately less confusing than using dates.
-
-let
-
-  # Provides a wrapper for creating a yosys with the specifed plugins preloaded
-  #
-  # Example:
-  #
-  #     my_yosys = yosys.withPlugins (with yosys.allPlugins; [
-  #        fasm
-  #        bluespec
-  #     ]);
-  withPlugins = plugins:
-    let
-      paths = lib.closePropagation plugins;
-      module_flags = with builtins; concatStringsSep " "
-        (map (n: "--add-flags -m --add-flags ${n.plugin}") plugins);
-    in lib.appendToName "with-plugins" ( symlinkJoin {
-      inherit (yosys) name;
-      paths = paths ++ [ yosys ] ;
-      nativeBuildInputs = [ makeWrapper ];
-      postBuild = ''
-        wrapProgram $out/bin/yosys \
-          --set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \
-          ${module_flags}
-      '';
-    });
-
-  allPlugins = {
-    bluespec = yosys-bluespec;
-    ghdl     = yosys-ghdl;
-  } // (yosys-symbiflow);
-
-  boost_python = boost.override {
-    enablePython = true;
-    python = python3;
-  };
-
-in stdenv.mkDerivation (finalAttrs: {
-  pname   = "yosys";
-  version = "0.38";
-
-  src = fetchFromGitHub {
-    owner = "YosysHQ";
-    repo  = "yosys";
-    rev   = "refs/tags/${finalAttrs.pname}-${finalAttrs.version}";
-    hash  = "sha256-mzMBhnIEgToez6mGFOvO7zBA+rNivZ9OnLQsjBBDamA=";
-  };
-
-  enableParallelBuilding = true;
-  nativeBuildInputs = [ pkg-config bison flex ];
-  propagatedBuildInputs = [
-    tcl
-    readline
-    libffi
-    zlib
-    (python3.withPackages (pp: with pp; [
-      click
-    ]))
-  ] ++ lib.optional enablePython boost_python;
-
-  makeFlags = [ "PREFIX=${placeholder "out"}"];
-
-  patches = [
-    ./plugin-search-dirs.patch
-    ./fix-clang-build.patch # see https://github.com/YosysHQ/yosys/issues/2011
-  ];
-
-  postPatch = ''
-    substituteInPlace ./Makefile \
-      --replace-fail 'echo UNKNOWN' 'echo ${builtins.substring 0 10 finalAttrs.src.rev}'
-
-    # https://github.com/YosysHQ/yosys/pull/4199
-    substituteInPlace ./tests/various/clk2fflogic_effects.sh \
-      --replace-fail 'tail +3' 'tail -n +3'
-
-    chmod +x ./misc/yosys-config.in
-    patchShebangs tests ./misc/yosys-config.in
-  '';
-
-  preBuild = let
-    shortAbcRev = builtins.substring 0 7 abc-verifier.rev;
-  in ''
-    chmod -R u+w .
-    make config-${if stdenv.cc.isClang or false then "clang" else "gcc"}
-    echo 'ABCEXTERNAL = ${abc-verifier}/bin/abc' >> Makefile.conf
-
-    if ! grep -q "ABCREV = ${shortAbcRev}" Makefile; then
-      echo "ERROR: yosys isn't compatible with the provided abc (${shortAbcRev}), failing."
-      exit 1
-    fi
-
-    if ! grep -q "YOSYS_VER := $version" Makefile; then
-      echo "ERROR: yosys version in Makefile isn't equivalent to version of the nix package (allegedly ${finalAttrs.version}), failing."
-      exit 1
-    fi
-  '' + lib.optionalString enablePython ''
-    echo "ENABLE_PYOSYS := 1" >> Makefile.conf
-    echo "PYTHON_DESTDIR := $out/${python3.sitePackages}" >> Makefile.conf
-    echo "BOOST_PYTHON_LIB := -lboost_python${lib.versions.major python3.version}${lib.versions.minor python3.version}" >> Makefile.conf
-  '';
-
-  preCheck = ''
-    # autotest.sh automatically compiles a utility during startup if it's out of date.
-    # having N check jobs race to do that creates spurious codesigning failures on macOS.
-    # run it once without asking it to do anything so that compilation is done before the jobs start.
-    tests/tools/autotest.sh
-  '';
-
-  checkTarget = "test";
-  doCheck = true;
-  nativeCheckInputs = [ verilog ];
-
-  # Internally, yosys knows to use the specified hardcoded ABCEXTERNAL binary.
-  # But other tools (like mcy or symbiyosys) can't know how yosys was built, so
-  # they just assume that 'yosys-abc' is available -- but it's not installed
-  # when using ABCEXTERNAL
-  #
-  # add a symlink to fake things so that both variants work the same way. this
-  # is also needed at build time for the test suite.
-  postBuild   = "ln -sfv ${abc-verifier}/bin/abc ./yosys-abc";
-  postInstall = "ln -sfv ${abc-verifier}/bin/abc $out/bin/yosys-abc";
-
-  setupHook = ./setup-hook.sh;
-
-  passthru = {
-    inherit withPlugins allPlugins;
-  };
-
-  meta = with lib; {
-    description = "Open RTL synthesis framework and tools";
-    homepage    = "https://yosyshq.net/yosys/";
-    license     = licenses.isc;
-    platforms   = platforms.all;
-    maintainers = with maintainers; [ shell thoughtpolice Luflosi ];
-  };
-})
diff --git a/pkgs/development/compilers/yosys/fix-clang-build.patch b/pkgs/development/compilers/yosys/fix-clang-build.patch
deleted file mode 100644
index 843ffd6d65af..000000000000
--- a/pkgs/development/compilers/yosys/fix-clang-build.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -215,7 +215,7 @@ ABC_ARCHFLAGS += "-DABC_NO_RLIMIT"
- endif
- 
- ifeq ($(CONFIG),clang)
--CXX = clang
-+CXX = clang++
- LD = clang++
- CXXFLAGS += -std=$(CXXSTD) -Os
- ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -Wno-c++11-narrowing $(ABC_ARCHFLAGS)"
---- a/tests/cxxrtl/run-test.sh
-+++ b/tests/cxxrtl/run-test.sh
-@@ -5,7 +5,7 @@ set -ex
- run_subtest () {
-     local subtest=$1; shift
- 
--    ${CC:-gcc} -std=c++11 -O2 -o cxxrtl-test-${subtest} -I../../backends/cxxrtl/runtime test_${subtest}.cc -lstdc++
-+    ${CXX:-gcc} -std=c++11 -O2 -o cxxrtl-test-${subtest} -I../../backends/cxxrtl/runtime test_${subtest}.cc -lstdc++
-     ./cxxrtl-test-${subtest}
- }
- 
---- a/tests/fmt/run-test.sh
-+++ b/tests/fmt/run-test.sh
-@@ -51,7 +51,7 @@ test_cxxrtl () {
- 	local subtest=$1; shift
- 
- 	../../yosys -p "read_verilog ${subtest}.v; proc; clean; write_cxxrtl -print-output std::cerr yosys-${subtest}.cc"
--	${CC:-gcc} -std=c++11 -o yosys-${subtest} -I../../backends/cxxrtl/runtime ${subtest}_tb.cc -lstdc++
-+	${CXX:-gcc} -std=c++11 -o yosys-${subtest} -I../../backends/cxxrtl/runtime ${subtest}_tb.cc -lstdc++
- 	./yosys-${subtest} 2>yosys-${subtest}.log
- 	iverilog -o iverilog-${subtest} ${subtest}.v ${subtest}_tb.v
- 	./iverilog-${subtest} |grep -v '\$finish called' >iverilog-${subtest}.log
-@@ -69,7 +69,7 @@ diff iverilog-always_full.log iverilog-always_full-1.log
- 
- ../../yosys -p "read_verilog display_lm.v" >yosys-display_lm.log
- ../../yosys -p "read_verilog display_lm.v; write_cxxrtl yosys-display_lm.cc"
--${CC:-gcc} -std=c++11 -o yosys-display_lm_cc -I../../backends/cxxrtl/runtime display_lm_tb.cc -lstdc++
-+${CXX:-gcc} -std=c++11 -o yosys-display_lm_cc -I../../backends/cxxrtl/runtime display_lm_tb.cc -lstdc++
- ./yosys-display_lm_cc >yosys-display_lm_cc.log
- for log in yosys-display_lm.log yosys-display_lm_cc.log; do
- 	grep "^%l: \\\\bot\$" "$log"
diff --git a/pkgs/development/compilers/yosys/plugin-search-dirs.patch b/pkgs/development/compilers/yosys/plugin-search-dirs.patch
deleted file mode 100644
index 354eeddbc2e1..000000000000
--- a/pkgs/development/compilers/yosys/plugin-search-dirs.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-diff --git i/passes/cmds/plugin.cc w/passes/cmds/plugin.cc
-index 08b4aa8c4..f00f540e9 100644
---- i/passes/cmds/plugin.cc
-+++ w/passes/cmds/plugin.cc
-@@ -87,15 +87,33 @@ void load_plugin(std::string filename, std::vector<std::string> aliases)
- 
- 			// We were unable to open the file, try to do so from the plugin directory
- 			if (hdl == NULL && orig_filename.find('/') == std::string::npos) {
--				hdl = dlopen([orig_filename]() {
--					std::string new_path = proc_share_dirname() + "plugins/" + orig_filename;
-+                            std::string install_dir = proc_share_dirname() + "plugins";
- 
--					// Check if we need to append .so
--					if (new_path.find(".so") == std::string::npos)
--						new_path.append(".so");
-+				vector<string> all_dirs;
-+				all_dirs.push_back(install_dir);
- 
--					return new_path;
--				}().c_str(), RTLD_LAZY|RTLD_LOCAL);
-+				char* plugin_dirs = getenv("NIX_YOSYS_PLUGIN_DIRS");
-+				if (plugin_dirs != NULL) {
-+					std::string p(plugin_dirs), t;
-+					std::stringstream ss(p);
-+
-+					while(std::getline(ss, t, ':')) {
-+						all_dirs.push_back(t);
-+					}
-+				}
-+
-+				for (auto dir : all_dirs) {
-+					hdl = dlopen([dir, orig_filename]() {
-+						std::string new_path = dir + "/" + orig_filename;
-+
-+						// Check if we need to append .so
-+						if (new_path.find(".so") == std::string::npos)
-+							new_path.append(".so");
-+
-+						return new_path;
-+					}().c_str(), RTLD_LAZY|RTLD_LOCAL);
-+					if (hdl != NULL) break;
-+                                }
- 			}
- 
- 			if (hdl == NULL)
diff --git a/pkgs/development/compilers/yosys/plugins/bluespec.nix b/pkgs/development/compilers/yosys/plugins/bluespec.nix
deleted file mode 100644
index 77d4ad8cf9dc..000000000000
--- a/pkgs/development/compilers/yosys/plugins/bluespec.nix
+++ /dev/null
@@ -1,33 +0,0 @@
-{ stdenv, lib, fetchFromGitHub, pkg-config
-, yosys, readline, zlib, bluespec
-}:
-
-stdenv.mkDerivation {
-  pname = "yosys-bluespec";
-  version = "2021.09.08";
-  plugin = "bluespec";
-
-  src = fetchFromGitHub {
-    owner  = "thoughtpolice";
-    repo   = "yosys-bluespec";
-    rev    = "f6f4127a4e96e18080fd5362b6769fa3e24c76b1";
-    sha256 = "sha256-3cNFP/k4JsgLyUQHWU10Htl2Rh0staAcA3R4piD6hDE=";
-  };
-
-  buildInputs = [ yosys readline zlib bluespec ];
-  nativeBuildInputs = [ pkg-config ];
-
-  doCheck = true;
-  makeFlags = [
-    "PREFIX=$(out)/share/yosys/plugins"
-    "STATIC_BSC_PATH=${bluespec}/bin/bsc"
-    "STATIC_BSC_LIBDIR=${bluespec}/lib"
-  ];
-
-  meta = with lib; {
-    description = "Bluespec plugin for Yosys";
-    license     = licenses.isc;
-    platforms   = platforms.all;
-    maintainers = with maintainers; [ thoughtpolice ];
-  };
-}
diff --git a/pkgs/development/compilers/yosys/plugins/ghdl.nix b/pkgs/development/compilers/yosys/plugins/ghdl.nix
deleted file mode 100644
index 2ec17f391a99..000000000000
--- a/pkgs/development/compilers/yosys/plugins/ghdl.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{ stdenv
-, lib
-, fetchFromGitHub
-, pkg-config
-, yosys
-, readline
-, zlib
-, ghdl
-}:
-
-stdenv.mkDerivation {
-  pname = "yosys-ghdl";
-  # This is not the latest commit, but it's the latest that builds with current stable ghdl 2.0.0
-  version = "2022.01.11";
-  plugin = "ghdl";
-
-  src = fetchFromGitHub {
-    owner  = "ghdl";
-    repo   = "ghdl-yosys-plugin";
-    rev    = "c9b05e481423c55ffcbb856fd5296701f670808c";
-    sha256 = "sha256-tT2+DXUtbJIBzBUBcyG2sz+3G+dTkciLVIczcRPr0Jw=";
-  };
-
-  buildInputs = [
-    yosys
-    readline
-    zlib
-    ghdl
-  ];
-  nativeBuildInputs = [
-    pkg-config
-  ];
-
-  doCheck = true;
-  installPhase = ''
-    mkdir -p $out/share/yosys/plugins
-    cp ghdl.so $out/share/yosys/plugins/ghdl.so
-  '';
-
-  meta = with lib; {
-    description = "GHDL plugin for Yosys";
-    homepage    = "https://github.com/ghdl/ghdl-yosys-plugin";
-    license     = licenses.isc;
-    platforms   = platforms.all;
-    maintainers = with maintainers; [ thoughtpolice ];
-  };
-}
diff --git a/pkgs/development/compilers/yosys/plugins/symbiflow.nix b/pkgs/development/compilers/yosys/plugins/symbiflow.nix
deleted file mode 100644
index 2afa372b6ec4..000000000000
--- a/pkgs/development/compilers/yosys/plugins/symbiflow.nix
+++ /dev/null
@@ -1,99 +0,0 @@
-{ fetchFromGitHub
-, gtest
-, lib
-, python3
-, readline
-, stdenv
-, yosys
-, zlib
-, yosys-symbiflow
-, pkg-config
-}: let
-
-  version = "1.20230906";
-
-  src = fetchFromGitHub {
-    owner = "chipsalliance";
-    repo  = "yosys-f4pga-plugins";
-    rev   = "v${version}";
-    hash  = "sha256-XIn5wFw8i2njDN0Arua5BdZ0u1q6a/aJAs48YICehsc=";
-  };
-
-  # Supported symbiflow plugins.
-  #
-  # The following are disabled:
-  #
-  # "ql-qlf" builds but fails to load the plugin, so is not currently supported.
-  plugins = [
-    "design_introspection"
-    "fasm"
-    "integrateinv"
-    "params"
-    "ql-iob"
-    # "ql-qlf"
-    "sdc"
-    "xdc"
-  ];
-
-  static_gtest = gtest.overrideAttrs (old: {
-    dontDisableStatic = true;
-    disableHardening = [ "pie" ];
-    cmakeFlags = old.cmakeFlags ++ ["-DBUILD_SHARED_LIBS=OFF"];
-  });
-
-in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
-  pname = "yosys-symbiflow-${plugin}-plugin";
-  inherit src version plugin;
-  enableParallelBuilding = true;
-
-  nativeBuildInputs = [ python3 pkg-config ];
-  buildInputs = [
-    yosys
-    readline
-    zlib
-  ];
-
-  # xdc has an incorrect path to a test which has yet to be patched
-  doCheck = plugin != "xdc";
-  nativeCheckInputs = [ static_gtest ];
-
-  # 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 = ''
-    ln -s ${yosys.src}/passes/pmgen/pmgen.py pmgen.py
-  '';
-
-  # Providing a symlink avoids the need for patching the test makefile
-  postUnpack = ''
-    mkdir -p source/third_party/googletest/build/
-    ln -s ${static_gtest}/lib source/third_party/googletest/build/lib
-  '';
-
-  makeFlags = [
-    "PLUGIN_LIST=${plugin}"
-  ];
-
-  buildFlags = [
-    "YOSYS_PLUGINS_DIR=\${out}/share/yosys/plugins/"
-    "YOSYS_DATA_DIR=\${out}/share/yosys/"
-  ];
-
-  checkTarget = "test";
-  checkFlags = [
-    ( "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/")
-    )
-  ];
-
-  installFlags = buildFlags;
-
-  meta = with lib; {
-    description = "Symbiflow ${plugin} plugin for Yosys";
-    license     = licenses.isc;
-    platforms   = platforms.all;
-    maintainers = with maintainers; [ ollieB thoughtpolice ];
-  };
-}))
diff --git a/pkgs/development/compilers/yosys/plugins/synlig.nix b/pkgs/development/compilers/yosys/plugins/synlig.nix
deleted file mode 100644
index 0c6fc5e3f89e..000000000000
--- a/pkgs/development/compilers/yosys/plugins/synlig.nix
+++ /dev/null
@@ -1,102 +0,0 @@
-{ stdenv
-, lib
-, fetchFromGitHub
-, fetchpatch
-, pkg-config
-, antlr4
-, capnproto
-, readline
-, surelog
-, uhdm
-, yosys
-}:
-
-stdenv.mkDerivation (finalAttrs: {
-  pname = "yosys-synlig";
-  plugin = "synlig";
-
-  # The module has automatic regular releases, with date + short git hash
-  GIT_VERSION = "2023-11-28-b8ed72d";
-
-  # Derive our package version from GIT_VERSION, remove hash, just keep date.
-  version = builtins.concatStringsSep "-" (
-    lib.take 3 (builtins.splitVersion finalAttrs.GIT_VERSION));
-
-  src = fetchFromGitHub {
-    owner = "chipsalliance";
-    repo  = "synlig";
-    rev   = "${finalAttrs.GIT_VERSION}";
-    hash  = "sha256-jdA3PBodecqriGWU/BzWtQ5gyu62pZHv+1NvFrwsTTk=";
-    fetchSubmodules = false;  # we use all dependencies from nix
-  };
-
-  patches = [
-    (fetchpatch {
-      # Fixes https://github.com/chipsalliance/synlig/issues/2299
-      name = "make-compile-for-yosys-0.37.patch";
-      url = "https://github.com/chipsalliance/synlig/commit/3dd46d4769c20b6dd1163310f8e56560b351a211.patch";
-      hash = "sha256-OP/2HA/Ukt6o5aKgoBk19P6T/33btU/x6VnoIVXct1g=";
-    })
-  ];
-
-  nativeBuildInputs = [
-    pkg-config
-  ];
-
-  buildInputs = [
-    antlr4.runtime.cpp
-    capnproto
-    readline
-    surelog
-    uhdm
-    yosys
-  ];
-
-  buildPhase = ''
-    runHook preBuild
-
-    # Remove assumptions that submodules are available.
-    rm -f third_party/Build.*.mk
-
-    # Create a stub makefile include that delegates the parameter-gathering
-    # to yosys-config
-    cat > third_party/Build.yosys.mk << "EOF"
-    t  := yosys
-    ts := ''$(call GetTargetStructName,''${t})
-
-    ''${ts}.src_dir   := ''$(shell yosys-config --datdir/include)
-    ''${ts}.mod_dir   := ''${TOP_DIR}third_party/yosys_mod/
-    EOF
-
-    make -j $NIX_BUILD_CORES build@systemverilog-plugin \
-            LDFLAGS="''$(yosys-config --ldflags --ldlibs)"
-    runHook postBuild
-  '';
-
-  # Check that the plugin can be loaded successfully and parse simple file.
-  doCheck = true;
-  checkPhase = ''
-     runHook preCheck
-     echo "module litmustest(); endmodule;" > litmustest.sv
-     yosys -p "plugin -i build/release/systemverilog-plugin/systemverilog.so;\
-               read_systemverilog litmustest.sv"
-     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;
-    broken      = versionAtLeast yosys.version "0.39";
-  };
-})
diff --git a/pkgs/development/compilers/yosys/setup-hook.sh b/pkgs/development/compilers/yosys/setup-hook.sh
deleted file mode 100644
index d01bbdd1a8c1..000000000000
--- a/pkgs/development/compilers/yosys/setup-hook.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-addYosysPluginPath() {
-  addToSearchPath NIX_YOSYS_PLUGIN_DIRS "$1/share/yosys/plugins"
-}
-
-addEnvHooks "$targetOffset" addYosysPluginPath