Skip to content

Commit 9a43bec

Browse files
committed
Squashed 'yosys/' changes from f7a8284c7b..f3c6b41050
f3c6b41050 Release version 0.31 25d4b3a5dc Bump version 2be5c0786f Merge pull request #3826 from nakengelhardt/nak/mem_libmap_print_attr 57de249881 memory_libmap: print additional debug messages when no valid mapping is found 14d50a176d Merge pull request #3676 from nakengelhardt/dfflegalize_scratchpad_minarg a6be7b4751 memory_libmap: add debug messages for some reasons for rejecting mappings b5b0b7e839 Bump version 7542146fc5 memory_libmap: print message about attributes forcing ram kind eb397592f0 cxxrtl: add `$divfloor`. 911a76affa Merge pull request #3825 from jix/abc-fold-s a7bccdfe8d Update ABC version 596da3f2a6 Merge pull request #3815 from charlottia/py312-syntax 6be5f6449c Merge pull request #3816 from jix/smtbmc-cover-keepgoing b87af9cec0 Merge pull request #3817 from jix/constant_drive_conflict 2310a0ea9a Bump version 9ba7170919 Merge pull request #3818 from nakengelhardt/nak/verific_import_mem_access_src_loc 21686f0d9d verific: import src attribute on $memrd/$memwr cells a07f8ac38a check: Also check for conflicts with constant drivers f9744fdfcd smtbmc: Make cover mode respect --keep-going 3f29bdbbc5 smt2: py3.12+: avoid SyntaxWarning. f9257d3192 Merge pull request #3811 from YosysHQ/micko/defaultvalue 8f7a9a0b66 Bump version 51e627686a Merge pull request #3812 from charlottia/iterator-invalidation aff0065646 Use defaultvalue for init values of input ports 63e4114233 proc_prune: avoid using invalidated iterator 941fa70ce1 Merge pull request #3809 from YosysHQ/nak/show_escape f573aebdd3 Merge pull request #3810 from charlottia/docs-celllib-minor 0c0171bd60 docs: RD_DATA is an output, not input 104edb4587 Bump version 48cafd5ccf Merge pull request #1489 from YosysHQ/clifford/ediflsbidx 9c7f0e7670 show: truncate very long module names 22c9237716 show: escape angle brackets cff3195caa Improve EDIF lib_cell_ports scan fb9e12761b Add "write_edif -lsbidx" 25954715f0 Bump version d3ee4eba5b Merge pull request #3797 from charlottia/one-length-memories 3fa83ca195 Merge pull request #3808 from YosysHQ/krys/docs d1b86d2fcf docs: reflow memory map c9d31c3c87 smt2: abits needs to be at least 1 for BitVec 8b2a001021 Bump version 06f06c7be2 Merge pull request #3801 from jix/witness-aiw2yw-xbits a310bd2d23 Merge pull request #3802 from YosysHQ/micko/build_full 8b74e8ad3a Merge pull request #3796 from YosysHQ/micko/update_abc 34a6bef768 link verific where appropriate and link full archives 75cf79588e Add ability for user plugin to add new verific log callback dcc4d6e90b yosys-witness: Don't treat aiw x-bits as don't change 236e15f3b0 Merge pull request #3783 from YosysHQ/krys/docs bac4c55ed6 Merge pull request #3723 from povik/pygen-const e6f7cf3b29 Update tests 5813809ad9 Bump version 0d4a670267 Update ABC b623888f6a Update ABC to latest c5e4eec3ba Next dev cycle 3aee765793 Initial version of memory mapping doc bd06338172 py_wrap_generator: Fix handling of method name collisions f94f544b50 Fix the python generator for a bunch of const cases b562b54c14 dfflegalize: allow setting mince and minsrst args from scratchpad git-subtree-dir: yosys git-subtree-split: f3c6b41050f388634a1e781e0734675dfc5fa505
1 parent 4f4e9d7 commit 9a43bec

File tree

29 files changed

+1023
-93
lines changed

29 files changed

+1023
-93
lines changed

CHANGELOG

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
List of major changes and improvements between releases
33
=======================================================
44

