Skip to content

Instantly share code, notes, and snippets.

@Wren6991
Created May 26, 2018 20:43
Show Gist options
  • Save Wren6991/1aab258428b4fc8e3e82ee64fa8383da to your computer and use it in GitHub Desktop.
Save Wren6991/1aab258428b4fc8e3e82ee64fa8383da to your computer and use it in GitHub Desktop.
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