module tb7new; // testbench for the 5-bit by 4-bit multiplier // random inputs, decimal values including a check reg [4:0] x; // 5-bit inputs (to be chosen randomly) reg [3:0] y; // 4-bit inputs (to be chosen randomly) wire [8:0] p; // 9-bit output of the multiplier circuit reg [8:0] check; // 9-bit product value used to check correctess // instantiate the 5-bit by 4-bit multiplier mult5by4 mult_instance(x, y, p); // simulation of 20 random multiplication operations initial repeat (20) begin // get new operand values and compute a check value x = $random; y = $random; check = x * y; // compute and display the product every 10 time units #10 $display($time, " %d * %d = %d (%d)", x, y, p, check); end endmodule