blob: f9dcf2c14d4ded500a6c164523e7eea80554cc36 (
plain) (
blame)
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
|
`default_nettype none
`timescale 1ns/1ps
`define NUMTESTS 100000
module tb_multiplier();
logic [31:0] a;
logic [31:0] b;
logic [63:0] c;
logic [63:0] product;
multiplier dut (a, b, c);
int i;
initial begin
$fsdbDumpfile("dump.fsdb");
$fsdbDumpvars(0, "+all");
for (i = 0; i < `NUMTESTS; i=i+1) begin
a = $urandom();
b = $urandom();
product = a * b;
#10;
if (product != c) begin
$displayh("A: %0d", a);
$displayh("B: %0d", b);
$displayh("C: %0d", c);
$displayh("EXPTECTED: %0d", product);
$error("TEST FAILED");
end
else if (i % 1000 == 0) begin
$display("Test %d passed", i);
$displayh("A: %0d", a);
$displayh("B: %0d", b);
$displayh("C: %0d", c);
$displayh("EXPTECTED: %0d", product);
end
end
$display("TEST PASSES");
$finish;
end
endmodule
|