Bump Yosys to latest

This commit is contained in:
Akash Levy 2025-12-17 21:06:17 -08:00
commit abd485fa49
85 changed files with 912 additions and 50 deletions

View File

@ -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

View File

@ -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

2
abc

@ -1 +1 @@
Subproject commit 177496d1399822a2910754fdc32f48ed8b1cd265
Subproject commit bd05a6454e8c157caaa58ceda676ae0249d8e27c

View File

@ -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<int> adder(const vector<int> &A, const vector<int> &B, int carry, vector<int> *X = nullptr, vector<int> *CO = nullptr)
vector<int> adder(const vector<int> &A, const vector<int> &B, int carry_in, vector<int> *X = nullptr, vector<int> *CO = nullptr)
{
vector<int> 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;
}

View File

@ -255,6 +255,7 @@ int main(int argc, char **argv)
("h,help", "print this help message. If given, print help for <command>.",
cxxopts::value<std::string>(), "[<command>]")
("V,version", "print version information and exit")
("git-hash", "print git commit hash and exit")
("infile", "input files", cxxopts::value<std::vector<std::string>>())
;
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;

View File

@ -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)

View File

@ -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<int>(std::thread::hardware_concurrency() - reserved_cores, max_threads);
int available_threads = std::min<int>(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;

View File

@ -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.

View File

@ -81,6 +81,7 @@ extern std::set<std::string> 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

View File

@ -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<const std::string> 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)

View File

@ -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,.*,<ClInclude Include="../yosys/&" />,'
egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClCompile Include="../yosys/&" />,'
echo '<ClCompile Include="../yosys/kernel/version.cc" />'
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:

View File

@ -255,8 +255,8 @@ std::optional<AbcProcess> 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]);

View File

@ -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);

View File

@ -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;

View File

@ -1,2 +1,3 @@
/*_ref.v
/neg.out/
/gate/

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
6
6 5 2
c
Generated by Yosys

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
6
6 4 2
c
Generated by Yosys

View File

@ -0,0 +1,9 @@
aag 5 3 0 1 2
2
4
6
10
8 4 2
10 9 7
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,5 @@
aag 1 1 0 1 0
2
2
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
7
6 4 2
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
6
6 5 3
c
Generated by Yosys

View File

@ -0,0 +1,5 @@
aag 1 1 0 1 0
2
3
c
Generated by Yosys

View File

@ -0,0 +1,9 @@
aag 5 3 0 1 2
2
4
6
11
8 5 3
10 9 6
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
7
6 4 3
c
Generated by Yosys

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
7
6 5 3
c
Generated by Yosys

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,9 @@
aag 3 2 0 3 1
2
4
7
0
0
6 4 3
c
Generated by Yosys

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,11 @@
aag 6 6 0 2 0
2
4
6
8
10
12
3
5
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,9 @@
aag 1 1 0 5 0
2
2
2
2
2
2
c
Generated by Yosys

View File

@ -0,0 +1,7 @@
aag 1 1 0 3 0
2
2
0
0
c
Generated by Yosys

View File

@ -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

View File

@ -0,0 +1,7 @@
aag 3 2 0 1 1
2
4
7
6 5 3
c
Generated by Yosys

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
OPTIND=1
seed="" # default to no seed specified

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -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'

1
tests/common-env.sh Normal file
View File

@ -0,0 +1 @@
export YOSYS_MAX_THREADS=4

View File

@ -1,4 +1,5 @@
#!/bin/bash
source ../common-env.sh
set -ex

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -ex

View File

@ -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'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

View File

@ -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"
}

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
OPTIND=1
seed="" # default to no seed specified

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -eo pipefail
for x in *.lib; do

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -eu
OPTIND=1

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e

View File

@ -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'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
for x in *.ys; do
echo "Running $x.."

View File

@ -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'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
OPTIND=1
seed="" # default to no seed specified

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
OPTIND=1
seed="" # default to no seed specified

View File

@ -1,4 +1,5 @@
#/bin/bash -e
source ../common-env.sh
./runone.sh svinterface1
./runone.sh svinterface_at_top

View File

@ -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

View File

@ -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
{ echo 'export ASAN_OPTIONS=halt_on_error=0'; cat run-test.mk; } > run-test.mk.tmp && mv run-test.mk.tmp run-test.mk

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
source ../common-env.sh
set -e
python3 generate.py $@