Skip to content

Commit a961373

Browse files
authored
Merge branch 'YosysHQ:main' into master
2 parents 863f409 + 37875fd commit a961373

35 files changed

+792
-122
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/Brewfile.lock.json
66

77
## build artifacts
8+
/.git-abc-submodule-hash
89
# compiler intermediate files
910
*.o
1011
*.d

Makefile

Lines changed: 14 additions & 4 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.58+35
163+
YOSYS_VER := 0.58+80
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)
@@ -845,7 +845,17 @@ check-git-abc:
845845
exit 1; \
846846
fi
847847

848-
abc/abc$(EXE) abc/libabc.a: | check-git-abc
848+
.git-abc-submodule-hash: FORCE
849+
@new=$$(cd abc 2>/dev/null && git rev-parse HEAD 2>/dev/null || echo none); \
850+
old=$$(cat .git-abc-submodule-hash 2>/dev/null || echo none); \
851+
if [ "$$new" != "$$old" ]; then \
852+
echo "$$new" > .git-abc-submodule-hash; \
853+
fi
854+
855+
abc/abc$(EXE) abc/libabc.a: .git-abc-submodule-hash | check-git-abc
856+
@if [ "$$(cd abc 2>/dev/null && git rev-parse HEAD 2>/dev/null)" != "$$(cat ../.git-abc-submodule-hash 2>/dev/null || echo none)" ]; then \
857+
rm -f abc/abc$(EXE); \
858+
fi
849859
$(P)
850860
$(Q) mkdir -p abc && $(MAKE) -C $(PROGRAM_PREFIX)abc -f "$(realpath $(YOSYS_SRC)/abc/Makefile)" ABCSRC="$(realpath $(YOSYS_SRC)/abc/)" $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc",PROG="abc$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc.a)
851861

@@ -1121,7 +1131,7 @@ docs: docs/prep
11211131

