Skip to content

Commit 9e51644

Browse files
committed
Better coverage
1 parent 0104c0c commit 9e51644

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

tb/coverage.sv

+26-10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class coverage;
1111
bit [22:0] o_mantA, o_mantB;
1212

1313
bit o_fpu_out;
14+
bit [7:0] o_expO;
15+
bit [22:0] o_mantO;
1416

1517
transaction transaction0;
1618
virtual bfm vbfm0;
@@ -45,26 +47,26 @@ class coverage;
4547

4648
exponent_A: coverpoint o_expA{
4749
bins exponent_A_zero={0};
48-
bins exponent_A={[2:$]};
49-
bins exponent_A_one={1};
50+
bins exponent_A={['h1:'hfe]};
51+
bins exponent_A_ones={'hff};
5052
}
5153

5254
exponent_B: coverpoint o_expB{
5355
bins exponent_B_zero={0};
54-
bins exponent_B={[2:$]};
55-
bins exponent_B_one={1};
56+
bins exponent_B={['h1:'hfe]};
57+
bins exponent_B_ones={'hff};
5658
}
5759

5860
fraction_A: coverpoint o_mantA{
5961
bins fraction_A_zero={0};
60-
bins fraction_A={[2:$]};
61-
bins fraction_A_one={1};
62+
bins fraction_A={['h1:'h7ffffe]};
63+
bins fraction_A_ones={'h7fffff};
6264
}
6365

6466
fraction_B: coverpoint o_mantB{
6567
bins fraction_B_zero={0};
66-
bins fraction_B={[2:$]};
67-
bins fraction_B_one={1};
68+
bins fraction_B={['h1:'h7ffffe]};
69+
bins fraction_B_ones={'hfffff};
6870
}
6971

7072
// ignoring mantasa and exponent when the number is negative for A
@@ -87,6 +89,18 @@ class coverage;
8789
bins negative_output = {1}; // covering if output is negative
8890
}
8991

92+
exponent_out: coverpoint o_expO{
93+
bins exponent_O_zero={0};
94+
bins exponent_O={['h1:'hfe]};
95+
bins exponent_O_ones={'hff};
96+
}
97+
98+
fraction_out: coverpoint o_mantO{
99+
bins fraction_O_zero={0};
100+
bins fraction_O={['h1:'h7ffffe]};
101+
bins fraction_O_ones={'hfffff};
102+
}
103+
90104
endgroup
91105

92106
task run();
@@ -98,7 +112,7 @@ class coverage;
98112
vbfm0.waittilldone();
99113
common::mon2cov.get(transaction0);
100114
out_A = transaction0.opA;
101-
out_B = transaction0.opA;
115+
out_B = transaction0.opB;
102116
out_op = transaction0.fpuOp;
103117
out_O = transaction0.fpuOut;
104118

@@ -110,7 +124,9 @@ class coverage;
110124
o_expB= out_B[30:23];
111125
o_mantB=out_B[22:0];
112126

113-
out_O = out_O[31];
127+
o_fpu_out = out_O[31];
128+
o_expO = out_B[30:23];
129+
o_mantO = out_B[22:0];
114130

115131
inputs.sample();
116132
outputs.sample();

0 commit comments

Comments
 (0)