diff --git a/cmake/SilimateConfig.cmake b/cmake/SilimateConfig.cmake index b088b4124..ce69c69df 100644 --- a/cmake/SilimateConfig.cmake +++ b/cmake/SilimateConfig.cmake @@ -1,8 +1,13 @@ # Always force disable GNU Readline, GPL trap library -set(YOSYS_ENABLE_READLINE OFF CACHE INTERNAL "") +set(YOSYS_ENABLE_READLINE OFF CACHE BOOL "" FORCE) +set(YOSYS_WITHOUT_READLINE ON CACHE BOOL "" FORCE) # Silimate fork has Verific in top-level directory set(YOSYS_VERIFIC_DIR ${PROJECT_SOURCE_DIR}/verific) # Pyosys is the primary interface for the Silimate fork set(YOSYS_WITH_PYTHON ON CACHE BOOL "" FORCE) add_library(verific INTERFACE) + +if (LINUX) + add_link_options("-Wl,--allow-multiple-definition") +endif() diff --git a/cmake/SilimateVerific-merge-archive.py b/cmake/SilimateVerific-merge-archive.py index d5f06cc7a..9788f986b 100644 --- a/cmake/SilimateVerific-merge-archive.py +++ b/cmake/SilimateVerific-merge-archive.py @@ -44,7 +44,10 @@ for archive in filter(lambda x: x.endswith(".a"), files): object_dir.mkdir(parents=True, exist_ok=True) subprocess.check_call(["ar", "x", archive], cwd=object_dir) for object in object_dir.glob("*.o"): - if len(symbol_localize_args): + # on GNU/Linux we just use -Wl,--allow-multiple-definition; redefinitions + # are ignored, and the Silimate objects are first in the archive, so they + # are prioritized + if sys.platform == "darwin" and len(symbol_localize_args): subprocess.check_call([objcopy_bin, *symbol_localize_args, object]) final_archive_objects.append(object) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 8447dc57f..b4a9102e5 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -28,7 +28,6 @@ #include "backends/rtlil/rtlil_backend.h" #include -#include #include #include #include diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index 5f8acff34..9f8cd7db3 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -156,6 +156,14 @@ struct AbcConfig int abc_max_node_retention_origins = 5; // number of node retention origins (default 5) std::string signal_map_file; std::string cdc_file; + + bool is_yosys_abc() const { +#ifdef ABCEXTERNAL + return false; +#else + return exe_file == yosys_abc_executable; +#endif + } }; struct AbcSigVal { diff --git a/silimate-shell.nix b/silimate-shell.nix new file mode 100644 index 000000000..fc368e136 --- /dev/null +++ b/silimate-shell.nix @@ -0,0 +1,53 @@ +{ pkgs ? import {} }: + let libs = pkgs.libs; + binutils = pkgs.binutils; + gnu-ar = pkgs.stdenvNoCC.mkDerivation { + # match homebrew name + pname = "gnu-ar"; + inherit (binutils) version; + + buildInputs = [ binutils ]; + + phases = ["installPhase"]; + + installPhase = '' + mkdir -p $out/bin + ln -s ${binutils}/bin/ar $out/bin/gar + ''; + }; +in +pkgs.mkShell { + buildInputs = with pkgs; [ + bison + flex + cmake + eigen + swig + boost + libedit + pkg-config + m4 + cmake + ninja + tcl + libffi + nodejs + gawk + gperf + autoconf + libdwarf # provides libdwarf.so + libelf # provides libelf.a + doxygen + cudd + zlib + clang + iverilog # tests + gtkwave # vcd2fst + (python3.withPackages(ps: with ps; [pybind11 cxxheaderparser])) + gnu-ar + ] ++ lib.optionals stdenv.isLinux [ + elfutils # provides libdw.so (not to be confused with libdwarf.so) + ]; + + cmakeFlags = [ "-DCMAKE_C_COMPILER=clang" "-DCMAKE_CXX_COMPILER=clang++" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_CXX_FLAGS=-O0" "-DYOSYS_WITH_PYTHON:BOOL=ON" ]; +}