mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-12 20:18:20 +00:00
Merge pull request #1392 from YosysHQ/eddie/fix1391
(* techmap_autopurge *) fixes when ports aren't consistently-sized
This commit is contained in:
commit
0a2d8db793
|
@ -224,7 +224,7 @@ struct TechmapWorker
|
||||||
|
|
||||||
for (auto bit : sigmaps.at(tpl)(it.second))
|
for (auto bit : sigmaps.at(tpl)(it.second))
|
||||||
if (bit.wire != nullptr)
|
if (bit.wire != nullptr)
|
||||||
autopurge_tpl_bits.insert(it.second);
|
autopurge_tpl_bits.insert(bit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IdString w_name = it.second->name;
|
IdString w_name = it.second->name;
|
||||||
|
@ -359,6 +359,12 @@ struct TechmapWorker
|
||||||
for (auto &attr : w->attributes) {
|
for (auto &attr : w->attributes) {
|
||||||
if (attr.first == ID(src))
|
if (attr.first == ID(src))
|
||||||
continue;
|
continue;
|
||||||
|
auto lhs = GetSize(extra_connect.first);
|
||||||
|
auto rhs = GetSize(extra_connect.second);
|
||||||
|
if (lhs > rhs)
|
||||||
|
extra_connect.first.remove(rhs, lhs-rhs);
|
||||||
|
else if (rhs > lhs)
|
||||||
|
extra_connect.second.remove(lhs, rhs-lhs);
|
||||||
module->connect(extra_connect);
|
module->connect(extra_connect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
62
tests/techmap/autopurge.ys
Normal file
62
tests/techmap/autopurge.ys
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
# https://github.com/YosysHQ/yosys/issues/1381
|
||||||
|
read_verilog <<EOT
|
||||||
|
module sub(input i, output o, (* techmap_autopurge *) input j);
|
||||||
|
foobar f(i, o, j);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
design -stash techmap
|
||||||
|
|
||||||
|
read_verilog <<EOT
|
||||||
|
(* blackbox *)
|
||||||
|
module sub(input i, output o, input j);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* blackbox *)
|
||||||
|
module foobar(input i, output o, input j);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module top(input i, output o);
|
||||||
|
sub s0(i, o);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
techmap -map %techmap
|
||||||
|
hierarchy
|
||||||
|
check -assert
|
||||||
|
|
||||||
|
# https://github.com/YosysHQ/yosys/issues/1391
|
||||||
|
design -reset
|
||||||
|
read_verilog <<EOT
|
||||||
|
module sub(input i, output o, (* techmap_autopurge *) input [1:0] j);
|
||||||
|
foobar f(i, o, j);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
design -stash techmap
|
||||||
|
|
||||||
|
read_verilog <<EOT
|
||||||
|
(* blackbox *)
|
||||||
|
module sub(input i, output o, input j);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* blackbox *)
|
||||||
|
module foobar(input i, output o, input j);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module top(input i, output o);
|
||||||
|
sub s0(i, o);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
techmap -map %techmap
|
||||||
|
hierarchy
|
||||||
|
check -assert
|
||||||
|
|
||||||
|
read_verilog -overwrite <<EOT
|
||||||
|
module top(input i, output o);
|
||||||
|
wire j;
|
||||||
|
sub s0(i, o, j);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
techmap -map %techmap
|
||||||
|
hierarchy
|
Loading…
Reference in a new issue