diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index b22a399db..e8b11ef2f 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -37,7 +37,7 @@ jobs: persist-credentials: false - run: sudo apt-get install libfl-dev - name: Build - run: make vcxsrc YOSYS_VER=latest + run: make vcxsrc YOSYS_COMPILER="Visual Studio" VCX_DIR_NAME=yosys-win32-vcxsrc-latest - uses: actions/upload-artifact@v4 with: name: vcxsrc diff --git a/Makefile b/Makefile index 62eef4519..d4b17b2cb 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,7 @@ ifeq ($(OS), Haiku) CXXFLAGS += -D_DEFAULT_SOURCE endif -YOSYS_VER := 0.60+8 +YOSYS_VER := 0.60+51 YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1) YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2) YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'.' -f3) @@ -193,8 +193,10 @@ CXXFLAGS += -DYOSYS_VER=\\"$(YOSYS_VER)\\" \ TARBALL_GIT_REV := $(shell cat $(YOSYS_SRC)/.gitcommit) ifneq ($(findstring Format:,$(TARBALL_GIT_REV)),) GIT_REV := $(shell cd .. && git rev-parse --short=9 HEAD || echo UNKNOWN) +GIT_DIRTY := $(shell cd .. && git diff --exit-code --quiet 2>/dev/null; if [ $$? -ne 0 ]; then echo "-dirty"; fi) else GIT_REV := $(TARBALL_GIT_REV) +GIT_DIRTY := "" endif OBJS = kernel/version_$(GIT_REV).o @@ -845,12 +847,13 @@ endif $(Q) mkdir -p $(dir $@) $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $< -YOSYS_VER_STR := Preqorsor $(YOSYS_VER) (git sha1 $(GIT_REV), $(notdir $(CXX)) $(shell \ - $(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1) $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS))) +YOSYS_GIT_STR := $(GIT_REV)$(GIT_DIRTY) +YOSYS_COMPILER := $(notdir $(CXX)) $(shell $(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1) $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)) +YOSYS_VER_STR := Preqorsor $(YOSYS_VER) (git sha1 $(YOSYS_GIT_STR), $(YOSYS_COMPILER)) kernel/version_$(GIT_REV).cc: $(YOSYS_SRC)/Makefile $(P) rm -f kernel/version_*.o kernel/version_*.d kernel/version_*.cc - $(Q) mkdir -p kernel && echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"$(YOSYS_VER_STR)\"; }" > kernel/version_$(GIT_REV).cc + $(Q) mkdir -p kernel && echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"$(YOSYS_VER_STR)\"; const char *yosys_git_hash_str=\"$(YOSYS_GIT_STR)\"; }" > kernel/version_$(GIT_REV).cc ifeq ($(ENABLE_VERIFIC),1) CXXFLAGS_NOVERIFIC = $(foreach v,$(CXXFLAGS),$(if $(findstring $(VERIFIC_DIR),$(v)),,$(v))) @@ -1104,7 +1107,9 @@ ifeq ($(ENABLE_PYOSYS),1) $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so $(INSTALL_SUDO) cp -r share $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys ifeq ($(ENABLE_ABC),1) - $(INSTALL_SUDO) cp yosys-abc $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/yosys-abc +ifeq ($(ABCEXTERNAL),) + $(INSTALL_SUDO) cp $(PROGRAM_PREFIX)yosys-abc$(EXE) $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/yosys-abc$(EXE) +endif endif endif endif @@ -1255,15 +1260,17 @@ qtcreator: { echo .; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \) -printf '%h\n' | sort -u; } > qtcreator.includes touch qtcreator.creator -vcxsrc: $(GENFILES) $(EXTRA_TARGETS) - rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip} +VCX_DIR_NAME := yosys-win32-vcxsrc-$(YOSYS_VER) +vcxsrc: $(GENFILES) $(EXTRA_TARGETS) kernel/version_$(GIT_REV).cc + rm -rf $(VCX_DIR_NAME){,.zip} + cp -f kernel/version_$(GIT_REV).cc kernel/version.cc set -e; for f in `ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \ echo "Analyse: $$f" >&2; cpp -std=c++17 -MM -I. -D_YOSYS_ $$f; done | sed 's,.*:,,; s,//*,/,g; s,/[^/]*/\.\./,/,g; y, \\,\n\n,;' | grep '^[^/]' | sort -u | grep -v kernel/version_ > srcfiles.txt echo "libs/fst/fst_win_unistd.h" >> srcfiles.txt - bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV) - echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc - zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc - zip -r yosys-win32-vcxsrc-$(YOSYS_VER).zip yosys-win32-vcxsrc-$(YOSYS_VER)/ + echo "kernel/version.cc" >> srcfiles.txt + bash misc/create_vcxsrc.sh $(VCX_DIR_NAME) $(YOSYS_VER) + zip $(VCX_DIR_NAME)/genfiles.zip $(GENFILES) kernel/version.cc + zip -r $(VCX_DIR_NAME).zip $(VCX_DIR_NAME)/ rm -f srcfiles.txt kernel/version.cc config-clean: clean diff --git a/abc b/abc index 177496d13..bd05a6454 160000 --- a/abc +++ b/abc @@ -1 +1 @@ -Subproject commit 177496d1399822a2910754fdc32f48ed8b1cd265 +Subproject commit bd05a6454e8c157caaa58ceda676ae0249d8e27c diff --git a/kernel/cellaigs.cc b/kernel/cellaigs.cc index fd3c7bb67..0f897cd58 100644 --- a/kernel/cellaigs.cc +++ b/kernel/cellaigs.cc @@ -185,50 +185,68 @@ struct AigMaker int or_gate(int A, int B) { - return nand_gate(not_gate(A), not_gate(B)); + int not_a = not_gate(A); + int not_b = not_gate(B); + return nand_gate(not_a, not_b); } int nor_gate(int A, int B) { - return and_gate(not_gate(A), not_gate(B)); + int not_a = not_gate(A); + int not_b = not_gate(B); + return and_gate(not_a, not_b); } int xor_gate(int A, int B) { - return nor_gate(and_gate(A, B), nor_gate(A, B)); + int a_and_b = and_gate(A, B); + int a_nor_b = nor_gate(A, B); + return nor_gate(a_and_b, a_nor_b); } int xnor_gate(int A, int B) { - return or_gate(and_gate(A, B), nor_gate(A, B)); + int a_and_b = and_gate(A, B); + int a_nor_b = nor_gate(A, B); + return or_gate(a_and_b, a_nor_b); } int andnot_gate(int A, int B) { - return and_gate(A, not_gate(B)); + int not_b = not_gate(B); + return and_gate(A, not_b); } int ornot_gate(int A, int B) { - return or_gate(A, not_gate(B)); + int not_b = not_gate(B); + return or_gate(A, not_b); } int mux_gate(int A, int B, int S) { - return or_gate(and_gate(A, not_gate(S)), and_gate(B, S)); + int not_s = not_gate(S); + int a_active = and_gate(A, not_s); + int b_active = and_gate(B, S); + return or_gate(a_active, b_active); } - vector adder(const vector &A, const vector &B, int carry, vector *X = nullptr, vector *CO = nullptr) + vector adder(const vector &A, const vector &B, int carry_in, vector *X = nullptr, vector *CO = nullptr) { vector Y(GetSize(A)); log_assert(GetSize(A) == GetSize(B)); for (int i = 0; i < GetSize(A); i++) { - Y[i] = xor_gate(xor_gate(A[i], B[i]), carry); - carry = or_gate(and_gate(A[i], B[i]), and_gate(or_gate(A[i], B[i]), carry)); + int a_xor_b = xor_gate(A[i], B[i]); + int a_or_b = or_gate(A[i], B[i]); + int a_and_b = and_gate(A[i], B[i]); + Y[i] = xor_gate(a_xor_b, carry_in); + int tmp = and_gate(a_or_b, carry_in); + int carry_out = or_gate(a_and_b, tmp); if (X != nullptr) - X->at(i) = xor_gate(A[i], B[i]); + X->at(i) = a_xor_b; if (CO != nullptr) - CO->at(i) = carry; + CO->at(i) = carry_out; + carry_in = carry_out; } return Y; } @@ -307,13 +325,13 @@ Aig::Aig(Cell *cell) int A = mk.inport(ID::A, i); int B = mk.inport(ID::B, i); int Y = cell->type.in(ID($and), ID($_AND_)) ? mk.and_gate(A, B) : - cell->type.in(ID($_NAND_)) ? mk.nand_gate(A, B) : + cell->type.in(ID($_NAND_)) ? mk.nand_gate(A, B) : cell->type.in(ID($or), ID($_OR_)) ? mk.or_gate(A, B) : - cell->type.in(ID($_NOR_)) ? mk.nor_gate(A, B) : + cell->type.in(ID($_NOR_)) ? mk.nor_gate(A, B) : cell->type.in(ID($xor), ID($_XOR_)) ? mk.xor_gate(A, B) : cell->type.in(ID($xnor), ID($_XNOR_)) ? mk.xnor_gate(A, B) : - cell->type.in(ID($_ANDNOT_)) ? mk.andnot_gate(A, B) : - cell->type.in(ID($_ORNOT_)) ? mk.ornot_gate(A, B) : -1; + cell->type.in(ID($_ANDNOT_)) ? mk.andnot_gate(A, B) : + cell->type.in(ID($_ORNOT_)) ? mk.ornot_gate(A, B) : -1; mk.outport(Y, ID::Y, i); } goto optimize; @@ -465,7 +483,8 @@ Aig::Aig(Cell *cell) int B = mk.inport(ID::B); int C = mk.inport(ID::C); int D = mk.inport(ID::D); - int Y = mk.nor_gate(mk.and_gate(A, B), mk.and_gate(C, D)); + int a_and_b = mk.and_gate(A, B); + int Y = mk.nor_gate(a_and_b, mk.and_gate(C, D)); mk.outport(Y, ID::Y); goto optimize; } @@ -476,7 +495,8 @@ Aig::Aig(Cell *cell) int B = mk.inport(ID::B); int C = mk.inport(ID::C); int D = mk.inport(ID::D); - int Y = mk.nand_gate(mk.or_gate(A, B), mk.or_gate(C, D)); + int a_or_b = mk.or_gate(A, B); + int Y = mk.nand_gate(a_or_b, mk.or_gate(C, D)); mk.outport(Y, ID::Y); goto optimize; } diff --git a/kernel/driver.cc b/kernel/driver.cc index 06fa6b11b..fa78bad59 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -255,6 +255,7 @@ int main(int argc, char **argv) ("h,help", "print this help message. If given, print help for .", cxxopts::value(), "[]") ("V,version", "print version information and exit") + ("git-hash", "print git commit hash and exit") ("infile", "input files", cxxopts::value>()) ; options.add_options("logging") @@ -332,6 +333,10 @@ int main(int argc, char **argv) std::cout << yosys_version_str << std::endl; exit(0); } + if (result.count("git-hash")) { + std::cout << yosys_git_hash_str << std::endl; + exit(0); + } if (result.count("S")) { passes_commands.push_back("synth"); run_shell = false; diff --git a/kernel/log.cc b/kernel/log.cc index 5cd1d7f4f..2a1261621 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -203,6 +203,8 @@ static void logv_string(std::string_view format, std::string str) { void log_formatted_string(std::string_view format, std::string str) { + log_assert(!Multithreading::active()); + if (log_make_debug && !ys_debug(1)) return; logv_string(format, std::move(str)); @@ -210,6 +212,8 @@ void log_formatted_string(std::string_view format, std::string str) void log_formatted_header(RTLIL::Design *design, std::string_view format, std::string str) { + log_assert(!Multithreading::active()); + bool pop_errfile = false; log_spacer(); @@ -249,6 +253,8 @@ void log_formatted_header(RTLIL::Design *design, std::string_view format, std::s void log_formatted_warning(std::string_view prefix, std::string message) { + log_assert(!Multithreading::active()); + bool suppressed = false; for (auto &re : log_nowarn_regexes) diff --git a/kernel/threading.cc b/kernel/threading.cc index 49fddaa7c..dcc044c89 100644 --- a/kernel/threading.cc +++ b/kernel/threading.cc @@ -3,6 +3,20 @@ YOSYS_NAMESPACE_BEGIN +static int init_max_threads() +{ + const char *v = getenv("YOSYS_MAX_THREADS"); + if (v == nullptr) + return INT32_MAX; + return atoi(v); +} + +static int get_max_threads() +{ + static int max_threads = init_max_threads(); + return max_threads; +} + void DeferredLogs::flush() { for (auto &m : logs) @@ -12,10 +26,11 @@ void DeferredLogs::flush() YOSYS_NAMESPACE_PREFIX log("%s", m.text.c_str()); } -int ThreadPool::pool_size(int reserved_cores, int max_threads) +int ThreadPool::pool_size(int reserved_cores, int max_worker_threads) { #ifdef YOSYS_ENABLE_THREADS - int num_threads = std::min(std::thread::hardware_concurrency() - reserved_cores, max_threads); + int available_threads = std::min(std::thread::hardware_concurrency(), get_max_threads()); + int num_threads = std::min(available_threads - reserved_cores, max_worker_threads); return std::max(0, num_threads); #else return 0; diff --git a/kernel/threading.h b/kernel/threading.h index c34abf850..b8cd62f87 100644 --- a/kernel/threading.h +++ b/kernel/threading.h @@ -127,9 +127,9 @@ class ThreadPool public: // Computes the number of worker threads to use. // `reserved_cores` cores are set aside for other threads (e.g. work on the main thread). - // `max_threads` --- don't return more workers than this. + // `max_worker_threads` --- don't return more workers than this. // The result may be 0. - static int pool_size(int reserved_cores, int max_threads); + static int pool_size(int reserved_cores, int max_worker_threads); // Create a pool of threads running the given closure (parameterized by thread number). // `pool_size` must be the result of a `pool_size()` call. diff --git a/kernel/yosys.h b/kernel/yosys.h index b455ad496..9f5a16a9c 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -81,6 +81,7 @@ extern std::set yosys_input_files, yosys_output_files; // from kernel/version_*.o (cc source generated from Makefile) extern const char *yosys_version_str; +extern const char *yosys_git_hash_str; const char* yosys_maybe_version(); // from passes/cmds/design.cc diff --git a/kernel/yosys_common.h b/kernel/yosys_common.h index 7e023af23..79e913cb9 100644 --- a/kernel/yosys_common.h +++ b/kernel/yosys_common.h @@ -299,8 +299,8 @@ RTLIL::IdString new_id_suffix(std::string_view file, int line, std::string_view #define NEW_ID \ YOSYS_NAMESPACE_PREFIX RTLIL::IdString::new_autoidx_with_prefix([](std::string_view func) -> const std::string * { \ - static const std::string *prefix = YOSYS_NAMESPACE_PREFIX create_id_prefix(__FILE__, __LINE__, func); \ - return prefix; \ + static std::unique_ptr prefix(YOSYS_NAMESPACE_PREFIX create_id_prefix(__FILE__, __LINE__, func)); \ + return prefix.get(); \ }(__FUNCTION__)) #define NEW_ID_SUFFIX(suffix) \ YOSYS_NAMESPACE_PREFIX new_id_suffix(__FILE__, __LINE__, __FUNCTION__, suffix) diff --git a/misc/create_vcxsrc.sh b/misc/create_vcxsrc.sh index 228003bad..42a690ce6 100644 --- a/misc/create_vcxsrc.sh +++ b/misc/create_vcxsrc.sh @@ -1,9 +1,8 @@ #!/bin/bash set -ex -vcxsrc="$1-$2" +vcxsrc="$1" yosysver="$2" -gitsha="$3" rm -rf YosysVS-Tpl-v2.zip YosysVS wget https://github.com/YosysHQ/yosys/releases/download/resources/YosysVS-Tpl-v2.zip @@ -33,7 +32,6 @@ popd head -n$n "$vcxsrc"/YosysVS/YosysVS.vcxproj egrep '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,,' egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,,' - echo '' tail -n +$((n+1)) "$vcxsrc"/YosysVS/YosysVS.vcxproj } > "$vcxsrc"/YosysVS/YosysVS.vcxproj.new @@ -48,9 +46,6 @@ mkdir -p "$vcxsrc"/yosys tar -cf - -T srcfiles.txt | tar -xf - -C "$vcxsrc"/yosys cp -r share "$vcxsrc"/ -echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys" \ - "$yosysver (git sha1 $gitsha, Visual Studio)\"; }" > "$vcxsrc"/yosys/kernel/version.cc - cat > "$vcxsrc"/readme-git.txt << EOT Want to use a git working copy for the yosys source code? Open "Git Bash" in this directory and run: diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index aa311374c..6d8446f82 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -255,8 +255,8 @@ std::optional spawn_abc(const char* abc_exe, DeferredLogs &logs) { char arg1[] = "-s"; char* argv[] = { strdup(abc_exe), arg1, nullptr }; - if (0 != posix_spawn(&result.pid, abc_exe, &file_actions, nullptr, argv, environ)) { - logs.log_error("posix_spawn %s failed", abc_exe); + if (0 != posix_spawnp(&result.pid, abc_exe, &file_actions, nullptr, argv, environ)) { + logs.log_error("posix_spawnp %s failed", abc_exe); return std::nullopt; } free(argv[0]); diff --git a/passes/tests/test_cell.cc b/passes/tests/test_cell.cc index 73af155bd..4d28e659b 100644 --- a/passes/tests/test_cell.cc +++ b/passes/tests/test_cell.cc @@ -1143,7 +1143,29 @@ struct TestCellPass : public Pass { else uut = create_gold_module(design, cell_type, cell_types.at(cell_type), constmode, muxdiv); if (!write_prefix.empty()) { - Pass::call(design, stringf("write_rtlil %s_%s_%05d.il", write_prefix, cell_type.c_str()+1, i)); + string writer = "write_rtlil"; + string suffix = "il"; + if (techmap_cmd.compare("aigmap") == 0) { + // try to convert to aiger + Pass::call(design, techmap_cmd); + bool is_unconverted = false; + for (auto *mod : design->selected_modules()) + for (auto *cell : mod->selected_cells()) + if (!cell->type.in(ID::$_NOT_, ID::$_AND_)) { + is_unconverted = true; + break; + } + if (is_unconverted) { + // skip unconverted cells + log_warning("Skipping %s\n", cell_type); + delete design; + break; + } else { + writer = "write_aiger -ascii"; + suffix = "aag"; + } + } + Pass::call(design, stringf("%s %s_%s_%05d.%s", writer, write_prefix, cell_type.c_str()+1, i, suffix)); } else if (edges) { Pass::call(design, "dump gold"); run_edges_test(design, verbose); diff --git a/techlibs/ice40/ice40_wrapcarry.cc b/techlibs/ice40/ice40_wrapcarry.cc index b0588f5e1..41ab2fa6f 100644 --- a/techlibs/ice40/ice40_wrapcarry.cc +++ b/techlibs/ice40/ice40_wrapcarry.cc @@ -138,7 +138,7 @@ struct Ice40WrapCarryPass : public Pass { lut->attributes[a.first.c_str() + strlen("\\SB_LUT4.")] = a.second; else if (a.first == ID::src) src = a.second; - else if (a.first.in(IdString{"\\SB_LUT4.name"}, ID::keep, ID::module_not_derived)) + else if (a.first.in(IdString{"\\SB_LUT4.name"}, ID::keep, ID::module_not_derived, ID::src)) continue; else continue; diff --git a/tests/aiger/.gitignore b/tests/aiger/.gitignore index 4bb3e67f6..ef347c9d3 100644 --- a/tests/aiger/.gitignore +++ b/tests/aiger/.gitignore @@ -1,2 +1,3 @@ /*_ref.v /neg.out/ +/gate/ diff --git a/tests/aiger/gold/__ANDNOT__00000.aag b/tests/aiger/gold/__ANDNOT__00000.aag new file mode 100644 index 000000000..93f5c0044 --- /dev/null +++ b/tests/aiger/gold/__ANDNOT__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +6 +6 5 2 +c +Generated by Yosys diff --git a/tests/aiger/gold/__AND__00000.aag b/tests/aiger/gold/__AND__00000.aag new file mode 100644 index 000000000..5b0148022 --- /dev/null +++ b/tests/aiger/gold/__AND__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +6 +6 4 2 +c +Generated by Yosys diff --git a/tests/aiger/gold/__AOI3__00000.aag b/tests/aiger/gold/__AOI3__00000.aag new file mode 100644 index 000000000..a726927fe --- /dev/null +++ b/tests/aiger/gold/__AOI3__00000.aag @@ -0,0 +1,9 @@ +aag 5 3 0 1 2 +2 +4 +6 +10 +8 4 2 +10 9 7 +c +Generated by Yosys diff --git a/tests/aiger/gold/__AOI4__00000.aag b/tests/aiger/gold/__AOI4__00000.aag new file mode 100644 index 000000000..4044dc5a8 --- /dev/null +++ b/tests/aiger/gold/__AOI4__00000.aag @@ -0,0 +1,11 @@ +aag 7 4 0 1 3 +2 +4 +6 +8 +14 +10 4 2 +12 8 6 +14 13 11 +c +Generated by Yosys diff --git a/tests/aiger/gold/__BUF__00000.aag b/tests/aiger/gold/__BUF__00000.aag new file mode 100644 index 000000000..7a4cd3156 --- /dev/null +++ b/tests/aiger/gold/__BUF__00000.aag @@ -0,0 +1,5 @@ +aag 1 1 0 1 0 +2 +2 +c +Generated by Yosys diff --git a/tests/aiger/gold/__MUX__00000.aag b/tests/aiger/gold/__MUX__00000.aag new file mode 100644 index 000000000..4d1757a65 --- /dev/null +++ b/tests/aiger/gold/__MUX__00000.aag @@ -0,0 +1,10 @@ +aag 6 3 0 1 3 +2 +4 +6 +13 +8 7 2 +10 6 4 +12 11 9 +c +Generated by Yosys diff --git a/tests/aiger/gold/__NAND__00000.aag b/tests/aiger/gold/__NAND__00000.aag new file mode 100644 index 000000000..bc42187b1 --- /dev/null +++ b/tests/aiger/gold/__NAND__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +7 +6 4 2 +c +Generated by Yosys diff --git a/tests/aiger/gold/__NMUX__00000.aag b/tests/aiger/gold/__NMUX__00000.aag new file mode 100644 index 000000000..b939855f9 --- /dev/null +++ b/tests/aiger/gold/__NMUX__00000.aag @@ -0,0 +1,10 @@ +aag 6 3 0 1 3 +2 +4 +6 +12 +8 7 2 +10 6 4 +12 11 9 +c +Generated by Yosys diff --git a/tests/aiger/gold/__NOR__00000.aag b/tests/aiger/gold/__NOR__00000.aag new file mode 100644 index 000000000..30b1d6c95 --- /dev/null +++ b/tests/aiger/gold/__NOR__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +6 +6 5 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/__NOT__00000.aag b/tests/aiger/gold/__NOT__00000.aag new file mode 100644 index 000000000..0c9119cea --- /dev/null +++ b/tests/aiger/gold/__NOT__00000.aag @@ -0,0 +1,5 @@ +aag 1 1 0 1 0 +2 +3 +c +Generated by Yosys diff --git a/tests/aiger/gold/__OAI3__00000.aag b/tests/aiger/gold/__OAI3__00000.aag new file mode 100644 index 000000000..9f8af1f72 --- /dev/null +++ b/tests/aiger/gold/__OAI3__00000.aag @@ -0,0 +1,9 @@ +aag 5 3 0 1 2 +2 +4 +6 +11 +8 5 3 +10 9 6 +c +Generated by Yosys diff --git a/tests/aiger/gold/__OAI4__00000.aag b/tests/aiger/gold/__OAI4__00000.aag new file mode 100644 index 000000000..871c05ba3 --- /dev/null +++ b/tests/aiger/gold/__OAI4__00000.aag @@ -0,0 +1,11 @@ +aag 7 4 0 1 3 +2 +4 +6 +8 +15 +10 5 3 +12 9 7 +14 13 11 +c +Generated by Yosys diff --git a/tests/aiger/gold/__ORNOT__00000.aag b/tests/aiger/gold/__ORNOT__00000.aag new file mode 100644 index 000000000..fc7263fce --- /dev/null +++ b/tests/aiger/gold/__ORNOT__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +7 +6 4 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/__OR__00000.aag b/tests/aiger/gold/__OR__00000.aag new file mode 100644 index 000000000..d5e8085c2 --- /dev/null +++ b/tests/aiger/gold/__OR__00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +7 +6 5 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/__XNOR__00000.aag b/tests/aiger/gold/__XNOR__00000.aag new file mode 100644 index 000000000..18bb92393 --- /dev/null +++ b/tests/aiger/gold/__XNOR__00000.aag @@ -0,0 +1,9 @@ +aag 5 2 0 1 3 +2 +4 +11 +6 4 2 +8 5 3 +10 9 7 +c +Generated by Yosys diff --git a/tests/aiger/gold/__XOR__00000.aag b/tests/aiger/gold/__XOR__00000.aag new file mode 100644 index 000000000..ab4bc32ad --- /dev/null +++ b/tests/aiger/gold/__XOR__00000.aag @@ -0,0 +1,9 @@ +aag 5 2 0 1 3 +2 +4 +10 +6 4 2 +8 5 3 +10 9 7 +c +Generated by Yosys diff --git a/tests/aiger/gold/_add_00000.aag b/tests/aiger/gold/_add_00000.aag new file mode 100644 index 000000000..9f22bc0f3 --- /dev/null +++ b/tests/aiger/gold/_add_00000.aag @@ -0,0 +1,62 @@ +aag 51 4 0 8 47 +2 +4 +6 +8 +14 +30 +42 +54 +66 +78 +90 +102 +10 6 2 +12 7 3 +14 13 11 +16 6 2 +18 8 4 +20 9 5 +22 21 19 +24 22 16 +26 21 19 +28 27 11 +30 29 25 +32 21 16 +34 33 19 +36 35 22 +38 33 19 +40 38 27 +42 41 37 +44 35 21 +46 45 19 +48 47 22 +50 45 19 +52 50 27 +54 53 49 +56 47 21 +58 57 19 +60 59 22 +62 57 19 +64 62 27 +66 65 61 +68 59 21 +70 69 19 +72 71 22 +74 69 19 +76 74 27 +78 77 73 +80 71 21 +82 81 19 +84 83 22 +86 81 19 +88 86 27 +90 89 85 +92 83 21 +94 93 19 +96 95 22 +98 93 19 +100 98 27 +102 101 97 +c +Generated by Yosys diff --git a/tests/aiger/gold/_alu_00000.aag b/tests/aiger/gold/_alu_00000.aag new file mode 100644 index 000000000..3fdb09ea5 --- /dev/null +++ b/tests/aiger/gold/_alu_00000.aag @@ -0,0 +1,45 @@ +aag 33 5 0 9 28 +2 +4 +6 +8 +10 +27 +35 +36 +38 +40 +8 +48 +58 +66 +12 8 6 +14 9 7 +16 15 13 +18 16 2 +20 15 13 +22 21 3 +24 23 10 +26 25 19 +28 8 4 +30 9 5 +32 31 27 +34 33 29 +36 35 8 +38 23 19 +40 31 29 +42 38 10 +44 23 19 +46 45 11 +48 47 43 +50 40 27 +52 31 29 +54 25 19 +56 54 53 +58 57 51 +60 35 8 +62 33 29 +64 62 9 +66 65 61 +c +Generated by Yosys diff --git a/tests/aiger/gold/_and_00000.aag b/tests/aiger/gold/_and_00000.aag new file mode 100644 index 000000000..6d3bab8d3 --- /dev/null +++ b/tests/aiger/gold/_and_00000.aag @@ -0,0 +1,28 @@ +aag 17 11 0 8 6 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +28 +30 +32 +34 +34 +34 +24 14 2 +26 16 4 +28 18 6 +30 20 8 +32 22 10 +34 22 12 +c +Generated by Yosys diff --git a/tests/aiger/gold/_buf_00000.aag b/tests/aiger/gold/_buf_00000.aag new file mode 100644 index 000000000..d373a6a80 --- /dev/null +++ b/tests/aiger/gold/_buf_00000.aag @@ -0,0 +1,15 @@ +aag 6 6 0 6 0 +2 +4 +6 +8 +10 +12 +2 +4 +6 +8 +10 +12 +c +Generated by Yosys diff --git a/tests/aiger/gold/_eq_00000.aag b/tests/aiger/gold/_eq_00000.aag new file mode 100644 index 000000000..e3cbcd2fc --- /dev/null +++ b/tests/aiger/gold/_eq_00000.aag @@ -0,0 +1,46 @@ +aag 38 11 0 5 27 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +76 +0 +0 +0 +0 +24 10 2 +26 11 3 +28 27 25 +30 12 4 +32 13 5 +34 33 31 +36 35 29 +38 14 6 +40 15 7 +42 41 39 +44 43 36 +46 16 8 +48 17 9 +50 49 47 +52 51 44 +54 18 8 +56 19 9 +58 57 55 +60 59 52 +62 20 8 +64 21 9 +66 65 63 +68 67 60 +70 22 8 +72 23 9 +74 73 71 +76 75 68 +c +Generated by Yosys diff --git a/tests/aiger/gold/_ge_00000.aag b/tests/aiger/gold/_ge_00000.aag new file mode 100644 index 000000000..8ccc44797 --- /dev/null +++ b/tests/aiger/gold/_ge_00000.aag @@ -0,0 +1,9 @@ +aag 3 2 0 3 1 +2 +4 +7 +0 +0 +6 4 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/_gt_00000.aag b/tests/aiger/gold/_gt_00000.aag new file mode 100644 index 000000000..cc0905ea1 --- /dev/null +++ b/tests/aiger/gold/_gt_00000.aag @@ -0,0 +1,48 @@ +aag 43 10 0 2 33 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +86 +0 +22 20 7 +24 21 6 +26 25 23 +28 18 7 +30 16 7 +32 14 7 +34 12 7 +36 10 5 +38 9 2 +40 8 3 +42 41 38 +44 11 4 +46 45 43 +48 47 37 +50 13 6 +52 51 49 +54 53 35 +56 15 6 +58 57 55 +60 59 33 +62 17 6 +64 63 61 +66 65 31 +68 19 6 +70 69 67 +72 71 29 +74 73 25 +76 75 23 +78 77 26 +80 25 23 +82 75 23 +84 82 81 +86 85 79 +c +Generated by Yosys diff --git a/tests/aiger/gold/_le_00000.aag b/tests/aiger/gold/_le_00000.aag new file mode 100644 index 000000000..75a138267 --- /dev/null +++ b/tests/aiger/gold/_le_00000.aag @@ -0,0 +1,52 @@ +aag 47 12 0 2 35 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +94 +0 +26 25 8 +28 24 9 +30 29 27 +32 23 8 +34 21 8 +36 19 8 +38 17 8 +40 15 6 +42 13 4 +44 11 2 +46 12 5 +48 47 44 +50 49 43 +52 14 7 +54 53 51 +56 55 41 +58 16 9 +60 59 57 +62 61 39 +64 18 9 +66 65 63 +68 67 37 +70 20 9 +72 71 69 +74 73 35 +76 22 9 +78 77 75 +80 79 33 +82 81 29 +84 83 27 +86 85 30 +88 29 27 +90 83 27 +92 90 89 +94 93 87 +c +Generated by Yosys diff --git a/tests/aiger/gold/_logic_and_00000.aag b/tests/aiger/gold/_logic_and_00000.aag new file mode 100644 index 000000000..d68c6fc34 --- /dev/null +++ b/tests/aiger/gold/_logic_and_00000.aag @@ -0,0 +1,30 @@ +aag 21 11 0 6 10 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +42 +0 +0 +0 +0 +0 +24 5 3 +26 24 7 +28 26 9 +30 28 11 +32 30 13 +34 17 15 +36 34 19 +38 36 21 +40 38 23 +42 41 33 +c +Generated by Yosys diff --git a/tests/aiger/gold/_logic_not_00000.aag b/tests/aiger/gold/_logic_not_00000.aag new file mode 100644 index 000000000..7798b23e9 --- /dev/null +++ b/tests/aiger/gold/_logic_not_00000.aag @@ -0,0 +1,15 @@ +aag 7 4 0 5 3 +2 +4 +6 +8 +14 +0 +0 +0 +0 +10 5 3 +12 10 7 +14 12 9 +c +Generated by Yosys diff --git a/tests/aiger/gold/_logic_or_00000.aag b/tests/aiger/gold/_logic_or_00000.aag new file mode 100644 index 000000000..12b3364d4 --- /dev/null +++ b/tests/aiger/gold/_logic_or_00000.aag @@ -0,0 +1,29 @@ +aag 21 11 0 5 10 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +43 +0 +0 +0 +0 +24 5 3 +26 24 7 +28 26 9 +30 28 11 +32 30 13 +34 17 15 +36 34 19 +38 36 21 +40 38 23 +42 40 32 +c +Generated by Yosys diff --git a/tests/aiger/gold/_lt_00000.aag b/tests/aiger/gold/_lt_00000.aag new file mode 100644 index 000000000..2169b4a53 --- /dev/null +++ b/tests/aiger/gold/_lt_00000.aag @@ -0,0 +1,43 @@ +aag 34 9 0 6 25 +2 +4 +6 +8 +10 +12 +14 +16 +18 +68 +0 +0 +0 +0 +0 +20 19 10 +22 18 11 +24 23 21 +26 19 8 +28 17 6 +30 15 4 +32 12 3 +34 13 2 +36 35 32 +38 14 5 +40 39 37 +42 41 31 +44 16 7 +46 45 43 +48 47 29 +50 18 9 +52 51 49 +54 53 27 +56 55 23 +58 57 21 +60 59 24 +62 23 21 +64 57 21 +66 64 63 +68 67 61 +c +Generated by Yosys diff --git a/tests/aiger/gold/_mux_00000.aag b/tests/aiger/gold/_mux_00000.aag new file mode 100644 index 000000000..4d1757a65 --- /dev/null +++ b/tests/aiger/gold/_mux_00000.aag @@ -0,0 +1,10 @@ +aag 6 3 0 1 3 +2 +4 +6 +13 +8 7 2 +10 6 4 +12 11 9 +c +Generated by Yosys diff --git a/tests/aiger/gold/_ne_00000.aag b/tests/aiger/gold/_ne_00000.aag new file mode 100644 index 000000000..e4d894bde --- /dev/null +++ b/tests/aiger/gold/_ne_00000.aag @@ -0,0 +1,40 @@ +aag 29 10 0 8 19 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +59 +0 +0 +0 +0 +0 +0 +0 +22 12 2 +24 13 3 +26 25 23 +28 14 4 +30 15 5 +32 31 29 +34 33 27 +36 16 6 +38 17 7 +40 39 37 +42 41 34 +44 18 8 +46 19 9 +48 47 45 +50 49 42 +52 20 10 +54 21 11 +56 55 53 +58 57 50 +c +Generated by Yosys diff --git a/tests/aiger/gold/_not_00000.aag b/tests/aiger/gold/_not_00000.aag new file mode 100644 index 000000000..3c5ede656 --- /dev/null +++ b/tests/aiger/gold/_not_00000.aag @@ -0,0 +1,11 @@ +aag 6 6 0 2 0 +2 +4 +6 +8 +10 +12 +3 +5 +c +Generated by Yosys diff --git a/tests/aiger/gold/_or_00000.aag b/tests/aiger/gold/_or_00000.aag new file mode 100644 index 000000000..58714e461 --- /dev/null +++ b/tests/aiger/gold/_or_00000.aag @@ -0,0 +1,11 @@ +aag 6 4 0 2 2 +2 +4 +6 +8 +11 +13 +10 5 3 +12 7 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/_pos_00000.aag b/tests/aiger/gold/_pos_00000.aag new file mode 100644 index 000000000..29a2dd61a --- /dev/null +++ b/tests/aiger/gold/_pos_00000.aag @@ -0,0 +1,9 @@ +aag 1 1 0 5 0 +2 +2 +2 +2 +2 +2 +c +Generated by Yosys diff --git a/tests/aiger/gold/_reduce_and_00000.aag b/tests/aiger/gold/_reduce_and_00000.aag new file mode 100644 index 000000000..06db9a1dd --- /dev/null +++ b/tests/aiger/gold/_reduce_and_00000.aag @@ -0,0 +1,7 @@ +aag 1 1 0 3 0 +2 +2 +0 +0 +c +Generated by Yosys diff --git a/tests/aiger/gold/_reduce_bool_00000.aag b/tests/aiger/gold/_reduce_bool_00000.aag new file mode 100644 index 000000000..48a1410c8 --- /dev/null +++ b/tests/aiger/gold/_reduce_bool_00000.aag @@ -0,0 +1,13 @@ +aag 7 4 0 3 3 +2 +4 +6 +8 +15 +0 +0 +10 5 3 +12 10 7 +14 12 9 +c +Generated by Yosys diff --git a/tests/aiger/gold/_reduce_or_00000.aag b/tests/aiger/gold/_reduce_or_00000.aag new file mode 100644 index 000000000..d5e8085c2 --- /dev/null +++ b/tests/aiger/gold/_reduce_or_00000.aag @@ -0,0 +1,7 @@ +aag 3 2 0 1 1 +2 +4 +7 +6 5 3 +c +Generated by Yosys diff --git a/tests/aiger/gold/_reduce_xnor_00000.aag b/tests/aiger/gold/_reduce_xnor_00000.aag new file mode 100644 index 000000000..6ad6ac39e --- /dev/null +++ b/tests/aiger/gold/_reduce_xnor_00000.aag @@ -0,0 +1,30 @@ +aag 25 6 0 2 19 +2 +4 +6 +8 +10 +12 +51 +0 +14 4 2 +16 5 3 +18 17 15 +20 18 6 +22 17 15 +24 23 7 +26 25 21 +28 26 8 +30 25 21 +32 31 9 +34 33 29 +36 34 10 +38 33 29 +40 39 11 +42 41 37 +44 42 12 +46 41 37 +48 47 13 +50 49 45 +c +Generated by Yosys diff --git a/tests/aiger/gold/_reduce_xor_00000.aag b/tests/aiger/gold/_reduce_xor_00000.aag new file mode 100644 index 000000000..ab4bc32ad --- /dev/null +++ b/tests/aiger/gold/_reduce_xor_00000.aag @@ -0,0 +1,9 @@ +aag 5 2 0 1 3 +2 +4 +10 +6 4 2 +8 5 3 +10 9 7 +c +Generated by Yosys diff --git a/tests/aiger/gold/_sub_00000.aag b/tests/aiger/gold/_sub_00000.aag new file mode 100644 index 000000000..e9d976b32 --- /dev/null +++ b/tests/aiger/gold/_sub_00000.aag @@ -0,0 +1,20 @@ +aag 16 13 0 1 3 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +33 +28 17 2 +30 16 3 +32 31 29 +c +Generated by Yosys diff --git a/tests/aiger/gold/_xnor_00000.aag b/tests/aiger/gold/_xnor_00000.aag new file mode 100644 index 000000000..9dd097862 --- /dev/null +++ b/tests/aiger/gold/_xnor_00000.aag @@ -0,0 +1,17 @@ +aag 10 4 0 4 6 +2 +4 +6 +8 +15 +21 +21 +21 +10 6 2 +12 7 3 +14 13 11 +16 8 4 +18 9 5 +20 19 17 +c +Generated by Yosys diff --git a/tests/aiger/gold/_xor_00000.aag b/tests/aiger/gold/_xor_00000.aag new file mode 100644 index 000000000..453b8d0ee --- /dev/null +++ b/tests/aiger/gold/_xor_00000.aag @@ -0,0 +1,12 @@ +aag 8 5 0 1 3 +2 +4 +6 +8 +10 +16 +12 8 2 +14 9 3 +16 15 13 +c +Generated by Yosys diff --git a/tests/aiger/run-test.sh b/tests/aiger/run-test.sh index ca7339ff0..94d83ede4 100755 --- a/tests/aiger/run-test.sh +++ b/tests/aiger/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e @@ -57,3 +58,13 @@ for y in *.ys; do echo "Running $y." ../../yosys -ql ${y%.*}.log $y done + +# compare aigmap with reference +# make gold with: rm gold/*; yosys --no-version -p "test_cell -aigmap -w gold/ -n 1 -s 1 all" +rm -rf gate; mkdir gate +../../yosys --no-version -p "test_cell -aigmap -w gate/ -n 1 -s 1 all" +( + set -o pipefail + diff --brief gold gate | tee aigmap.err +) +rm aigmap.err diff --git a/tests/alumacc/run-test.sh b/tests/alumacc/run-test.sh index e9698386e..2e3f5235c 100644 --- a/tests/alumacc/run-test.sh +++ b/tests/alumacc/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/arch/run-test.sh b/tests/arch/run-test.sh index 68f925b34..7602717d2 100755 --- a/tests/arch/run-test.sh +++ b/tests/arch/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e diff --git a/tests/asicworld/run-test.sh b/tests/asicworld/run-test.sh index 5131ed646..c9b4118a7 100755 --- a/tests/asicworld/run-test.sh +++ b/tests/asicworld/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh OPTIND=1 seed="" # default to no seed specified diff --git a/tests/blif/run-test.sh b/tests/blif/run-test.sh index e9698386e..2e3f5235c 100755 --- a/tests/blif/run-test.sh +++ b/tests/blif/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/bram/run-test.sh b/tests/bram/run-test.sh index 37fc91d0e..47f24f5dd 100755 --- a/tests/bram/run-test.sh +++ b/tests/bram/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh # run this test many times: # MAKE="make -j8" time bash -c 'for ((i=0; i<100; i++)); do echo "-- $i --"; bash run-test.sh || exit 1; done' diff --git a/tests/common-env.sh b/tests/common-env.sh new file mode 100644 index 000000000..f3a411280 --- /dev/null +++ b/tests/common-env.sh @@ -0,0 +1 @@ +export YOSYS_MAX_THREADS=4 diff --git a/tests/cxxrtl/run-test.sh b/tests/cxxrtl/run-test.sh index 4b542e180..aa7a0c26c 100755 --- a/tests/cxxrtl/run-test.sh +++ b/tests/cxxrtl/run-test.sh @@ -1,4 +1,5 @@ #!/bin/bash +source ../common-env.sh set -ex diff --git a/tests/fmt/run-test.sh b/tests/fmt/run-test.sh index 88ee6e238..a3402f953 100644 --- a/tests/fmt/run-test.sh +++ b/tests/fmt/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -ex diff --git a/tests/fsm/run-test.sh b/tests/fsm/run-test.sh index dc60c69c4..139ea8261 100755 --- a/tests/fsm/run-test.sh +++ b/tests/fsm/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh # run this test many times: # time bash -c 'for ((i=0; i<100; i++)); do echo "-- $i --"; bash run-test.sh || exit 1; done' diff --git a/tests/functional/run-test.sh b/tests/functional/run-test.sh index e0bedf8d4..7c38f3190 100755 --- a/tests/functional/run-test.sh +++ b/tests/functional/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) diff --git a/tests/gen-tests-makefile.sh b/tests/gen-tests-makefile.sh index e3308506b..a0fb23ac3 100755 --- a/tests/gen-tests-makefile.sh +++ b/tests/gen-tests-makefile.sh @@ -9,7 +9,7 @@ generate_target() { echo "all: $target_name" echo ".PHONY: $target_name" echo "$target_name:" - printf "\t@%s\n" "$test_command" + printf "\t@YOSYS_MAX_THREADS=4 %s\n" "$test_command" printf "\t@echo 'Passed %s'\n" "$target_name" } diff --git a/tests/hana/run-test.sh b/tests/hana/run-test.sh index 99be37f5e..8533e5544 100755 --- a/tests/hana/run-test.sh +++ b/tests/hana/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh OPTIND=1 seed="" # default to no seed specified diff --git a/tests/liberty/run-test.sh b/tests/liberty/run-test.sh index 5afdb727e..d5fb65e16 100755 --- a/tests/liberty/run-test.sh +++ b/tests/liberty/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -eo pipefail for x in *.lib; do diff --git a/tests/memfile/run-test.sh b/tests/memfile/run-test.sh index db0ec54ee..44c1e4821 100755 --- a/tests/memfile/run-test.sh +++ b/tests/memfile/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e diff --git a/tests/memlib/run-test.sh b/tests/memlib/run-test.sh index 5f230a03e..9e95fb255 100755 --- a/tests/memlib/run-test.sh +++ b/tests/memlib/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -eu OPTIND=1 diff --git a/tests/memories/run-test.sh b/tests/memories/run-test.sh index 4f1da7ce7..8f83e11a1 100755 --- a/tests/memories/run-test.sh +++ b/tests/memories/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e diff --git a/tests/opt_share/run-test.sh b/tests/opt_share/run-test.sh index e80cd4214..e3a6e8b7b 100755 --- a/tests/opt_share/run-test.sh +++ b/tests/opt_share/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh # run this test many times: # time bash -c 'for ((i=0; i<100; i++)); do echo "-- $i --"; bash run-test.sh || exit 1; done' diff --git a/tests/peepopt/run-test.sh b/tests/peepopt/run-test.sh index e9698386e..2e3f5235c 100644 --- a/tests/peepopt/run-test.sh +++ b/tests/peepopt/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/proc/run-test.sh b/tests/proc/run-test.sh index e9698386e..2e3f5235c 100755 --- a/tests/proc/run-test.sh +++ b/tests/proc/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/rpc/run-test.sh b/tests/rpc/run-test.sh index 624043750..0d58b0de2 100755 --- a/tests/rpc/run-test.sh +++ b/tests/rpc/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/select/run-test.sh b/tests/select/run-test.sh index e9698386e..2e3f5235c 100755 --- a/tests/select/run-test.sh +++ b/tests/select/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e for x in *.ys; do echo "Running $x.." diff --git a/tests/share/run-test.sh b/tests/share/run-test.sh index a7b5fc4a0..0cef580a7 100755 --- a/tests/share/run-test.sh +++ b/tests/share/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh # run this test many times: # time bash -c 'for ((i=0; i<100; i++)); do echo "-- $i --"; bash run-test.sh || exit 1; done' diff --git a/tests/simple/run-test.sh b/tests/simple/run-test.sh index b9e79f34a..c3711fe3e 100755 --- a/tests/simple/run-test.sh +++ b/tests/simple/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh OPTIND=1 seed="" # default to no seed specified diff --git a/tests/simple_abc9/run-test.sh b/tests/simple_abc9/run-test.sh index 5669321ac..0b3e5061f 100755 --- a/tests/simple_abc9/run-test.sh +++ b/tests/simple_abc9/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh OPTIND=1 seed="" # default to no seed specified diff --git a/tests/svinterfaces/run-test.sh b/tests/svinterfaces/run-test.sh index 71bdcd67a..28ce627d9 100755 --- a/tests/svinterfaces/run-test.sh +++ b/tests/svinterfaces/run-test.sh @@ -1,4 +1,5 @@ #/bin/bash -e +source ../common-env.sh ./runone.sh svinterface1 ./runone.sh svinterface_at_top diff --git a/tests/tools/autotest.sh b/tests/tools/autotest.sh index 47b06d575..c9a12b66b 100755 --- a/tests/tools/autotest.sh +++ b/tests/tools/autotest.sh @@ -162,20 +162,24 @@ do cp ../${bn}_tb.v ${bn}_tb.v fi if $genvcd; then sed -i 's,// \$dump,$dump,g' ${bn}_tb.v; fi + touch ${bn}.iverilog compile_and_run ${bn}_tb_ref ${bn}_out_ref ${bn}_tb.v ${bn}_ref.${refext} "${libs[@]}" \ "$toolsdir"/../../techlibs/common/simlib.v \ "$toolsdir"/../../techlibs/common/simcells.v + rm ${bn}.iverilog if $genvcd; then mv testbench.vcd ${bn}_ref.vcd; fi test_count=0 test_passes() { "$toolsdir"/../../yosys -b "verilog $backend_opts" -o ${bn}_syn${test_count}.v "$@" + touch ${bn}.iverilog compile_and_run ${bn}_tb_syn${test_count} ${bn}_out_syn${test_count} \ ${bn}_tb.v ${bn}_syn${test_count}.v "${libs[@]}" \ "$toolsdir"/../../techlibs/common/simlib.v \ "$toolsdir"/../../techlibs/common/simcells.v if $genvcd; then mv testbench.vcd ${bn}_syn${test_count}.vcd; fi "$toolsdir/cmp_tbdata" ${bn}_out_ref ${bn}_out_syn${test_count} + rm ${bn}.iverilog test_count=$(( test_count + 1 )) } @@ -227,7 +231,9 @@ do else echo "${status_prefix}${did_firrtl}-> ERROR!" if $warn_iverilog_git; then - echo "Note: Make sure that 'iverilog' is an up-to-date git checkout of Icarus Verilog." + if [ -f ${bn}.out/${bn}.iverilog ]; then + echo "Note: Make sure that 'iverilog' is an up-to-date git checkout of Icarus Verilog." + fi fi $keeprunning || exit 1 fi diff --git a/tests/verific/run-test.sh b/tests/verific/run-test.sh index 1d39e2093..1666ee1f9 100755 --- a/tests/verific/run-test.sh +++ b/tests/verific/run-test.sh @@ -2,4 +2,4 @@ set -eu source ../gen-tests-makefile.sh generate_mk --yosys-scripts --bash -echo "$(echo 'export ASAN_OPTIONS=halt_on_error=0'; cat run-test.mk)" > run-test.mk \ No newline at end of file +{ echo 'export ASAN_OPTIONS=halt_on_error=0'; cat run-test.mk; } > run-test.mk.tmp && mv run-test.mk.tmp run-test.mk diff --git a/tests/xprop/run-test.sh b/tests/xprop/run-test.sh index 84b7c4ac4..303c0bb3b 100755 --- a/tests/xprop/run-test.sh +++ b/tests/xprop/run-test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +source ../common-env.sh set -e python3 generate.py $@