-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculation_scoreboard.sv
174 lines (162 loc) · 6.05 KB
/
calculation_scoreboard.sv
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* Scoreboard for calculation of clock period from the waveforms generated by
* the DUT.*/
class calculation_scoreboard extends uvm_scoreboard; // Clock Period Calculation Scoreboard
`uvm_component_utils(calculation_scoreboard)
uvm_tlm_analysis_fifo #(seq_item) calculation_scoreboard_port;
uvm_analysis_port #(seq_item) port;
seq_item req;
bit [0:32] time1,time2,time3,time4,time5,time6,time7,time8,time9,time10,time11,time12,time13,time14,time15;
bit [0:32] old_time1,old_time2,old_time3,old_time4,old_time5,old_time6,old_time7,old_time8,old_time9,old_time10,old_time11,old_time12,old_time13,old_time14,old_time15;
bit [0:32] clk_period_CH0,clk_period_CH1,clk_period_CH2,clk_period_CH3,clk_period_CH4,clk_period_CH5,clk_period_CH6,clk_period_CH7;
bit [0:32] on_time,on_time1,on_time2,on_time3,on_time4,on_time5,on_time6,on_time7;
function new(string name = "calculation_scoreboard", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
begin
calculation_scoreboard_port = new("calculation_scoreboard_port",this);
req = seq_item::type_id::create("req",this);
port = new("port",this);
end
endfunction : build_phase
task run_phase(uvm_phase phase);
begin
calculation_scoreboard_port.get(req);
fork //for n = 0 and 1
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH0) begin
time1 = $time;
if(time1 && old_time1)clk_period_CH0 =time1-old_time1;
old_time1 = time1;
$display("<=========clk_period_CH0===========>",clk_period_CH0);
end
@(negedge req.CH0) begin
time2 = $time;
if(time2 && old_time2) on_time = time2 - time1;
old_time2 = time2;
end
req.clk_period_CH0 = clk_period_CH0;
port.write(req);
end
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH1) begin
time3 = $time;
if(time3 && old_time3)clk_period_CH1 =time1-old_time3;
old_time3 = time3;
$display("<=========clk_period_CH1===========>",clk_period_CH1);
end
@(negedge req.CH1) begin
time4 = $time;
if(time4 && old_time4) on_time1 = time4 - time3;
old_time4 = time4;
end
req.clk_period_CH1 = clk_period_CH1;
port.write(req);
end
join_none
fork //for n = 2 and 3
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH2) begin
time5 = $time;
if(time5 && old_time5)clk_period_CH2 =time5-old_time5;
old_time5 = time5;
$display("<=========clk_period_CH2===========>",clk_period_CH2,$time);
end
@(negedge req.CH2) begin
time6 = $time;
if(time6 && old_time6) on_time2 = time6 - time5;
old_time6 = time6;
end
req.clk_period_CH2 = clk_period_CH2;
port.write(req);
end
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH3) begin
time7 = $time;
if(time7 && old_time7)clk_period_CH3 =time7-old_time7;
old_time7 = time7;
$display("<=========clk_period_CH3===========>",clk_period_CH3);
end
@(negedge req.CH3) begin
time8 = $time;
if(time8 && old_time8) on_time3 = time8 - time7;
old_time8 = time8;
end
req.clk_period_CH3 = clk_period_CH3;
port.write(req);
end
join_none
fork //for n = 4 and 5
forever begin
@(posedge req.CH4) begin
time9 = $time;
if(time8 && old_time8)clk_period_CH4 =time8-old_time8;
old_time8 = time8;
$display("<=========clk_period_CH4===========>",clk_period_CH4);
end
@(negedge req.CH4) begin
time9 = $time;
if(time9 && old_time9) on_time4 = time9 - time8;
old_time9 = time9;
end
req.clk_period_CH4 = clk_period_CH4;
port.write(req);
end
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH5) begin
time10 = $time;
if(time10 && old_time10)clk_period_CH5 =time10-old_time10;
old_time10 = time10;
$display("<=========clk_period_CH5===========>",clk_period_CH5);
end
@(negedge req.CH5) begin
time11 = $time;
if(time11 && old_time11) on_time5 = time11 - time10;
old_time11 = time11;
end
req.clk_period_CH5 = clk_period_CH5;
port.write(req);
end
join_none
fork //for n = 6 and 7
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH6) begin
time12 = $time;
if(time12 && old_time12)clk_period_CH6 =time12-old_time12;
old_time12 = time12;
$display("<=========clk_period_CH6===========>",clk_period_CH6);
end
@(negedge req.CH6) begin
time13 = $time;
if(time13 && old_time13) on_time6 = time13 - time12;
old_time6 = time6;
end
req.clk_period_CH6 = clk_period_CH6;
port.write(req);
end
forever begin
//calculation_scoreboard_port.get(req);
@(posedge req.CH7) begin
time14 = $time;
if(time14 && old_time14)clk_period_CH7 =time14-old_time14;
old_time14 = time14;
$display("<=========clk_period_CH7===========>",clk_period_CH7);
end
@(negedge req.CH7) begin
time15 = $time;
if(time15 && old_time15) on_time7 = time15 - time14;
old_time15 = time15;
end
req.clk_period_CH7 = clk_period_CH7;
port.write(req);
end
join_none
end
endtask : run_phase
endclass : calculation_scoreboard