Skip to content

Commit 3e3ec19

Browse files
committed
added new constraint to create inf values at operands
1 parent dc1f029 commit 3e3ec19

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
all: build sim
44

5-
NUM_TESTS := 100
5+
NUM_TESTS := 10000
66
TOLERATE_BITS := 3
7-
RAND_CONS := 5
7+
RAND_CONS := 61
88
FPU_SRC := duv/pfpu32_top.v
99

1010
clean:
@@ -26,7 +26,8 @@ vsim_args := \
2626
+NUM_TESTS=$(NUM_TESTS) \
2727
+TOLERATE_BITS=$(TOLERATE_BITS) \
2828
+RAND_CONS=$(RAND_CONS) \
29-
-suppress 8604
29+
-suppress 8604 \
30+
-suppress 8630
3031

3132
ifdef TEST_PRINT
3233
vsim_args += +TEST_PRINT

tb/generator.sv

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class generator;
88
if (!$value$plusargs("NUM_TESTS=%0d", NUM_TESTS)) NUM_TESTS = 10;
99

1010
t = new();
11-
setconstraints();
1211

1312
do
1413
begin
14+
setconstraints();
1515
assert (t.randomize());
1616
common::gen2drv.put(t);
1717
common::cbfm0.waittilldone();
@@ -22,7 +22,6 @@ class generator;
2222
int RAND_CONS = 7;
2323
if ($value$plusargs("RAND_CONS=%0d", RAND_CONS))
2424
begin
25-
$display("Constraints chosen with RAND_CONS = %d", RAND_CONS);
2625
RAND_CONS = RAND_CONS + 1;
2726
end
2827
t.constraint_mode(0);
@@ -52,6 +51,16 @@ class generator;
5251
t.zeroonlyA.constraint_mode(1);
5352
t.zeroonlyB.constraint_mode(1);
5453
end
54+
51: begin
55+
t.infA.constraint_mode(1);
56+
end
57+
55: begin
58+
t.infB.constraint_mode(1);
59+
end
60+
60: begin
61+
t.infA.constraint_mode(1);
62+
t.infB.constraint_mode(1);
63+
end
5564
default: begin
5665
t.normonlyA.constraint_mode(1);
5766
t.normonlyB.constraint_mode(1);

tb/transaction.sv

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class transaction;
1515
constraint normonlyB {expB != '0 || mantB == 0;};
1616
constraint denormonlyB {expB == '0 && mantB != '0;};
1717
constraint zeroonlyB {expB == '0 && mantB == '0;};
18+
constraint infA {expA == '1 && mantA == '0;};
19+
constraint infB {expB == '1 && mantB == '0;};
1820
constraint bothnormdenormAB {};
1921

2022
protected int randcount = 0;

0 commit comments

Comments
 (0)