5+
Yosys 0.30 .. Yosys 0.31
6+
--------------------------
7+
* New commands and options
8+
- Added option "-lsbidx" to "write_edif" pass.
9+
10+
* Various
11+
- Added support for $divfloor operator to cxxrtl backend.
12+
- dfflegalize: allow setting mince and minsrst args from scratchpad.
13+
514
Yosys 0.29 .. Yosys 0.30
615
--------------------------
716
* New commands and options

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ LDLIBS += -lrt
141141
endif
142142
endif
143143

144-
YOSYS_VER := 0.30
144+
YOSYS_VER := 0.31
145145

146146
# Note: We arrange for .gitcommit to contain the (short) commit hash in
147147
# tarballs generated with git-archive(1) using .gitattributes. The git repo
@@ -157,15 +157,15 @@ endif
157157
OBJS = kernel/version_$(GIT_REV).o
158158

159159
bumpversion:
160-
# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 9c5a60e.. | wc -l`/;" Makefile
160+
# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline f7a8284.. | wc -l`/;" Makefile
161161

162162
# set 'ABCREV = default' to use abc/ as it is
163163
#
164164
# Note: If you do ABC development, make sure that 'abc' in this directory
165165
# is just a symlink to your actual ABC working directory, as 'make mrproper'
166166
# will remove the 'abc' directory and you do not want to accidentally
167167
# delete your work on ABC..
168-
ABCREV = 2c1c83f
168+
ABCREV = bb64142
169169
ABCPULL = 1
170170
ABCURL ?= https://github.com/YosysHQ/abc
171171
ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q)
@@ -523,6 +523,7 @@ CXXFLAGS += -I$(GHDL_INCLUDE_DIR) -DYOSYS_ENABLE_GHDL
523523
LDLIBS += $(GHDL_LIB_DIR)/libghdl.a $(file <$(GHDL_LIB_DIR)/libghdl.link)
524524
endif
525525

