From dbaaf78044b2e3896c3745c18abe66df49424b63 Mon Sep 17 00:00:00 2001 From: Akash Levy Date: Tue, 24 Sep 2024 16:47:35 -0700 Subject: [PATCH] Iterate to new wire --- passes/opt/wreduce.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/passes/opt/wreduce.cc b/passes/opt/wreduce.cc index 047e8c5f8..006d43539 100644 --- a/passes/opt/wreduce.cc +++ b/passes/opt/wreduce.cc @@ -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); }