Skip to content

Commit 60d9695

Browse files
committed
Bump to latest
2 parents 045e7a8 + b9dc578 commit 60d9695

File tree

171 files changed

+2575
-1078
lines changed

Some content is hidden

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

171 files changed

+2575
-1078
lines changed

.github/workflows/test-compile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- 'gcc-10'
4343
# newest, make sure to update maximum standard step to match
4444
- 'clang-19'
45-
- 'gcc-13'
45+
- 'gcc-14'
4646
include:
4747
# macOS x86
4848
- os: macos-13
@@ -81,7 +81,7 @@ jobs:
8181
8282
# maximum standard, only on newest compilers
8383
- name: Build C++20
84-
if: ${{ matrix.compiler == 'clang-19' || matrix.compiler == 'gcc-13' }}
84+
if: ${{ matrix.compiler == 'clang-19' || matrix.compiler == 'gcc-14' }}
8585
shell: bash
8686
run: |
8787
make config-$CC_SHORT

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ ifeq ($(OS), Haiku)
180180
CXXFLAGS += -D_DEFAULT_SOURCE
181181
endif
182182

183-
YOSYS_VER := 0.57+72
183+
YOSYS_VER := 0.57+157
184184
YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1)
185185
YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2)
186186
YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'.' -f3)
@@ -681,6 +681,7 @@ $(eval $(call add_include_file,frontends/blif/blifparse.h))
681681
$(eval $(call add_include_file,backends/rtlil/rtlil_backend.h))
682682

683683
OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o kernel/io.o kernel/gzip.o
684+
OBJS += kernel/rtlil_bufnorm.o
684685
OBJS += kernel/log_help.o
685686
ifeq ($(ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS),1)
686687
OBJS += kernel/log_compat.o

backends/aiger2/aiger.cc

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct Index {
9191
int pos = index_wires(info, m);
9292

9393
for (auto cell : m->cells()) {
94-
if (cell->type.in(KNOWN_OPS) || cell->type.in(ID($scopeinfo), ID($specify2), ID($specify3)))
94+
if (cell->type.in(KNOWN_OPS) || cell->type.in(ID($scopeinfo), ID($specify2), ID($specify3), ID($input_port)))
9595
continue;
9696

9797
Module *submodule = m->design->module(cell->type);
@@ -566,7 +566,7 @@ struct Index {
566566
}
567567

568568
Lit ret;
569-
if (!bit.wire->port_input) {
569+
if (!bit.wire->port_input || bit.wire->port_output) {
570570
// an output of a cell
571571
Cell *driver = bit.wire->driverCell();
572572

@@ -618,7 +618,7 @@ struct Index {
618618

619619
if (!cursor) {
620620
log_assert(bit.wire->module == top);
621-
log_assert(bit.wire->port_input);
621+
log_assert(bit.wire->port_input && !bit.wire->port_output);
622622
return lits[top_minfo->windices[bit.wire] + bit.offset];
623623
} else {
624624
log_assert(bit.wire->module == cursor->leaf_module(*this));
@@ -723,7 +723,7 @@ struct AigerWriter : Index<AigerWriter, unsigned int, 0, 1> {
723723
for (auto id : top->ports) {
724724
Wire *w = top->wire(id);
725725
log_assert(w);
726-
if (w->port_input)
726+
if (w->port_input && !w->port_output)
727727
for (int i = 0; i < w->width; i++) {
728728
pi_literal(SigBit(w, i)) = lit_counter;
729729
inputs.push_back(SigBit(w, i));
@@ -828,7 +828,7 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
828828
{
829829
log_assert(cursor.is_top()); // TOOD: fix analyzer to work with hierarchy
830830

831-
if (bit.wire->port_input)
831+
if (bit.wire->port_input && !bit.wire->port_output)
832832
return false;
833833

834834
Cell *driver = bit.wire->driverCell();
@@ -838,7 +838,7 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
838838

839839
int max = 1;
840840
for (auto wire : mod->wires())
841-
if (wire->port_input)
841+
if (wire->port_input && !wire->port_output)
842842
for (int i = 0; i < wire->width; i++) {
843843
int ilevel = visit(cursor, driver->getPort(wire->name)[i]);
844844
max = std::max(max, ilevel + 1);
@@ -858,7 +858,7 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
858858
for (auto id : top->ports) {
859859
Wire *w = top->wire(id);
860860
log_assert(w);
861-
if (w->port_input)
861+
if (w->port_input && !w->port_output)
862862
for (int i = 0; i < w->width; i++)
863863
pi_literal(SigBit(w, i)) = 0;
864864
}
@@ -868,7 +868,7 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
868868
Module *def = design->module(box->type);
869869
if (!(def && def->has_attribute(ID::abc9_box_id)))
870870
for (auto &conn : box->connections_)
871-
if (box->output(conn.first))
871+
if (box->port_dir(conn.first) != RTLIL::PD_INPUT)
872872
for (auto bit : conn.second)
873873
pi_literal(bit, &cursor) = 0;
874874
}
@@ -883,7 +883,7 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
883883
Module *def = design->module(box->type);
884884
if (!(def && def->has_attribute(ID::abc9_box_id)))
885885
for (auto &conn : box->connections_)
886-
if (box->input(conn.first))
886+
if (box->port_dir(conn.first) == RTLIL::PD_INPUT)
887887
for (auto bit : conn.second)
888888
(void) eval_po(bit);
889889
}
@@ -903,6 +903,16 @@ struct XAigerWriter : AigerWriter {
903903
typedef std::pair<SigBit, HierCursor> HierBit;
904904
std::vector<HierBit> pos;
905905
std::vector<HierBit> pis;
906+
907+
// * The aiger output port sequence is COs (inputs to modeled boxes),
908+
// inputs to opaque boxes, then module outputs. COs going first is
909+
// required by abc.
910+
// * proper_pos_counter counts ports which follow after COs
911+
// * The mapping file `pseudopo` and `po` statements use indexing relative
912+
// to the first port following COs.
913+
// * If a module output is directly driven by an opaque box, the emission
914+
// of the po statement in the mapping file is skipped. This is done to
915+
// aid re-integration of the mapped result.
906916
int proper_pos_counter = 0;
907917

908918
pool<SigBit> driven_by_opaque_box;
@@ -937,15 +947,10 @@ struct XAigerWriter : AigerWriter {
937947
lit_counter += 2;
938948
}
939949

940-
void append_box_ports(Cell *box, HierCursor &cursor, bool inputs)
950+
void append_opaque_box_ports(Cell *box, HierCursor &cursor, bool inputs)
941951
{
942952
for (auto &conn : box->connections_) {
943-
bool is_input = box->input(conn.first);
944-
bool is_output = box->output(conn.first);
945-
946-
if (!(is_input || is_output) || (is_input && is_output))
947-
log_error("Ambiguous port direction on %s/%s\n",
948-
log_id(box->type), log_id(conn.first));
953+
bool is_input = box->port_dir(conn.first) == RTLIL::PD_INPUT;
949954

950955
if (is_input && inputs) {
951956
int bitp = 0;
@@ -955,24 +960,25 @@ struct XAigerWriter : AigerWriter {
955960
continue;
956961
}
957962

963+
// Inputs to opaque boxes are proper POs as far as abc is concerned
958964
if (map_file.is_open()) {
959965
log_assert(cursor.is_top());
960-
map_file << "pseudopo " << proper_pos_counter++ << " " << bitp
966+
map_file << "pseudopo " << proper_pos_counter << " " << bitp
961967
<< " " << box->name.c_str()
962968
<< " " << conn.first.c_str() << "\n";
963969
}
964-
970+
proper_pos_counter++;
965971
pos.push_back(std::make_pair(bit, cursor));
966972

967973
if (mapping_prep)
968974
conn.second[bitp] = RTLIL::Sx;
969975

970976
bitp++;
971977
}
972-
} else if (is_output && !inputs) {
978+
} else if (!is_input && !inputs) {
973979
for (auto &bit : conn.second) {
974-
if (!bit.wire || bit.wire->port_input)
975-
log_error("Bad connection");
980+
if (!bit.wire || (bit.wire->port_input && !bit.wire->port_output))
981+
log_error("Bad connection %s/%s ~ %s\n", log_id(box), log_id(conn.first), log_signal(conn.second));
976982

977983

978984
ensure_pi(bit, cursor);
@@ -1012,7 +1018,7 @@ struct XAigerWriter : AigerWriter {
10121018

10131019
for (auto box : minfo.found_blackboxes) {
10141020
log_debug(" - %s.%s (type %s): ", cursor.path().c_str(),
1015-
RTLIL::unescape_id(box->name).c_str(),
1021+
RTLIL::unescape_id(box->name),
10161022
log_id(box->type));
10171023

10181024
Module *box_module = design->module(box->type), *box_derived;
@@ -1038,7 +1044,7 @@ struct XAigerWriter : AigerWriter {
10381044
});
10391045

10401046
for (auto [cursor, box, def] : opaque_boxes)
1041-
append_box_ports(box, cursor, false);
1047+
append_opaque_box_ports(box, cursor, false);
10421048

10431049
holes_module = design->addModule(NEW_ID);
10441050
std::vector<RTLIL::Wire *> holes_pis;
@@ -1086,6 +1092,8 @@ struct XAigerWriter : AigerWriter {
10861092
bit = RTLIL::Sx;
10871093
}
10881094

1095+
// Nonopaque box inputs come first and are not part of
1096+
// the PO numbering used by the mapping file.
10891097
pos.push_back(std::make_pair(bit, cursor));
10901098
}
10911099
boxes_co_num += port->width;
@@ -1106,7 +1114,7 @@ struct XAigerWriter : AigerWriter {
11061114
holes_pi_idx++;
11071115
}
11081116
holes_wb->setPort(port_id, in_conn);
1109-
} else if (port->port_output && !port->port_input) {
1117+
} else if (port->port_output) {
11101118
// primary
11111119
for (int i = 0; i < port->width; i++) {
11121120
SigBit bit;
@@ -1138,7 +1146,7 @@ struct XAigerWriter : AigerWriter {
11381146
}
11391147

11401148
for (auto [cursor, box, def] : opaque_boxes)
1141-
append_box_ports(box, cursor, true);
1149+
append_opaque_box_ports(box, cursor, true);
11421150

11431151
write_be32(h_buffer, 1);
11441152
write_be32(h_buffer, pis.size());
@@ -1159,7 +1167,7 @@ struct XAigerWriter : AigerWriter {
11591167
log_assert(port);
11601168
if (port->port_input && !port->port_output) {
11611169
box_co_num += port->width;
1162-
} else if (port->port_output && !port->port_input) {
1170+
} else if (port->port_output) {
11631171
box_ci_num += port->width;
11641172
} else {
11651173
log_abort();
@@ -1182,7 +1190,7 @@ struct XAigerWriter : AigerWriter {
11821190
reset_counters();
11831191

11841192
for (auto w : top->wires())
1185-
if (w->port_input)
1193+
if (w->port_input && !w->port_output)
11861194
for (int i = 0; i < w->width; i++)
11871195
ensure_pi(SigBit(w, i));
11881196

@@ -1195,10 +1203,14 @@ struct XAigerWriter : AigerWriter {
11951203
for (auto w : top->wires())
11961204
if (w->port_output)
11971205
for (int i = 0; i < w->width; i++) {
1206+
// When a module output is directly driven by an opaque box, we
1207+
// don't emit it to the mapping file to aid re-integration, but we
1208+
// do emit a proper PO.
11981209
if (map_file.is_open() && !driven_by_opaque_box.count(SigBit(w, i))) {
1199-
map_file << "po " << proper_pos_counter++ << " " << i
1210+
map_file << "po " << proper_pos_counter << " " << i
12001211
<< " " << w->name.c_str() << "\n";
12011212
}
1213+
proper_pos_counter++;
12021214
pos.push_back(std::make_pair(SigBit(w, i), HierCursor{}));
12031215
}
12041216

@@ -1446,7 +1458,7 @@ struct XAiger2Backend : Backend {
14461458
if (!map_filename.empty()) {
14471459
writer.map_file.open(map_filename);
14481460
if (!writer.map_file)
1449-
log_cmd_error("Failed to open '%s' for writing\n", map_filename.c_str());
1461+
log_cmd_error("Failed to open '%s' for writing\n", map_filename);
14501462
}
14511463

14521464
design->bufNormalize(true);

backends/btor/btor.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,13 @@ struct BtorWorker
705705
}
706706
}
707707

708-
Const initval;
708+
Const::Builder initval_bits(GetSize(sig_q));
709709
for (int i = 0; i < GetSize(sig_q); i++)
710710
if (initbits.count(sig_q[i]))
711-
initval.bits().push_back(initbits.at(sig_q[i]) ? State::S1 : State::S0);
711+
initval_bits.push_back(initbits.at(sig_q[i]) ? State::S1 : State::S0);
712712
else
713-
initval.bits().push_back(State::Sx);
713+
initval_bits.push_back(State::Sx);
714+
Const initval = initval_bits.build();
714715

715716
int nid_init_val = -1;
716717

@@ -1039,10 +1040,11 @@ struct BtorWorker
10391040
{
10401041
if (bit.wire == nullptr)
10411042
{
1042-
Const c(bit.data);
1043-
1044-
while (i+GetSize(c) < GetSize(sig) && sig[i+GetSize(c)].wire == nullptr)
1045-
c.bits().push_back(sig[i+GetSize(c)].data);
1043+
Const::Builder c_bits;
1044+
c_bits.push_back(bit.data);
1045+
while (i + GetSize(c_bits) < GetSize(sig) && sig[i + GetSize(c_bits)].wire == nullptr)
1046+
c_bits.push_back(sig[i + GetSize(c_bits)].data);
1047+
Const c = c_bits.build();
10461048

10471049
if (consts.count(c) == 0) {
10481050
int sid = get_bv_sid(GetSize(c));

backends/cxxrtl/cxxrtl_backend.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ struct CxxrtlWorker {
15331533
}
15341534
// Internal cells
15351535
} else if (is_internal_cell(cell->type)) {
1536-
log_cmd_error("Unsupported internal cell `%s'.\n", cell->type.c_str());
1536+
log_cmd_error("Unsupported internal cell `%s'.\n", cell->type);
15371537
// User cells
15381538
} else if (for_debug) {
15391539
// Outlines are called on demand when computing the value of a debug item. Nothing to do here.
@@ -1668,26 +1668,29 @@ struct CxxrtlWorker {
16681668
f << signal_temp << " == ";
16691669
dump_sigspec(compare, /*is_lhs=*/false, for_debug);
16701670
} else if (compare.is_fully_const()) {
1671-
RTLIL::Const compare_mask, compare_value;
1671+
RTLIL::Const::Builder compare_mask_builder(compare.size());
1672+
RTLIL::Const::Builder compare_value_builder(compare.size());
16721673
for (auto bit : compare.as_const()) {
16731674
switch (bit) {
16741675
case RTLIL::S0:
16751676
case RTLIL::S1:
1676-
compare_mask.bits().push_back(RTLIL::S1);
1677-
compare_value.bits().push_back(bit);
1677+
compare_mask_builder.push_back(RTLIL::S1);
1678+
compare_value_builder.push_back(bit);
16781679
break;
16791680

16801681
case RTLIL::Sx:
16811682
case RTLIL::Sz:
16821683
case RTLIL::Sa:
1683-
compare_mask.bits().push_back(RTLIL::S0);
1684-
compare_value.bits().push_back(RTLIL::S0);
1684+
compare_mask_builder.push_back(RTLIL::S0);
1685+
compare_value_builder.push_back(RTLIL::S0);
16851686
break;
16861687

16871688
default:
16881689
log_assert(false);
16891690
}
16901691
}
1692+
RTLIL::Const compare_mask = compare_mask_builder.build();
1693+
RTLIL::Const compare_value = compare_value_builder.build();
16911694
f << "and_uu<" << compare.size() << ">(" << signal_temp << ", ";
16921695
dump_const(compare_mask);
16931696
f << ") == ";
@@ -3042,7 +3045,7 @@ struct CxxrtlWorker {
30423045
if (init == RTLIL::Const()) {
30433046
init = RTLIL::Const(State::Sx, GetSize(bit.wire));
30443047
}
3045-
init.bits()[bit.offset] = port.init_value[i];
3048+
init.set(bit.offset, port.init_value[i]);
30463049
}
30473050
}
30483051
}
@@ -3800,7 +3803,7 @@ struct CxxrtlBackend : public Backend {
38003803
if (args[argidx] == "-print-output" && argidx+1 < args.size()) {
38013804
worker.print_output = args[++argidx];
38023805
if (!(worker.print_output == "std::cout" || worker.print_output == "std::cerr")) {
3803-
log_cmd_error("Invalid output stream \"%s\".\n", worker.print_output.c_str());
3806+
log_cmd_error("Invalid output stream \"%s\".\n", worker.print_output);
38043807
worker.print_output = "std::cout";
38053808
}
38063809
continue;

backends/edif/edif.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
USING_YOSYS_NAMESPACE
3131
PRIVATE_NAMESPACE_BEGIN
3232

33-
#define EDIF_DEF(_id) edif_names(RTLIL::unescape_id(_id), true).c_str()
34-
#define EDIF_DEFR(_id, _ren, _bl, _br) edif_names(RTLIL::unescape_id(_id), true, _ren, _bl, _br).c_str()
35-
#define EDIF_REF(_id) edif_names(RTLIL::unescape_id(_id), false).c_str()
33+
#define EDIF_DEF(_id) edif_names(RTLIL::unescape_id(_id), true)
34+
#define EDIF_DEFR(_id, _ren, _bl, _br) edif_names(RTLIL::unescape_id(_id), true, _ren, _bl, _br)
35+
#define EDIF_REF(_id) edif_names(RTLIL::unescape_id(_id), false)
3636

3737
struct EdifNames
3838
{
@@ -513,7 +513,7 @@ struct EdifBackend : public Backend {
513513
if (sig.wire == NULL && sig != RTLIL::State::S0 && sig != RTLIL::State::S1) {
514514
if (sig == RTLIL::State::Sx) {
515515
for (auto &ref : it.second)
516-
log_warning("Exporting x-bit on %s as zero bit.\n", ref.first.c_str());
516+
log_warning("Exporting x-bit on %s as zero bit.\n", ref.first);
517517
sig = RTLIL::State::S0;
518518
} else if (sig == RTLIL::State::Sz) {
519519
continue;

0 commit comments

Comments
 (0)