526+
LDLIBS_VERIFIC =
526527
ifeq ($(ENABLE_VERIFIC),1)
527528
VERIFIC_DIR ?= /usr/local/src/verific_lib
528529
VERIFIC_COMPONENTS ?= verilog database util containers hier_tree
@@ -548,9 +549,9 @@ CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS
548549
endif
549550
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
550551
ifeq ($(OS), Darwin)
551-
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-mac.a,$(VERIFIC_COMPONENTS)) -lz
552+
LDLIBS_VERIFIC += $(foreach comp,$(patsubst %,$(VERIFIC_DIR)/%/*-mac.a,$(VERIFIC_COMPONENTS)),-Wl,-force_load $(comp)) -lz
552553
else
553-
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -lz
554+
LDLIBS_VERIFIC += -Wl,--whole-archive $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -Wl,--no-whole-archive -lz
554555
endif
555556
endif
556557

@@ -740,13 +741,13 @@ yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
740741
endif
741742

742743
$(PROGRAM_PREFIX)yosys$(EXE): $(OBJS)
743-
$(P) $(LD) -o $(PROGRAM_PREFIX)yosys$(EXE) $(EXE_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS)
744+
$(P) $(LD) -o $(PROGRAM_PREFIX)yosys$(EXE) $(EXE_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) $(LDLIBS_VERIFIC)
744745

745746
libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
746747
ifeq ($(OS), Darwin)
747-
$(P) $(LD) -o libyosys.so -shared -Wl,-install_name,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS)
748+
$(P) $(LD) -o libyosys.so -shared -Wl,-install_name,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_VERIFIC)
748749
else
749-
$(P) $(LD) -o libyosys.so -shared -Wl,-soname,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS)
750+
$(P) $(LD) -o libyosys.so -shared -Wl,-soname,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_VERIFIC)
750751
endif
751752

752753
%.o: %.cc

backends/cxxrtl/cxxrtl.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,25 @@ value<BitsY> modfloor_ss(const value<BitsA> &a, const value<BitsB> &b) {
15951595
return r;
15961596
}
15971597

1598+
template<size_t BitsY, size_t BitsA, size_t BitsB>
1599+
CXXRTL_ALWAYS_INLINE
1600+
value<BitsY> divfloor_uu(const value<BitsA> &a, const value<BitsB> &b) {
1601+
return divmod_uu<BitsY>(a, b).first;
1602+
}
1603+
1604+
// Divfloor. Similar to above: returns q=a//b, where q has the sign of a*b and a=b*q+N.
1605+
// In other words, returns (truncating) a/b, except if a and b have different signs
1606+
// and there's non-zero remainder, subtract one more towards floor.
1607+
template<size_t BitsY, size_t BitsA, size_t BitsB>
1608+
CXXRTL_ALWAYS_INLINE
1609+
value<BitsY> divfloor_ss(const value<BitsA> &a, const value<BitsB> &b) {
1610+
value<BitsY> q, r;
1611+
std::tie(q, r) = divmod_ss<BitsY>(a, b);
1612+
if ((b.is_neg() != a.is_neg()) && !r.is_zero())
1613+
return sub_uu<BitsY>(q, value<1> { 1u });
1614+
return q;
1615+
1616+
}
15981617

15991618
// Memory helper
16001619
struct memory_index {

backends/cxxrtl/cxxrtl_backend.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ bool is_binary_cell(RTLIL::IdString type)
185185
ID($and), ID($or), ID($xor), ID($xnor), ID($logic_and), ID($logic_or),
186186
ID($shl), ID($sshl), ID($shr), ID($sshr), ID($shift), ID($shiftx),
187187
ID($eq), ID($ne), ID($eqx), ID($nex), ID($gt), ID($ge), ID($lt), ID($le),
188-
ID($add), ID($sub), ID($mul), ID($div), ID($mod), ID($modfloor));
188+
ID($add), ID($sub), ID($mul), ID($div), ID($mod), ID($modfloor), ID($divfloor));
189189
}
190190

191191
bool is_extending_cell(RTLIL::IdString type)

backends/edif/edif.cc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ struct EdifBackend : public Backend {
120120
log(" sets the delimiting character for module port rename clauses to\n");
121121
log(" parentheses, square brackets, or angle brackets.\n");
122122
log("\n");
123+
log(" -lsbidx\n");
124+
log(" use index 0 for the LSB bit of a net or port instead of MSB.\n");
125+
log("\n");
123126
log("Unfortunately there are different \"flavors\" of the EDIF file format. This\n");
124127
log("command generates EDIF files for the Xilinx place&route tools. It might be\n");
125128
log("necessary to make small modifications to this command when a different tool\n");
@@ -132,6 +135,7 @@ struct EdifBackend : public Backend {
132135
std::string top_module_name;
133136
bool port_rename = false;
134137
bool attr_properties = false;
138+
bool lsbidx = false;
135139
std::map<RTLIL::IdString, std::map<RTLIL::IdString, int>> lib_cell_ports;
136140
bool nogndvcc = false, gndvccy = false, keepmode = false;
137141
CellTypes ct(design);
@@ -173,6 +177,10 @@ struct EdifBackend : public Backend {
173177
}
174178
continue;
175179
}
180+
if (args[argidx] == "-lsbidx") {
181+
lsbidx = true;
182+
continue;
183+
}
176184
break;
177185
}
178186
extra_args(f, filename, args, argidx);
@@ -184,6 +192,14 @@ struct EdifBackend : public Backend {
184192

185193
for (auto module : design->modules())
186194
{
195+
lib_cell_ports[module->name];
196+
197+
for (auto port : module->ports)
198+
{
199+
Wire *wire = module->wire(port);
200+
lib_cell_ports[module->name][port] = std::max(lib_cell_ports[module->name][port], GetSize(wire));
201+
}
202+
187203
if (module->get_blackbox_attribute())
188204
continue;
189205

@@ -200,7 +216,7 @@ struct EdifBackend : public Backend {
200216
if (design->module(cell->type) == nullptr || design->module(cell->type)->get_blackbox_attribute()) {
201217
lib_cell_ports[cell->type];
202218
for (auto p : cell->connections())
203-
lib_cell_ports[cell->type][p.first] = GetSize(p.second);
219+
lib_cell_ports[cell->type][p.first] = std::max(lib_cell_ports[cell->type][p.first], GetSize(p.second));
204220
}
205221
}
206222
}
@@ -437,7 +453,7 @@ struct EdifBackend : public Backend {
437453
*f << ")\n";
438454
for (int i = 0; i < wire->width; i++) {
439455
RTLIL::SigSpec sig = sigmap(RTLIL::SigSpec(wire, i));
440-
net_join_db[sig].insert(make_pair(stringf("(portRef (member %s %d))", EDIF_REF(wire->name), GetSize(wire)-i-1), wire->port_input));
456+
net_join_db[sig].insert(make_pair(stringf("(portRef (member %s %d))", EDIF_REF(wire->name), lsbidx ? i : GetSize(wire)-i-1), wire->port_input));
441457
}
442458
}
443459
}
@@ -468,13 +484,13 @@ struct EdifBackend : public Backend {
468484
log_warning("Bit %d of cell port %s.%s.%s driven by %s will be left unconnected in EDIF output.\n",
469485
i, log_id(module), log_id(cell), log_id(p.first), log_signal(sig[i]));
470486
else {
471-
int member_idx = GetSize(sig)-i-1;
487+
int member_idx = lsbidx ? i : GetSize(sig)-i-1;
472488
auto m = design->module(cell->type);
473489
int width = sig.size();
474490
if (m) {
475491
auto w = m->wire(p.first);
476492
if (w) {
477-
member_idx = GetSize(w)-i-1;
493+
member_idx = lsbidx ? i : GetSize(w)-i-1;
478494
width = GetSize(w);
479495
}
480496
}

backends/smt2/smt2.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ struct Smt2Worker
773773
int arrayid = idcounter++;
774774
memarrays[mem] = arrayid;
775775

776-
int abits = ceil_log2(mem->size);
776+
int abits = max(1, ceil_log2(mem->size));
777777

778778
bool has_sync_wr = false;
779779
bool has_async_wr = false;
@@ -1220,7 +1220,7 @@ struct Smt2Worker
12201220
{
12211221
int arrayid = memarrays.at(mem);
12221222

1223-
int abits = ceil_log2(mem->size);;
1223+
int abits = max(1, ceil_log2(mem->size));
12241224

12251225
bool has_sync_wr = false;
12261226
bool has_async_wr = false;

backends/smt2/smtbmc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ def help():
174174
further failed assertions. To output multiple traces
175175
covering all found failed assertions, the character '%' is
176176
replaced in all dump filenames with an increasing number.
177+
In cover mode, don't stop when a cover trace contains a failed
178+
assertion.
177179
178180
--check-witness
179181
check that the used witness file contains sufficient
@@ -1739,7 +1741,7 @@ def smt_check_sat(expected=["sat", "unsat"]):
17391741
smt_pop()
17401742
smt.write("(define-fun covers_%d ((state |%s_s|)) (_ BitVec %d) (bvand (covers_%d state) #b%s))" % (coveridx, topmod, len(cover_desc), coveridx-1, cover_mask))
17411743

1742-
if found_failed_assert:
1744+
if found_failed_assert and not keep_going:
17431745
break
17441746

17451747
if "1" not in cover_mask:

backends/smt2/smtio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ def check_sat(self, expected=["sat", "unsat", "unknown", "timeout", "interrupted
768768

769769
if self.timeinfo:
770770
i = 0
771-
s = "/-\|"
771+
s = r"/-\|"
772772

773773
count = 0
774774
num_bs = 0
@@ -1171,7 +1171,7 @@ def set_net(self, path, bits):
11711171

11721172
def escape_name(self, name):
11731173
name = re.sub(r"\[([0-9a-zA-Z_]*[a-zA-Z_][0-9a-zA-Z_]*)\]", r"<\1>", name)
1174-
if re.match("[\[\]]", name) and name[0] != "\\":
1174+
if re.match(r"[\[\]]", name) and name[0] != "\\":
11751175
name = "\\" + name
11761176
return name
11771177

backends/smt2/witness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def aiw2yw(input, mapfile, output):
194194

195195
values = WitnessValues()
196196
for i, v in enumerate(inline):
197-
if v == "x" or outyw.t > 0 and i in aiger_map.init_inputs:
197+
if outyw.t > 0 and i in aiger_map.init_inputs:
198198
continue
199199

200200
try:

docs/source/CHAPTER_CellLib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ The ``$mem_v2`` cell has the following ports:
571571
signals for the read ports.
572572

573573
``\RD_DATA``
574-
This input is ``\RD_PORTS*\WIDTH`` bits wide, containing all data
574+
This output is ``\RD_PORTS*\WIDTH`` bits wide, containing all data
575575
signals for the read ports.
576576

577577
``\RD_ARST``

0 commit comments

Comments
 (0)