Skip to content

Commit

Permalink
Iterate to new wire
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy committed Sep 24, 2024
1 parent ebf8783 commit dbaaf78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion passes/opt/wreduce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ struct WreduceWorker
continue;

log("Removed top %d bits (of %d) from wire %s.%s.\n", unused_top_bits, GetSize(w), log_id(module), log_id(w));
Wire *nw = module->addWire(IdString("$" + w->name.str()), GetSize(w) - unused_top_bits);
IdString nw_name = IdString("$" + w->name.str());
while (module->count_id(nw_name)) nw_name = IdString("$" + nw_name.str());
Wire *nw = module->addWire(nw_name, GetSize(w) - unused_top_bits);
module->connect(nw, SigSpec(w).extract(0, GetSize(nw)));
module->swap_names(w, nw);
}
Expand Down

0 comments on commit dbaaf78

Please sign in to comment.