Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/code_examples/macro_commands/prep.ys
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ coarse:
opt_clean
memory_collect
opt -noff -keepdc -fast
sort

check:
stat
Expand Down
2 changes: 2 additions & 0 deletions kernel/rtlil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2990,6 +2990,8 @@ void RTLIL::Module::add(RTLIL::Binding *binding)
void RTLIL::Module::remove(const pool<RTLIL::Wire*> &wires)
{
log_assert(refcount_wires_ == 0);
if (wires.empty())
return;

struct DeleteWireWorker
{
Expand Down
1 change: 0 additions & 1 deletion passes/opt/opt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ struct OptPass : public Pass {
}

design->optimize();
design->sort();
design->check();

log_header(design, "Finished fast OPT passes.%s\n", fast_mode ? "" : " (There is nothing left to do.)");
Expand Down
7 changes: 4 additions & 3 deletions passes/opt/opt_clean.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ bool compare_signals(RTLIL::SigBit &s1, RTLIL::SigBit &s2, SigPool &regs, SigPoo
return conns.check_any(s2);
}

if (w1 == w2)
return s2.offset < s1.offset;

if (w1->port_output != w2->port_output)
return w2->port_output;

Expand Down Expand Up @@ -343,7 +346,7 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool verbos
RTLIL::Wire *wire = it.second;
for (int i = 0; i < wire->width; i++) {
RTLIL::SigBit s1 = RTLIL::SigBit(wire, i), s2 = assign_map(s1);
if (!compare_signals(s1, s2, register_signals, connected_signals, direct_wires))
if (compare_signals(s2, s1, register_signals, connected_signals, direct_wires))
assign_map.add(s1);
}
}
Expand Down Expand Up @@ -713,7 +716,6 @@ struct OptCleanPass : public Pass {
log("Removed %d unused cells and %d unused wires.\n", count_rm_cells, count_rm_wires);

design->optimize();
design->sort();
design->check();

keep_cache.reset();
Expand Down Expand Up @@ -778,7 +780,6 @@ struct CleanPass : public Pass {
log("Removed %d unused cells and %d unused wires.\n", count_rm_cells, count_rm_wires);

design->optimize();
design->sort();
design->check();

keep_cache.reset();
Expand Down
1 change: 1 addition & 0 deletions techlibs/common/prep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ struct PrepPass : public ScriptPass
run("memory_collect");
}
run(nokeepdc ? "opt -noff -fast" : "opt -noff -keepdc -fast");
run("sort");
}

if (check_label("check"))
Expand Down
1 change: 1 addition & 0 deletions techlibs/gowin/synth_gowin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ struct SynthGowinPass : public ScriptPass

if (check_label("map_luts"))
{
run("sort");
if (nowidelut && abc9) {
run("read_verilog -icells -lib -specify +/abc9_model.v");
run("abc9 -maxlut 4 -W 500");
Expand Down
2 changes: 2 additions & 0 deletions techlibs/xilinx/synth_xilinx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ struct SynthXilinxPass : public ScriptPass
run("pmux2shiftx", "(skip if '-nosrl' and '-widemux=0')");
run("clean", " (skip if '-nosrl' and '-widemux=0')");
}

run("sort");
}

if (check_label("map_dsp", "(skip if '-nodsp')")) {
Expand Down
Loading