forked from TaoL24/Verification
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclocking.sv
More file actions
40 lines (33 loc) · 872 Bytes
/
clocking.sv
File metadata and controls
40 lines (33 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
create_clock -name clk -period 10.0
set_input_delay -clock clk 3.0 [get_ports clk1]
clocking cb @(posedge clk);
default input #1step output #3;
input dout; // output for DUT
output reset, data; // input for DUT
output negedge enab;
endclocking
// example for cycle delay
default clocking cb1 @(posedge clk);
input #2 dout;
output #3 reset, data;
endclocking
clocking cb4 @(negedge clk);
output #3 enab, rdata;
endclocking
initial begin
// Wait 2 cb1 cycles
repeat (2) @(cb1);
// Wait 2 cb1 cycles
##2;
// Drive data after 1 cb cycle
##1 cb1.data <= 2'b01;
##1; cb1.data <= 2'b10;
// Drive rdata with current dreg
// value after 3 cb4 cycles
cb4.rdata <= ##3 dreg;
end
// inter-statement assignment/ intra-statement assignment difference
#5 a = b; // inter
a = #5 b; // intra
a = @(posedge clk) b;
a = repeat(5) @(posedge clk) b;