Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. // Test bench for the binary multiplier
  2. module t_Sequential_Binary_Multiplier;
  3. parameter dp_width = 5; // Set to width of datapath
  4. wire [2*dp_width -1: 0] Product; // Output from multiplier
  5. wire Ready;
  6. reg [dp_width -1: 0] Multiplicand, Multiplier; // Inputs to multiplier
  7. reg Start, clock, reset_b;
  8. // Instantiate multiplier
  9. Sequential_Binary_Multiplier M0 (Product, Ready, Multiplicand, Multiplier, Start, clock,reset_b);
  10. // Generate stimulus waveforms
  11. initial #200 $finish;
  12. initial
  13. begin
  14. Start = 0;
  15. reset_b = 0;
  16. #2 Start = 1; reset_b = 1;
  17. Multiplicand = 5'b10111; Multiplier = 5'b10011;
  18. #10 Start = 0;
  19. end
  20. initial
  21. begin
  22. // Dump waves
  23. $dumpfile("dump.vcd");
  24. $dumpvars(1, M0);
  25. clock = 0;
  26. repeat (26) #5 clock = ~clock;
  27. end
  28. // Display results and compare with Table 8.5
  29. always @ (posedge clock)
  30. $strobe ("C=%b A=%b Q=%b P=%b time=%0d",M0.C,M0.A,M0.Q,M0.P, $time);
  31. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement