Hardware Reference
In-Depth Information
parameter N=4;
1
covergroup pathCg with function sample
2
( bit [7:0] inIdx, outIdx, logic [7:0] sourceId, destId);
3
cross inIdx, outIdx, sourceId, destId;
4
endgroup
5
pathCg pathCg_inst = new ();
6
task samplePathInfo(
7
bit [N-1:0] inIdx_lv,
8
bit [7:0] outIdx,
9
logic [N-1:0][7:0] sourceId_lv, destId_lv); logic [7:0]
outSourceId_lv, outDestId_lv;
10
int i;
11
for (i=0; i<N; i++) begin
12
if (inIdx_lv[i] && (sourceId_lv[i] == outSourceId_lv))
begin
13
&& (destId_lv[i] == outDestId_lv)
14
pathCg_inst.sample(i, outIdx, sourceId_lv[i], destId_lv[i
]);
15
break;
16
end
17
end
18
endtask
19
property path_cover(outIdx);
20
logic [N-1:0][7:0] sourceId_lv, destId_lv;
21
bit [N-1:0] inIdx_lv; logic [7:0] outSourceId_lv;
22
@( posedge clkIn)
23
((|startIn), inIdx_lv = startIn,
24
sourceId_lv = dataIn) ##1
25
(1'b1, destId_lv = dataIn)
26
##0
27
@( posedge clkOut)
28
(startOut[outIdx], outSourceId_lv = dataOut) ##1
29
(1'b1, samplePathInfo(inIdx_lv, outIdx,
30
sourceId_lv, destId_lv,
31
outSourceId_lv, dataOut));
32
endproperty
33
generate
34
for ( genvar i=0;i<N;i++) begin : PORT_OUT
35
cover_path: cover property (path_cover(i));
36
end
37
endgenerate
38
Fig. 18.3
Coverage of packet paths using a cover property and a cover group
18.3. Writeasingle cover property that records the same information as Exer-
cise 18.2 with the help of a covergroup .
18.4. Write a cover property and a covergroup that record which tags were
used with which tx packet kind.
18.5. Modify the cover property and the covergroup in Example 18.8 to
remedy the two issues raised there.
 
Search WWH ::




Custom Search