Created
May 26, 2018 20:42
-
-
Save Wren6991/b58006bdb3000a7c61820cef67328a4f to your computer and use it in GitHub Desktop.
tb.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module tb(); | |
localparam W = 29; | |
localparam TEST_LEN = 10000; | |
reg [W-1:0] a; | |
reg [W-1:0] b; | |
wire [W*2-1:0] out; | |
wallace_mult #(.W(W)) inst_radix2_mult (.sext_a(1'b0), .sext_b(1'b0), .a(a), .b(b), .out(out)); | |
integer i; | |
initial begin | |
for (i = 0; i < TEST_LEN; i = i + 1) begin | |
a = $random; | |
b = $random; | |
#5; | |
if (out != a * b) begin | |
$display("Fail: %d * %d != %d", a, b, out); | |
$finish(2); | |
end | |
#5; | |
end | |
$display("Test PASSED."); | |
$finish; | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment