Skip to content

Commit b72c779

Browse files
committed
Support cell name in btor witness file
1 parent d340f30 commit b72c779

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

passes/sat/sim.cc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,12 +1290,21 @@ struct SimWorker : SimShared
12901290
RTLIL::IdString escaped_s = RTLIL::escape_id(signal_name(parts[len-1]));
12911291
if (len==3) {
12921292
Wire *w = topmod->wire(escaped_s);
1293-
if (!w)
1294-
log_warning("Wire %s not present in module %s\n",log_id(escaped_s),log_id(topmod));
1295-
if (w && (int)parts[1].size() != w->width)
1296-
log_error("Size of wire %s is different than provided data.\n", log_signal(w));
1297-
if (w)
1293+
if (!w) {
1294+
Cell *c = topmod->cell(escaped_s);
1295+
if (!c)
1296+
log_warning("Wire/cell %s not present in module %s\n",log_id(escaped_s),log_id(topmod));
1297+
else if (c->type.in(ID($anyconst), ID($anyseq))) {
1298+
SigSpec sig_y= c->getPort(ID::Y);
1299+
if ((int)parts[1].size() != GetSize(sig_y))
1300+
log_error("Size of wire %s is different than provided data.\n", log_signal(sig_y));
1301+
top->set_state(sig_y, Const::from_string(parts[1]));
1302+
}
1303+
} else {
1304+
if ((int)parts[1].size() != w->width)
1305+
log_error("Size of wire %s is different than provided data.\n", log_signal(w));
12981306
top->set_state(w, Const::from_string(parts[1]));
1307+
}
12991308
} else {
13001309
Cell *c = topmod->cell(escaped_s);
13011310
if (!c)

0 commit comments

Comments
 (0)