mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
proc_arst: Add special-casing of clock signal in conditionals.
The already-existing special case for conditionals on clock has been remade as follows: - now triggered for the last remaining edge trigger after all others have been converted to async reset, not just when there is only one sync rule in the first place - does not require all contained assignments to be constant, as opposed to a reset conditional — merely const-folds the condition In addition, the code has been refactored a bit; as a bonus, the priority order of async resets found is now preserved in resulting sync rule ordering (though this is not yet respected by proc_dff). Fixes #2656.
This commit is contained in:
parent
3af871f969
commit
a55bf6375b
2 changed files with 82 additions and 23 deletions
31
tests/proc/bug2656.ys
Normal file
31
tests/proc/bug2656.ys
Normal file
|
@ -0,0 +1,31 @@
|
|||
read_verilog <<EOT
|
||||
module top (...);
|
||||
|
||||
input clk, rst, d1, d2;
|
||||
output q1, q2;
|
||||
|
||||
always @(posedge clk)
|
||||
if (clk)
|
||||
q1 <= d1;
|
||||
|
||||
always @(posedge clk, posedge rst)
|
||||
if (rst)
|
||||
q2 <= 0;
|
||||
else if (clk)
|
||||
q2 <= d2;
|
||||
|
||||
endmodule
|
||||
EOT
|
||||
|
||||
proc
|
||||
opt
|
||||
|
||||
select -assert-count 1 t:$dff
|
||||
select -assert-count 1 w:clk %a %co t:$dff %i
|
||||
select -assert-count 1 w:d1 %a %co t:$dff %i
|
||||
select -assert-count 1 w:q1 %a %ci t:$dff %i
|
||||
select -assert-count 1 t:$adff
|
||||
select -assert-count 1 w:clk %a %co t:$adff %i
|
||||
select -assert-count 1 w:rst %a %co t:$adff %i
|
||||
select -assert-count 1 w:d2 %a %co t:$adff %i
|
||||
select -assert-count 1 w:q2 %a %ci t:$adff %i
|
Loading…
Add table
Add a link
Reference in a new issue