Skip to content

Commit e793a19

Browse files
authored
Merge branch 'YosysHQ:main' into master
2 parents bdb811b + c16cc53 commit e793a19

File tree

101 files changed

+7440
-5973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+7440
-5973
lines changed

CHANGELOG

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,25 @@
22
List of major changes and improvements between releases
33
=======================================================
44

5-
Yosys 0.53 .. Yosys 0.54-dev
5+
Yosys 0.54 .. Yosys 0.55-dev
66
--------------------------
77

8+
Yosys 0.53 .. Yosys 0.54
9+
--------------------------
10+
* New commands and options
11+
- Added "-genlib" option to "abc_new" and "abc9_exe" passes.
12+
- Added "-verbose" and "-quiet" options to "libcache" pass.
13+
- Added "-no-sort" option to "write_aiger" pass.
14+
15+
* Various
16+
- Added "muldiv_c" peepopt.
17+
- Accept (and ignore) SystemVerilog unique/priority if.
18+
- "read_verilog" copy inout ports in and out of functions/tasks.
19+
- Enable single-bit vector wires in RTLIL.
20+
21+
* Xilinx support
22+
- Single-port URAM mapping to support memories 2048 x 144b
23+
824
Yosys 0.52 .. Yosys 0.53
925
--------------------------
1026
* New commands and options

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ passes/opt/opt_lut.cc @whitequark
2020
passes/techmap/abc9*.cc @eddiehung @Ravenslofty
2121
backends/aiger/xaiger.cc @eddiehung
2222
docs/ @KrystalDelusion
23+
docs/source/using_yosys/synthesis/abc.rst @KrystalDelusion @Ravenslofty
2324
.github/workflows/*.yml @mmicko
2425

2526
## External Contributors

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ ifeq ($(OS), Haiku)
160160
CXXFLAGS += -D_DEFAULT_SOURCE
161161
endif
162162

163-
YOSYS_VER := 0.53+3
163+
YOSYS_VER := 0.54+0
164164
YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1)
165165
YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2 | cut -d'+' -f1)
166166
YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'+' -f2)
@@ -183,7 +183,7 @@ endif
183183
OBJS = kernel/version_$(GIT_REV).o
184184

185185
bumpversion:
186-
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 53c22ab.. | wc -l`/;" Makefile
186+
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline db72ec3.. | wc -l`/;" Makefile
187187

188188
ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q)
189189

@@ -204,7 +204,7 @@ endif
204204
include Makefile.conf
205205
endif
206206

207-
PYTHON_EXECUTABLE := $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi)
207+
PYTHON_EXECUTABLE ?= $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi)
208208
ifeq ($(ENABLE_PYOSYS),1)
209209
PYTHON_VERSION_TESTCODE := "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)"
210210
PYTHON_VERSION := $(shell $(PYTHON_EXECUTABLE) -c ""$(PYTHON_VERSION_TESTCODE)"")
@@ -455,6 +455,7 @@ endif
455455

456456
ifeq ($(ENABLE_DEBUG),1)
457457
CXXFLAGS := -Og -DDEBUG $(filter-out $(OPT_LEVEL),$(CXXFLAGS))
458+
STRIP :=
458459
endif
459460

460461
ifeq ($(ENABLE_ABC),1)
@@ -894,6 +895,7 @@ SH_TEST_DIRS += tests/bram
894895
SH_TEST_DIRS += tests/svinterfaces
895896
SH_TEST_DIRS += tests/xprop
896897
SH_TEST_DIRS += tests/select
898+
SH_TEST_DIRS += tests/peepopt
897899
SH_TEST_DIRS += tests/proc
898900
SH_TEST_DIRS += tests/blif
899901
SH_TEST_DIRS += tests/arch
@@ -982,20 +984,20 @@ install: $(TARGETS) $(EXTRA_TARGETS)
982984
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
983985
$(INSTALL_SUDO) cp $(filter-out libyosys.so,$(TARGETS)) $(DESTDIR)$(BINDIR)
984986
ifneq ($(filter $(PROGRAM_PREFIX)yosys,$(TARGETS)),)
985-
$(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys
987+
if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys; fi
986988
endif
987989
ifneq ($(filter $(PROGRAM_PREFIX)yosys-abc,$(TARGETS)),)
988-
$(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys-abc
990+
if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys-abc; fi
989991
endif
990992
ifneq ($(filter $(PROGRAM_PREFIX)yosys-filterlib,$(TARGETS)),)
991-
$(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys-filterlib
993+
if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/$(PROGRAM_PREFIX)yosys-filterlib; fi
992994
endif
993995
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR)
994996
$(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/.
995997
ifeq ($(ENABLE_LIBYOSYS),1)
996998
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(LIBDIR)
997999
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)/
998-
$(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so
1000+
if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so; fi
9991001
ifeq ($(ENABLE_PYOSYS),1)
10001002
$(INSTALL_SUDO) mkdir -p $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys
10011003
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so

backends/aiger/aiger.cc

Lines changed: 50 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct AigerWriter
132132
return a;
133133
}
134134

135-
AigerWriter(Module *module, bool zinit_mode, bool imode, bool omode, bool bmode, bool lmode) : module(module), zinit_mode(zinit_mode), sigmap(module)
135+
AigerWriter(Module *module, bool no_sort, bool zinit_mode, bool imode, bool omode, bool bmode, bool lmode) : module(module), zinit_mode(zinit_mode), sigmap(module)
136136
{
137137
pool<SigBit> undriven_bits;
138138
pool<SigBit> unused_bits;
@@ -152,16 +152,12 @@ struct AigerWriter
152152
if (wire->port_input)
153153
sigmap.add(wire);
154154

155-
for (auto wire : module->wires())
156-
{
157-
if (wire->attributes.count(ID::init)) {
158-
SigSpec initsig = sigmap(wire);
159-
Const initval = wire->attributes.at(ID::init);
160-
for (int i = 0; i < GetSize(wire) && i < GetSize(initval); i++)
161-
if (initval[i] == State::S0 || initval[i] == State::S1)
162-
init_map[initsig[i]] = initval[i] == State::S1;
163-
}
164-
155+
// handle ports
156+
// provided the input_bits and output_bits don't get sorted they
157+
// will be returned in reverse order, so add them in reverse to
158+
// match
159+
for (auto riter = module->ports.rbegin(); riter != module->ports.rend(); ++riter) {
160+
auto *wire = module->wire(*riter);
165161
for (int i = 0; i < GetSize(wire); i++)
166162
{
167163
SigBit wirebit(wire, i);
@@ -175,9 +171,6 @@ struct AigerWriter
175171
continue;
176172
}
177173

178-
undriven_bits.insert(bit);
179-
unused_bits.insert(bit);
180-
181174
if (wire->port_input)
182175
input_bits.insert(bit);
183176

@@ -187,6 +180,32 @@ struct AigerWriter
187180
output_bits.insert(wirebit);
188181
}
189182
}
183+
}
184+
185+
// handle wires
186+
for (auto wire : module->wires())
187+
{
188+
if (wire->attributes.count(ID::init)) {
189+
SigSpec initsig = sigmap(wire);
190+
Const initval = wire->attributes.at(ID::init);
191+
for (int i = 0; i < GetSize(wire) && i < GetSize(initval); i++)
192+
if (initval[i] == State::S0 || initval[i] == State::S1)
193+
init_map[initsig[i]] = initval[i] == State::S1;
194+
}
195+
196+
for (int i = 0; i < GetSize(wire); i++)
197+
{
198+
SigBit wirebit(wire, i);
199+
SigBit bit = sigmap(wirebit);
200+
201+
if (bit.wire == nullptr)
202+
continue;
203+
if (wire->port_input || wire->port_output)
204+
continue;
205+
206+
undriven_bits.insert(bit);
207+
unused_bits.insert(bit);
208+
}
190209

191210
if (wire->width == 1) {
192211
auto gclk_attr = wire->attributes.find(ID::replaced_by_gclk);
@@ -200,12 +219,6 @@ struct AigerWriter
200219
}
201220
}
202221

203-
for (auto bit : input_bits)
204-
undriven_bits.erase(bit);
205-
206-
for (auto bit : output_bits)
207-
unused_bits.erase(bit);
208-
209222
for (auto cell : module->cells())
210223
{
211224
if (cell->type == ID($_NOT_))
@@ -343,8 +356,11 @@ struct AigerWriter
343356
}
344357

345358
init_map.sort();
346-
input_bits.sort();
347-
output_bits.sort();
359+
// we are relying here on unsorted pools iterating last-in-first-out
360+
if (!no_sort) {
361+
input_bits.sort();
362+
output_bits.sort();
363+
}
348364
not_map.sort();
349365
ff_map.sort();
350366
and_map.sort();
@@ -662,8 +678,7 @@ struct AigerWriter
662678
f << std::endl;
663679
}
664680
}
665-
666-
f << stringf("c\nGenerated by %s\n", yosys_version_str);
681+
f << stringf("c\nGenerated by %s\n", yosys_maybe_version());
667682
}
668683

669684
void write_map(std::ostream &f, bool verbose_map, bool no_startoffset)
@@ -698,7 +713,7 @@ struct AigerWriter
698713
}
699714

700715
if (wire->port_output) {
701-
int o = ordered_outputs.at(sig[i]);
716+
int o = ordered_outputs.at(SigSpec(wire, i));
702717
output_lines[o] += stringf("output %d %d %s\n", o, index, log_id(wire));
703718
}
704719

@@ -746,7 +761,7 @@ struct AigerWriter
746761
{
747762
json.begin_object();
748763
json.entry("version", "Yosys Witness Aiger map");
749-
json.entry("gennerator", yosys_version_str);
764+
json.entry("gennerator", yosys_maybe_version());
750765

751766
json.entry("latch_count", aig_l);
752767
json.entry("input_count", aig_i);
@@ -902,6 +917,9 @@ struct AigerBackend : public Backend {
902917
log(" -symbols\n");
903918
log(" include a symbol table in the generated AIGER file\n");
904919
log("\n");
920+
log(" -no-sort\n");
921+
log(" don't sort input/output ports\n");
922+
log("\n");
905923
log(" -map <filename>\n");
906924
log(" write an extra file with port and latch symbols\n");
907925
log("\n");
@@ -926,6 +944,7 @@ struct AigerBackend : public Backend {
926944
bool zinit_mode = false;
927945
bool miter_mode = false;
928946
bool symbols_mode = false;
947+
bool no_sort = false;
929948
bool verbose_map = false;
930949
bool imode = false;
931950
bool omode = false;
@@ -956,6 +975,10 @@ struct AigerBackend : public Backend {
956975
symbols_mode = true;
957976
continue;
958977
}
978+
if (args[argidx] == "-no-sort") {
979+
no_sort = true;
980+
continue;
981+
}
959982
if (map_filename.empty() && args[argidx] == "-map" && argidx+1 < args.size()) {
960983
map_filename = args[++argidx];
961984
continue;
@@ -1009,7 +1032,7 @@ struct AigerBackend : public Backend {
10091032
if (!top_module->memories.empty())
10101033
log_error("Found unmapped memories in module %s: unmapped memories are not supported in AIGER backend!\n", log_id(top_module));
10111034

1012-
AigerWriter writer(top_module, zinit_mode, imode, omode, bmode, lmode);
1035+
AigerWriter writer(top_module, no_sort, zinit_mode, imode, omode, bmode, lmode);
10131036
writer.write_aiger(*f, ascii_mode, miter_mode, symbols_mode);
10141037

10151038
if (!map_filename.empty()) {

backends/aiger/xaiger.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ struct XAigerWriter
671671
//f.write(reinterpret_cast<const char*>(&buffer_size_be), sizeof(buffer_size_be));
672672
//f.write(buffer_str.data(), buffer_str.size());
673673

674-
f << stringf("Generated by %s\n", yosys_version_str);
674+
f << stringf("Generated by %s\n", yosys_maybe_version());
675675

676676
design->scratchpad_set_int("write_xaiger.num_ands", and_map.size());
677677
design->scratchpad_set_int("write_xaiger.num_wires", aig_map.size());

backends/blif/blif.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ struct BlifBackend : public Backend {
649649
if (module->get_bool_attribute(ID::top))
650650
top_module_name = module->name.str();
651651

652-
*f << stringf("# Generated by %s\n", yosys_version_str);
652+
*f << stringf("# Generated by %s\n", yosys_maybe_version());
653653

654654
std::vector<RTLIL::Module*> mod_list;
655655

backends/btor/btor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ struct BtorWorker
14991499
{
15001500
ywmap_json.begin_object();
15011501
ywmap_json.entry("version", "Yosys Witness BTOR map");
1502-
ywmap_json.entry("generator", yosys_version_str);
1502+
ywmap_json.entry("generator", yosys_maybe_version());
15031503

15041504
ywmap_json.name("clocks");
15051505
ywmap_json.begin_array();
@@ -1613,7 +1613,7 @@ struct BtorBackend : public Backend {
16131613
log_cmd_error("No top module found.\n");
16141614

16151615
*f << stringf("; BTOR description generated by %s for module %s.\n",
1616-
yosys_version_str, log_id(topmod));
1616+
yosys_maybe_version(), log_id(topmod));
16171617

16181618
BtorWorker(*f, topmod, verbose, single_bad, cover_mode, print_internal_names, info_filename, ywmap_filename);
16191619

backends/cxxrtl/cxxrtl_backend.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,15 +2429,16 @@ struct CxxrtlWorker {
24292429
inc_indent();
24302430
for (auto wire : module->wires()) {
24312431
const auto &debug_wire_type = debug_wire_types[wire];
2432-
if (!wire->name.isPublic())
2433-
continue;
24342432
count_public_wires++;
24352433
switch (debug_wire_type.type) {
24362434
case WireType::BUFFERED:
24372435
case WireType::MEMBER: {
24382436
// Member wire
24392437
std::vector<std::string> flags;
24402438

2439+
if (!wire->name.isPublic())
2440+
flags.push_back("GENERATED");
2441+
24412442
if (wire->port_input && wire->port_output)
24422443
flags.push_back("INOUT");
24432444
else if (wire->port_output)

backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ enum cxxrtl_flag {
200200
// node, such as inputs and dangling wires.
201201
CXXRTL_UNDRIVEN = 1 << 4,
202202

203+
// Generated correspond to netlist nodes that correspond to state with an internal name, that
204+
// need to be saved, but wouldn't otherwise have a debug item generated.
205+
CXXRTL_GENERATED = 1 << 5,
206+
203207
// More object flags may be added in the future, but the existing ones will never change.
204208
};
205209

backends/cxxrtl/runtime/cxxrtl/cxxrtl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,7 @@ struct debug_item : ::cxxrtl_object {
12941294
DRIVEN_SYNC = CXXRTL_DRIVEN_SYNC,
12951295
DRIVEN_COMB = CXXRTL_DRIVEN_COMB,
12961296
UNDRIVEN = CXXRTL_UNDRIVEN,
1297+
GENERATED = CXXRTL_GENERATED,
12971298
};
12981299

12991300
debug_item(const ::cxxrtl_object &object) : cxxrtl_object(object) {}

0 commit comments

Comments
 (0)