mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-06 17:44:09 +00:00
proc_dff: Fix emitted FF when a register is not assigned in async reset
Fixes #2619.
This commit is contained in:
parent
bc717abad2
commit
760284033d
|
@ -328,6 +328,10 @@ void proc_dff(RTLIL::Module *mod, RTLIL::Process *proc, ConstEval &ce)
|
||||||
ce.assign_map.apply(sig);
|
ce.assign_map.apply(sig);
|
||||||
|
|
||||||
if (rstval == sig) {
|
if (rstval == sig) {
|
||||||
|
if (sync_level->type == RTLIL::SyncType::ST1)
|
||||||
|
insig = mod->Mux(NEW_ID, insig, sig, sync_level->signal);
|
||||||
|
else
|
||||||
|
insig = mod->Mux(NEW_ID, sig, insig, sync_level->signal);
|
||||||
rstval = RTLIL::SigSpec(RTLIL::State::Sz, sig.size());
|
rstval = RTLIL::SigSpec(RTLIL::State::Sz, sig.size());
|
||||||
sync_level = NULL;
|
sync_level = NULL;
|
||||||
}
|
}
|
||||||
|
|
23
tests/proc/bug2619.ys
Normal file
23
tests/proc/bug2619.ys
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
read_verilog << EOT
|
||||||
|
|
||||||
|
module top(...);
|
||||||
|
|
||||||
|
input D1, D2, R, CLK;
|
||||||
|
output reg Q1, Q2;
|
||||||
|
|
||||||
|
always @(posedge CLK, posedge R) begin
|
||||||
|
Q1 <= 0;
|
||||||
|
if (!R) begin
|
||||||
|
Q1 <= D1;
|
||||||
|
Q2 <= D2;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
proc
|
||||||
|
opt
|
||||||
|
select -assert-count 1 t:$adff
|
||||||
|
select -assert-count 1 t:$dffe
|
Loading…
Reference in a new issue