module tb7; // testbench for the 3-bit by 3-bit multiplier // random inputs, decimal values including a check reg [2:0] x, y; // 3-bit inputs (to be chosen randomly) wire [5:0] p; // 6-bit output of the multiplier circuit reg [5:0] check; // 6-bit product value used to check correctess // instantiate the 3-bit by 3-bit multiplier mult3 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