fix: add timing sim tricks

This commit is contained in:
Zer0Nu11
2026-06-20 04:05:37 +03:00
parent efcd6ef5d0
commit 789255fa04

View File

@ -94,6 +94,7 @@ module tb_top;
task automatic reset_dut_dac( task automatic reset_dut_dac(
input int rst_duration // сколько тактов держать сброс input int rst_duration // сколько тактов держать сброс
); );
@(posedge clk_dac);
rst_dac <= 1; rst_dac <= 1;
repeat(rst_duration) @(posedge clk_dac); repeat(rst_duration) @(posedge clk_dac);
rst_dac <= 0; rst_dac <= 0;
@ -103,6 +104,7 @@ module tb_top;
task automatic reset_dut_adc( task automatic reset_dut_adc(
input int rst_duration // сколько тактов держать сброс input int rst_duration // сколько тактов держать сброс
); );
@(posedge clk_adc);
rst_adc <= 1; rst_adc <= 1;
repeat(rst_duration) @(posedge clk_adc); repeat(rst_duration) @(posedge clk_adc);
rst_adc <= 0; rst_adc <= 0;
@ -180,6 +182,7 @@ module tb_top;
.h(pulse_height), .h(pulse_height),
.sn(sample_num) .sn(sample_num)
); );
@(posedge clk_dac);
if (randomize_start_timing) if (randomize_start_timing)
start_hold_time = $urandom_range(1, 15); start_hold_time = $urandom_range(1, 15);
@ -266,6 +269,7 @@ module tb_top;
$display("[TB] -run_test_case- Stop randomize_out_of_range_proc"); $display("[TB] -run_test_case- Stop randomize_out_of_range_proc");
end end
end end
out_of_range = 0;
// Проверка по статистике. Подсчет средних значений // Проверка по статистике. Подсчет средних значений
if (pulse_delay_time_stats.size() != pulse_num && pulse_height != ZERO_LEVEL && pulse_width != 0) begin // Detected with pulse level. Skip if pulse level undetectable if (pulse_delay_time_stats.size() != pulse_num && pulse_height != ZERO_LEVEL && pulse_width != 0) begin // Detected with pulse level. Skip if pulse level undetectable
@ -350,6 +354,8 @@ module tb_top;
rst_adc = 0; rst_adc = 0;
rst_dac = 0; rst_dac = 0;
#100; // init
$display("[TB] Test 1. Simple test. (1/3)"); $display("[TB] Test 1. Simple test. (1/3)");
run_test_case( run_test_case(
.pulse_width(50), .pulse_width(50),