Skip to content

Commit cf45f41

Browse files
authored
Merge branch 'main' into main
2 parents 650b0b3 + 9591f8b commit cf45f41

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(VERSION_MINOR 0)
1717

1818

1919

20-
set(VERSION_PATCH 377)
20+
set(VERSION_PATCH 378)
2121

2222

2323

design_edit/src/rs_design_edit.cc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,52 @@ struct DesignEditRapidSilicon : public ScriptPass {
662662
}
663663
}
664664

665+
void rem_extra_wires(Module *module)
666+
{
667+
pool<SigBit> bits_used;
668+
std::unordered_set<Wire *> del_wires;
669+
670+
for(auto cell : module->cells())
671+
{
672+
for (auto &conn : cell->connections())
673+
{
674+
for (SigBit bit : conn.second)
675+
{
676+
if (bit.wire != nullptr) bits_used.insert(bit);
677+
}
678+
}
679+
}
680+
681+
for(auto &conn : module->connections())
682+
{
683+
for (SigBit bit : conn.second)
684+
{
685+
if (bit.wire != nullptr) bits_used.insert(bit);
686+
}
687+
for (SigBit bit : conn.first)
688+
{
689+
if (bit.wire != nullptr) bits_used.insert(bit);
690+
}
691+
}
692+
693+
for (auto wire : module->wires())
694+
{
695+
RTLIL::SigSpec wire_ = wire;
696+
for (auto bit : wire_)
697+
{
698+
if(!bits_used.count(bit) && !bit.wire->port_output && !bit.wire->port_input)
699+
{
700+
if(bit.wire->width == 1) del_wires.insert(bit.wire);
701+
}
702+
}
703+
}
704+
705+
for (auto wire : del_wires) {
706+
module->remove({wire});
707+
}
708+
del_wires.clear();
709+
}
710+
665711
void rem_extra_assigns(Module *module)
666712
{
667713
pool<SigBit> assign_bits;
@@ -2064,6 +2110,7 @@ struct DesignEditRapidSilicon : public ScriptPass {
20642110
elapsed_time (start, end);
20652111

20662112
rem_extra_assigns(original_mod);
2113+
rem_extra_wires(original_mod);
20672114

20682115
reportInfoFabricClocks(original_mod);
20692116

0 commit comments

Comments
 (0)