mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-03 13:07:58 +00:00
Add test cases for co-simulation
This commit is contained in:
parent
4a30c9cb94
commit
7ef6da4c7d
7 changed files with 953 additions and 0 deletions
48
tests/sat/sim_counter.ys
Normal file
48
tests/sat/sim_counter.ys
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Create stimulus file
|
||||
read_verilog <<EOT
|
||||
module top (clk, reset, cnt);
|
||||
|
||||
input clk;
|
||||
input reset;
|
||||
output [7:0] cnt;
|
||||
|
||||
reg [7:0] cnt;
|
||||
|
||||
endmodule
|
||||
EOT
|
||||
prep -top top;
|
||||
sim -clock clk -reset reset -fst stimulus.fst -n 10
|
||||
design -reset
|
||||
|
||||
# Counter implementation
|
||||
read_verilog <<EOT
|
||||
module top (clk, reset, cnt);
|
||||
|
||||
input clk;
|
||||
input reset;
|
||||
output [7:0] cnt;
|
||||
|
||||
reg [7:0] cnt;
|
||||
|
||||
always @(posedge clk)
|
||||
if (!reset)
|
||||
cnt = cnt + 1;
|
||||
else
|
||||
cnt = 0;
|
||||
|
||||
endmodule
|
||||
EOT
|
||||
prep -top top;
|
||||
|
||||
# Simulate with stimulus
|
||||
sim -clock clk -scope top -r stimulus.fst
|
||||
|
||||
# Stimulus does not have counter values
|
||||
# x in FST can match any value in simulation
|
||||
sim -clock clk -scope top -r stimulus.fst -sim-gate
|
||||
|
||||
# Stimulus does not have counter values
|
||||
# x in simulation can match any value in FST
|
||||
# so we expect error
|
||||
logger -expect error "Signal difference" 1
|
||||
sim -clock clk -scope top -r stimulus.fst -sim-gold
|
||||
Loading…
Add table
Add a link
Reference in a new issue