Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //====================================
- //Shift-Add Multiplier TestBench
- //====================================
- `timescale 1ns / 1ps
- module TB_Shift_Add_Mplier(
- );
- logic clk, srst, Mul_Start, Done;
- logic [1:0] Mplier, Mcand;
- logic [3:0] Product;
- ShiftAdd_Mplier dut(
- .clk(clk),
- .srst(srst),
- .Mul_Start(Mul_Start),
- .Done(Done),
- .Mplier(Mplier),
- .Mcand(Mcand),
- .Product(Product)
- );
- initial begin
- clk = 0;
- forever #5 clk = !clk;
- end
- initial begin
- srst = 1;
- repeat(2) @(posedge clk);
- srst = 0;
- end
- int expProduct = 0;
- initial begin
- repeat(2) @(posedge clk);
- repeat(8) begin
- Mplier = $urandom();
- Mcand = $urandom();
- expProduct = Mplier*Mcand;
- Mul_Start = 1;
- repeat(2) @(posedge clk);
- Mul_Start = 0;
- repeat(10) @(posedge clk);
- assert(Product == expProduct) else
- $error("Product (%0d) not as expected (%0d)", Product, expProduct);
- @(posedge clk);
- end
- $finish();
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement