调整初始化的方式

This commit is contained in:
fengbh 2025-04-14 16:57:52 +08:00
parent 2a53ca9d1a
commit 2187679d7c
3 changed files with 21 additions and 11 deletions

View File

@ -20,20 +20,22 @@ interface chip_if(input bit clk);
logic cnt_en;
logic clear;
logic [7:0] cnt;
task init;
rst_n = 0;
cnt_en = 0;
clear = 0;
endtask
clocking ck_p @(posedge clk);
default input #1ns output #1ns;
output rst_n;
output cnt_en;
output clear;
input cnt;
endclocking
task init;
ck_p.rst_n <= 0;
ck_p.cnt_en <= 0;
ck_p.clear <= 0;
@ck_p;
endtask
modport DUT(clocking ck_p);
endinterface

View File

@ -34,6 +34,14 @@ module testbench;
@co_if.ck_p;
$display("cnt = %d", co_if.ck_p.cnt);
end
@co_if.ck_p;
co_if.ck_p.clear <= 1;
@co_if.ck_p;
co_if.ck_p.clear <= 0;
for(int i=0; i<10; i++) begin
@co_if.ck_p;
$display("cnt = %d", co_if.ck_p.cnt);
end
$finish(2);
end

View File

@ -2,7 +2,7 @@ Magic 271485
Revision Verdi_O-2018.09-SP2
; Window Layout <x> <y> <width> <height> <signalwidth> <valuewidth>
viewPort 0 27 1850 380 212 65
viewPort 0 27 1850 384 212 65
; File list:
; openDirFile [-d delimiter] [-s time_offset] [-rf auto_bus_rule_file] path_name file_name
@ -16,8 +16,8 @@ signalSpacing 5
; windowTimeUnit is used for zoom, cursor & marker
; waveform viewport range
zoom 0.000000 471.232836
cursor 0.000000
zoom 0.000000 247450.000000
cursor 25000.000000
marker 0.000000
; user define markers
@ -51,12 +51,12 @@ addSignal -h 15 /testbench/u0_dut/clk
addSignal -h 15 -holdScope rst_n
addSignal -h 15 -holdScope cnt_en
addSignal -h 15 -holdScope clear
addSignal -h 15 -holdScope cnt[7:0]
addSignal -h 15 -UNSIGNED -UDEC -holdScope cnt[7:0]
addGroup "G2"
addSignal -h 15 /testbench/co_if/ck_p/rst_n
addSignal -h 15 -holdScope cnt_en
addSignal -h 15 -holdScope clear
addSignal -h 15 -holdScope cnt[7:0]
addSignal -h 15 -UNSIGNED -UDEC -holdScope cnt[7:0]
addGroup "G3"
; getSignalForm Scope Hierarchy Status