3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-15 03:35:40 +00:00

WIP migration to twine

This commit is contained in:
Emil J. Tywoniak 2026-06-17 11:04:03 +02:00
parent 25f27026f0
commit 96b0ba9581
51 changed files with 289 additions and 275 deletions

View file

@ -59,7 +59,7 @@ struct DffinitPass : public Pass {
{
log_header(design, "Executing DFFINIT pass (set INIT param on FF cells).\n");
dict<IdString, dict<IdString, IdString>> ff_types;
dict<IdString, dict<TwineRef, IdString>> ff_types;
bool highlow_mode = false, noreinit = false;
std::string high_string, low_string;
@ -79,7 +79,7 @@ struct DffinitPass : public Pass {
}
if (args[argidx] == "-ff" && argidx+3 < args.size()) {
IdString cell_name = RTLIL::escape_id(args[++argidx]);
IdString output_port = RTLIL::escape_id(args[++argidx]);
TwineRef output_port = design->twines.add(std::string{RTLIL::escape_id(args[++argidx])});
IdString init_param = RTLIL::escape_id(args[++argidx]);
ff_types[cell_name][output_port] = init_param;
continue;
@ -123,14 +123,14 @@ struct DffinitPass : public Pass {
if (noreinit && value[i] != State::Sx && value[i] != initval[i])
log_error("Trying to assign a different init value for %s.%s.%s which technically "
"have a conflicted init value.\n",
module, cell, design->twines.unescaped_str(it.second));
module, cell, it.second.unescape());
value.set(i, initval[i]);
}
if (highlow_mode && GetSize(value) != 0) {
if (GetSize(value) != 1)
log_error("Multi-bit init value for %s.%s.%s is incompatible with -highlow mode.\n",
module, cell, design->twines.unescaped_str(it.second));
module, cell, it.second.unescape());
if (value[0] == State::S1)
value = Const(high_string);
else
@ -138,8 +138,8 @@ struct DffinitPass : public Pass {
}
if (value.size() != 0) {
log("Setting %s.%s.%s (port=%s, net=%s) to %s.\n", module, cell, design->twines.unescaped_str(it.second),
it.first.unescape(), log_signal(sig), log_signal(value));
log("Setting %s.%s.%s (port=%s, net=%s) to %s.\n", module, cell, it.second.unescape(),
design->twines.unescaped_str(it.first), log_signal(sig), log_signal(value));
cell->setParam(it.second, value);
}
}