Commit b35c185f authored by Gon Solo's avatar Gon Solo
Browse files

yosys: 0.55 -> 0.60

parent 0c78bdb8
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
diff --git a/tests/cxxrtl/run-test.sh b/tests/cxxrtl/run-test.sh
index ee299fc82..595cd3f88 100755
--- 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}
 }

@@ -14,4 +14,4 @@ run_subtest value_fuzz

 # Compile-only test.
 ../../yosys -p "read_verilog test_unconnected_output.v; select =*; proc; clean; write_cxxrtl cxxrtl-test-unconnected_output.cc"
-${CC:-gcc} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc
+${CXX:-gcc} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc
diff --git a/tests/fmt/run-test.sh b/tests/fmt/run-test.sh
index 998047f83..2a4a59f01 100644
--- 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"
+5 −16
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch2,

  # nativeBuildInputs
  bison,
@@ -88,13 +87,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "yosys";
  version = "0.55";
  version = "0.60";

  src = fetchFromGitHub {
    owner = "YosysHQ";
    repo = "yosys";
    tag = "v${finalAttrs.version}";
    hash = "sha256-GddNbAtH5SPm7KTa5kCm/vGq4xOczx+jCnOSQl55gUI=";
    hash = "sha256-BVrSq9nWbdu/PIXfwLW7ZkHTz6SrmsqJMSkVa6CsBm8=";
    fetchSubmodules = true;
    leaveDotGit = true;
    postFetch = ''
@@ -126,6 +125,8 @@ stdenv.mkDerivation (finalAttrs: {
    (python3.withPackages (
      pp: with pp; [
        click
        cxxheaderparser
        pybind11
      ]
    ))
  ]
@@ -135,19 +136,6 @@ stdenv.mkDerivation (finalAttrs: {

  makeFlags = [ "PREFIX=${placeholder "out"}" ];

  patches = [
    # Backport fix amaranth code compilation
    # TODO remove when updating to 0.56
    # https://github.com/YosysHQ/yosys/pull/5182
    (fetchpatch2 {
      name = "treat-zero-width-constant-as-zero.patch";
      url = "https://github.com/YosysHQ/yosys/commit/478b6a2b3fbab0fd4097b841914cbe8bb9f67268.patch";
      hash = "sha256-KeLoZfkXMk2KIPN9XBQdqWqohywQONlWUIvrGwgphKs=";
    })
    ./plugin-search-dirs.patch
    ./fix-clang-build.patch
  ];

  postPatch = ''
    substituteInPlace ./Makefile \
      --replace-fail 'echo UNKNOWN' 'echo ${builtins.substring 0 10 finalAttrs.src.rev}'
@@ -165,6 +153,7 @@ stdenv.mkDerivation (finalAttrs: {
    fi
  ''
  + lib.optionalString enablePython ''
    echo "PYOSYS_USE_UV := 0" >> Makefile.conf
    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
+0 −45
Original line number Diff line number Diff line
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)