11221132
clean: clean-py
11231133
rm -rf share
1124-
rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) $(PY_WRAP_INCLUDES)
1134+
rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS)
11251135
rm -f kernel/version_*.o kernel/version_*.cc
11261136
rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
11271137
rm -rf tests/asicworld/*.out tests/asicworld/*.log
@@ -1147,7 +1157,7 @@ clean-py:
11471157

11481158
clean-abc:
11491159
$(MAKE) -C abc DEP= clean
1150-
rm -f $(PROGRAM_PREFIX)yosys-abc$(EXE) $(PROGRAM_PREFIX)yosys-libabc.a abc/abc-[0-9a-f]* abc/libabc-[0-9a-f]*.a
1160+
rm -f $(PROGRAM_PREFIX)yosys-abc$(EXE) $(PROGRAM_PREFIX)yosys-libabc.a abc/abc-[0-9a-f]* abc/libabc-[0-9a-f]*.a .git-abc-submodule-hash
11511161

11521162
mrproper: clean
11531163
git clean -xdf

backends/btor/btor.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ struct BtorWorker
9898
vector<ywmap_btor_sig> ywmap_states;
9999
dict<SigBit, int> ywmap_clock_bits;
100100
dict<SigBit, int> ywmap_clock_inputs;
101+
vector<Cell *> ywmap_asserts;
102+
vector<Cell *> ywmap_assumes;
101103

102104

103105
PrettyJson ywmap_json;
@@ -1280,6 +1282,8 @@ struct BtorWorker
12801282
btorf("%d or %d %d %d\n", nid_a_or_not_en, sid, nid_a, nid_not_en);
12811283
btorf("%d constraint %d\n", nid, nid_a_or_not_en);
12821284

1285+
if (ywmap_json.active()) ywmap_assumes.emplace_back(cell);
1286+
12831287
btorf_pop(log_id(cell));
12841288
}
12851289

@@ -1304,6 +1308,8 @@ struct BtorWorker
13041308
} else {
13051309
int nid = next_nid++;
13061310
btorf("%d bad %d%s\n", nid, nid_en_and_not_a, getinfo(cell, true));
1311+
1312+
if (ywmap_json.active()) ywmap_asserts.emplace_back(cell);
13071313
}
13081314
}
13091315

@@ -1461,6 +1467,7 @@ struct BtorWorker
14611467
log_assert(cursor == 0);
14621468
log_assert(GetSize(todo) == 1);
14631469
btorf("%d bad %d\n", nid, todo[cursor]);
1470+
// What do we do with ywmap_asserts when using single_bad?
14641471
}
14651472
}
14661473

@@ -1526,6 +1533,18 @@ struct BtorWorker
15261533
emit_ywmap_btor_sig(entry);
15271534
ywmap_json.end_array();
15281535

1536+
ywmap_json.name("asserts");
1537+
ywmap_json.begin_array();
1538+
for (Cell *cell : ywmap_asserts)
1539+
ywmap_json.value(witness_path(cell));
1540+
ywmap_json.end_array();
1541+
1542+
ywmap_json.name("assumes");
1543+
ywmap_json.begin_array();
1544+
for (Cell *cell : ywmap_assumes)
1545+
ywmap_json.value(witness_path(cell));
1546+
ywmap_json.end_array();
1547+
15291548
ywmap_json.end_object();
15301549
}
15311550
}

frontends/rtlil/rtlil_frontend.cc

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -324,29 +324,27 @@ struct RTLILFrontendWorker {
324324

325325
RTLIL::SigSpec parse_sigspec()
326326
{
327+
RTLIL::SigSpec sig;
328+
327329
if (try_parse_char('{')) {
328330
std::vector<SigSpec> parts;
329331
while (!try_parse_char('}'))
330332
parts.push_back(parse_sigspec());
331-
RTLIL::SigSpec sig;
332333
for (auto it = parts.rbegin(); it != parts.rend(); ++it)
333334
sig.append(std::move(*it));
334-
return sig;
335-
}
336-
337-
RTLIL::SigSpec sig;
338-
339-
// We could add a special path for parsing IdStrings that must already exist,
340-
// as here.
341-
// We don't need to addref/release in this case.
342-
std::optional<RTLIL::IdString> id = try_parse_id();
343-
if (id.has_value()) {
344-
RTLIL::Wire *wire = current_module->wire(*id);
345-
if (wire == nullptr)
346-
error("Wire `%s' not found.", *id);
347-
sig = RTLIL::SigSpec(wire);
348335
} else {
349-
sig = RTLIL::SigSpec(parse_const());
336+
// We could add a special path for parsing IdStrings that must already exist,
337+
// as here.
338+
// We don't need to addref/release in this case.
339+
std::optional<RTLIL::IdString> id = try_parse_id();
340+
if (id.has_value()) {
341+
RTLIL::Wire *wire = current_module->wire(*id);
342+
if (wire == nullptr)
343+
error("Wire `%s' not found.", *id);
344+
sig = RTLIL::SigSpec(wire);
345+
} else {
346+
sig = RTLIL::SigSpec(parse_const());
347+
}
350348
}
351349

352350
while (try_parse_char('[')) {

frontends/verific/verific.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ string get_full_netlist_name(Netlist *nl)
168168

169169
std::string format_src_location(DesignObj *obj)
170170
{
171-
if (obj == nullptr || obj->Linefile() == nullptr)
171+
if (obj == nullptr || !obj->Linefile())
172172
return std::string();
173173
#ifdef VERIFIC_LINEFILE_INCLUDES_COLUMNS
174-
return stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
174+
return stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
175175
#else
176-
return stringf("%s:%d", LineFile::GetFileName(obj->Linefile()), LineFile::GetLineNo(obj->Linefile()));
176+
return stringf("%s:%d", LineFile::GetFileName(obj->Linefile()), LineFile::GetLineNo(obj->Linefile()));
177177
#endif
178178
}
179179

@@ -1663,7 +1663,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
16631663
if (*ascii_initdata == 0)
16641664
break;
16651665
if (*ascii_initdata == '0' || *ascii_initdata == '1') {
1666-
initval.bits()[bit_idx] = (*ascii_initdata == '0') ? State::S0 : State::S1;
1666+
initval.set(bit_idx, (*ascii_initdata == '0') ? State::S0 : State::S1);
16671667
initval_valid = true;
16681668
}
16691669
ascii_initdata++;
@@ -1787,9 +1787,9 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
17871787

17881788
if (init_nets.count(net)) {
17891789
if (init_nets.at(net) == '0')
1790-
initval.bits().at(bitidx) = State::S0;
1790+
initval.set(bitidx, State::S0);
17911791
if (init_nets.at(net) == '1')
1792-
initval.bits().at(bitidx) = State::S1;
1792+
initval.set(bitidx, State::S1);
17931793
initval_valid = true;
17941794
init_nets.erase(net);
17951795
}
@@ -1862,13 +1862,13 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
18621862
if (bit.wire->attributes.count(ID::init))
18631863
initval = bit.wire->attributes.at(ID::init);
18641864

1865-
while (GetSize(initval) < GetSize(bit.wire))
1866-
initval.bits().push_back(State::Sx);
1865+
if (GetSize(initval) < GetSize(bit.wire))
1866+
initval.resize(GetSize(bit.wire), State::Sx);
18671867

18681868
if (it.second == '0')
1869-
initval.bits().at(bit.offset) = State::S0;
1869+
initval.set(bit.offset, State::S0);
18701870
if (it.second == '1')
1871-
initval.bits().at(bit.offset) = State::S1;
1871+
initval.set(bit.offset, State::S1);
18721872

18731873
bit.wire->attributes[ID::init] = initval;
18741874
}
@@ -1995,7 +1995,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
19951995
if (import_netlist_instance_cells(inst, inst_name))
19961996
continue;
19971997
if (inst->IsOperator() && !verific_sva_prims.count(inst->Type()))
1998-
log_warning("Unsupported Verific operator: %s (fallback to gate level implementation provided by verific)\n", inst->View()->Owner()->Name());
1998+
log_warning("%sUnsupported Verific operator: %s (fallback to gate level implementation provided by verific)\n", announce_src_location(inst), inst->View()->Owner()->Name());
19991999
} else {
20002000
if (import_netlist_instance_gates(inst, inst_name))
20012001
continue;
@@ -2055,7 +2055,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
20552055
}
20562056

20572057
Const qx_init = Const(State::S1, width);
2058-
qx_init.bits().resize(2 * width, State::S0);
2058+
qx_init.resize(2 * width, State::S0);
20592059

20602060
clocking.addDff(new_verific_id(inst), sig_dx, sig_qx, qx_init);
20612061
module->addXnor(new_verific_id(inst), sig_dx, sig_qx, sig_ox);
@@ -2320,7 +2320,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
23202320
continue;
23212321

23222322
if (non_ff_bits.count(SigBit(wire, i)))
2323-
initval.bits()[i] = State::Sx;
2323+
initval.set(i, State::Sx);
23242324
}
23252325

23262326
if (wire->port_input) {
@@ -2513,7 +2513,7 @@ Cell *VerificClocking::addDff(IdString name, SigSpec sig_d, SigSpec sig_q, Const
25132513
if (c.wire && c.wire->attributes.count(ID::init)) {
25142514
Const val = c.wire->attributes.at(ID::init);
25152515
for (int i = 0; i < GetSize(c); i++)
2516-
initval.bits()[offset+i] = val[c.offset+i];
2516+
initval.set(offset+i, val[c.offset+i]);
25172517
}
25182518
offset += GetSize(c);
25192519
}
@@ -2584,7 +2584,7 @@ Cell *VerificClocking::addAldff(IdString name, RTLIL::SigSpec sig_aload, RTLIL::
25842584
if (c.wire && c.wire->attributes.count(ID::init)) {
25852585
Const val = c.wire->attributes.at(ID::init);
25862586
for (int i = 0; i < GetSize(c); i++)
2587-
initval.bits()[offset+i] = val[c.offset+i];
2587+
initval.set(offset+i, val[c.offset+i]);
25882588
}
25892589
offset += GetSize(c);
25902590
}

frontends/verific/verificsva.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ struct SvaFsm
577577

578578
if (delta_pos >= 0 && i_within_j && j_within_i) {
579579
did_something = true;
580-
values[i].bits()[delta_pos] = State::Sa;
580+
values[i].set(delta_pos, State::Sa);
581581
values[j] = values.back();
582582
values.pop_back();
583583
goto next_pair;

kernel/io.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ std::string escape_filename_spaces(const std::string& filename)
384384
return out;
385385
}
386386

387+
void append_globbed(std::vector<std::string>& paths, std::string pattern)
388+
{
389+
rewrite_filename(pattern);
390+
std::vector<std::string> globbed = glob_filename(pattern);
391+
copy(globbed.begin(), globbed.end(), back_inserter(paths));
392+
}
393+
387394
void format_emit_unescaped(std::string &result, std::string_view fmt)
388395
{
389396
result.reserve(result.size() + fmt.size());

kernel/io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ bool is_absolute_path(std::string filename);
469469
void remove_directory(std::string dirname);
470470
bool create_directory(const std::string& dirname);
471471
std::string escape_filename_spaces(const std::string& filename);
472+
void append_globbed(std::vector<std::string>& paths, std::string pattern);
472473

473474
YOSYS_NAMESPACE_END
474475

passes/cmds/Makefile.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ OBJS += passes/cmds/abstract.o
5757
OBJS += passes/cmds/test_select.o
5858
OBJS += passes/cmds/timeest.o
5959
OBJS += passes/cmds/linecoverage.o
60+
OBJS += passes/cmds/sort.o

0 commit comments

Comments
 (0)