3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-06-03 15:47:58 +00:00
This commit is contained in:
Abhinav Kumar Puthran 2026-04-09 17:42:11 +02:00 committed by GitHub
commit ef4866c90e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 66 additions and 0 deletions

56
tests/sat/async2sync.ys Normal file
View file

@ -0,0 +1,56 @@
# has_arst path
read_verilog << EOT
module top(input clk, arst, d, output reg q);
always @(posedge clk or posedge arst)
if (arst) q <= 0;
else q <= d;
endmodule
EOT
proc
async2sync
select -assert-count 1 w:$auto$async2sync* a:src=* %i
design -reset
# has_sr path
read_verilog << EOT
module sr(input clk, set, clr, d, output reg q);
always @(posedge clk or posedge set or posedge clr)
if (clr) q <= 0;
else if (set) q <= 1;
else q <= d;
endmodule
EOT
proc
async2sync
select -assert-count 2 w:$auto$async2sync* a:src=* %i
design -reset
# has_aload path
read_verilog << EOT
module aload(input clk, aload, d, ad, output reg q);
always @(posedge clk or posedge aload)
if (aload) q <= ad;
else q <= d;
endmodule
EOT
proc
async2sync
select -assert-count 2 w:$auto$async2sync* a:src=* %i
design -reset
# latch path
read_verilog << EOT
module latch(input en, arst, d, output reg q);
always @(*)
if (arst) q <= 0;
else if (en) q <= d;
endmodule
EOT
proc
async2sync
# latch with async reset path creates 2 wires (new_q + new_d from has_arst handling)
select -assert-count 2 w:$auto$async2sync* a:src=* %i
design -reset
# a latch where has_aload is false (no async load) cannot be tested here
# because proc optimizes it away into muxes before async2sync runs,
# leaving no latch cell for async2sync to process.