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
|
`timescale 1us/1us
`include "nandgame_types.v"
module cond_check_tb;
logic [15:0] tst_in1;
logic tst_check_ltz, tst_check_gtz, tst_check_eqz;
logic tst_result;
cond_check uut (
.X_in(tst_in1),
.check_ltz_in(tst_check_ltz),
.check_gtz_in(tst_check_gtz),
.check_eqz_in(tst_check_eqz),
.result_out(tst_result)
);
string filename;
initial begin
`ifdef DUMP_FILE_NAME
filename=`DUMP_FILE_NAME;
`else
filename="cond_check.lin1t2";
`endif
$dumpfile(filename); $dumpvars();
end
bit exp_res;
initial begin
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = 0;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 1; tst_in1 = 0;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 1; tst_check_ltz = 0; tst_in1 = 0;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 1; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = 0;
#1
exp_res = 1;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = 1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 1; tst_in1 = 1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 1; tst_check_ltz = 0; tst_in1 = 1;
#1
exp_res = 1;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 1; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = 1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = -1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 0; tst_check_ltz = 1; tst_in1 = -1;
#1
exp_res = 1;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 0; tst_check_gtz = 1; tst_check_ltz = 0; tst_in1 = -1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
tst_check_eqz = 1; tst_check_gtz = 0; tst_check_ltz = 0; tst_in1 = -1;
#1
exp_res = 0;
assert(tst_result == exp_res)
else $error("Expected %d, but got %d", exp_res, tst_result);
#1
$finish();
end
endmodule
|