mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-22 23:25:51 +00:00
twine: avoid TwinePool::lookup
This commit is contained in:
parent
4061593ce5
commit
3a5f5c77bf
23 changed files with 277 additions and 259 deletions
|
|
@ -288,11 +288,14 @@ struct ProcArstPass : public Pass {
|
|||
extra_args(args, argidx, design);
|
||||
pool<Wire*> delete_initattr_wires;
|
||||
|
||||
TwineRef global_arst_ref = global_arst.empty() ? Twine::Null
|
||||
: TwineSearch(&design->twines).find(global_arst);
|
||||
|
||||
for (auto mod : design->all_selected_modules()) {
|
||||
SigMap assign_map(mod);
|
||||
for (auto proc : mod->selected_processes()) {
|
||||
proc_arst(mod, proc, assign_map);
|
||||
if (global_arst.empty() || mod->wire(design->twines.lookup(global_arst)) == nullptr)
|
||||
if (global_arst_ref == Twine::Null || mod->wire(global_arst_ref) == nullptr)
|
||||
continue;
|
||||
std::vector<RTLIL::SigSig> arst_actions;
|
||||
for (auto sync : proc->syncs)
|
||||
|
|
@ -316,7 +319,7 @@ struct ProcArstPass : public Pass {
|
|||
if (!arst_actions.empty()) {
|
||||
RTLIL::SyncRule *sync = new RTLIL::SyncRule;
|
||||
sync->type = global_arst_neg ? RTLIL::SyncType::ST0 : RTLIL::SyncType::ST1;
|
||||
sync->signal = mod->wire(design->twines.lookup(global_arst));
|
||||
sync->signal = mod->wire(global_arst_ref);
|
||||
sync->actions = arst_actions;
|
||||
proc->syncs.push_back(sync);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void gen_aldff(RTLIL::Module *mod, RTLIL::SigSpec sig_in, RTLIL::SigSpec sig_set
|
|||
std::stringstream sstr;
|
||||
sstr << "$procdff$" << (autoidx++);
|
||||
|
||||
RTLIL::Cell *cell = mod->addCell(Twine{sstr.str()}, TW($aldff));
|
||||
RTLIL::Cell *cell = mod->addCell(mod->design->twines.add(std::string{sstr.str()}), TW($aldff));
|
||||
cell->attributes = proc->attributes;
|
||||
|
||||
cell->parameters[ID::WIDTH] = RTLIL::Const(sig_in.size());
|
||||
|
|
@ -116,7 +116,7 @@ void gen_dff(RTLIL::Module *mod, RTLIL::SigSpec sig_in, RTLIL::Const val_rst, RT
|
|||
std::stringstream sstr;
|
||||
sstr << "$procdff$" << (autoidx++);
|
||||
|
||||
RTLIL::Cell *cell = mod->addCell(Twine{sstr.str()}, clk.empty() ? TW($ff) : arst ? TW($adff) : TW($dff));
|
||||
RTLIL::Cell *cell = mod->addCell(mod->design->twines.add(std::string{sstr.str()}), clk.empty() ? TW($ff) : arst ? TW($adff) : TW($dff));
|
||||
cell->attributes = proc->attributes;
|
||||
|
||||
cell->parameters[ID::WIDTH] = RTLIL::Const(sig_in.size());
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ RTLIL::SigSpec gen_cmp(RTLIL::Module *mod, const RTLIL::SigSpec &signal, const s
|
|||
std::stringstream sstr;
|
||||
sstr << "$procmux$" << (autoidx++);
|
||||
|
||||
RTLIL::Wire *cmp_wire = mod->addWire(Twine{sstr.str() + "_CMP"}, 0);
|
||||
RTLIL::Wire *cmp_wire = mod->addWire(mod->design->twines.add(std::string{sstr.str() + "_CMP"}), 0);
|
||||
|
||||
for (auto comp : compare)
|
||||
{
|
||||
|
|
@ -178,7 +178,7 @@ RTLIL::SigSpec gen_cmp(RTLIL::Module *mod, const RTLIL::SigSpec &signal, const s
|
|||
else
|
||||
{
|
||||
// create compare cell
|
||||
RTLIL::Cell *eq_cell = mod->addCell(Twine{stringf("%s_CMP%d", sstr.str(), cmp_wire->width)}, ifxmode ? TW($eqx) : TW($eq));
|
||||
RTLIL::Cell *eq_cell = mod->addCell(mod->design->twines.add(std::string{stringf("%s_CMP%d", sstr.str(), cmp_wire->width)}), ifxmode ? TW($eqx) : TW($eq));
|
||||
apply_attrs(eq_cell, sw, cs);
|
||||
|
||||
eq_cell->parameters[ID::A_SIGNED] = RTLIL::Const(0);
|
||||
|
|
@ -201,10 +201,10 @@ RTLIL::SigSpec gen_cmp(RTLIL::Module *mod, const RTLIL::SigSpec &signal, const s
|
|||
}
|
||||
else
|
||||
{
|
||||
ctrl_wire = mod->addWire(Twine{sstr.str() + "_CTRL"});
|
||||
ctrl_wire = mod->addWire(mod->design->twines.add(std::string{sstr.str() + "_CTRL"}));
|
||||
|
||||
// reduce cmp vector to one logic signal
|
||||
RTLIL::Cell *any_cell = mod->addCell(Twine{sstr.str() + "_ANY"}, TW($reduce_or));
|
||||
RTLIL::Cell *any_cell = mod->addCell(mod->design->twines.add(std::string{sstr.str() + "_ANY"}), TW($reduce_or));
|
||||
apply_attrs(any_cell, sw, cs);
|
||||
|
||||
any_cell->parameters[ID::A_SIGNED] = RTLIL::Const(0);
|
||||
|
|
@ -236,10 +236,10 @@ RTLIL::SigSpec gen_mux(RTLIL::Module *mod, const RTLIL::SigSpec &signal, const s
|
|||
log_assert(ctrl_sig.size() == 1);
|
||||
|
||||
// prepare multiplexer output signal
|
||||
RTLIL::Wire *result_wire = mod->addWire(Twine{sstr.str() + "_Y"}, when_signal.size());
|
||||
RTLIL::Wire *result_wire = mod->addWire(mod->design->twines.add(std::string{sstr.str() + "_Y"}), when_signal.size());
|
||||
|
||||
// create the multiplexer itself
|
||||
RTLIL::Cell *mux_cell = mod->addCell(Twine{sstr.str()}, TW($mux));
|
||||
RTLIL::Cell *mux_cell = mod->addCell(mod->design->twines.add(std::string{sstr.str()}), TW($mux));
|
||||
apply_attrs(mux_cell, sw, cs);
|
||||
|
||||
mux_cell->parameters[ID::WIDTH] = RTLIL::Const(when_signal.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue