Advertisement
kekellner

Lab07 - Ej02 - Testbench

Oct 13th, 2021
2,195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `include "fsm_moore.v"
  2.  
  3. module testbench();
  4.  
  5.     reg A, B, clk, reset;
  6.     wire Q;
  7.     wire [1:0] state, next_state;
  8.  
  9.     FSM_moore U1(A, B, clk, reset, Q, state, next_state);
  10.  
  11.     initial begin
  12.         A = 0; B = 0; clk = 0; reset = 0;
  13.         #2
  14.         reset = 1;
  15.         #1
  16.         reset = 0;
  17.         #5
  18.         A = 1;
  19.         B = 1;
  20.         #30
  21.         B = 0;
  22.         #20
  23.         A = 0;
  24.         #20
  25.         A = 1;
  26.         B = 1;
  27.     end
  28.  
  29.     initial begin
  30.         $dumpfile("timing.vcd");
  31.         $dumpvars(0, testbench);
  32.     end
  33.  
  34.     initial
  35.         #150 $finish;
  36.  
  37.     always
  38.         #5 clk = ~clk;
  39.  
  40. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement