Advertisement
toweber

counter_tb.v

Aug 29th, 2022
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `include "counter.v"
  2. `timescale 1us/1us
  3. module counter_tb;
  4.  
  5.    // on testbenches, inputs are regs
  6.    reg clk;
  7.    reg en;
  8.    reg rst;
  9.  
  10.    // on testbenches, outputs are wires
  11.    wire [3:0] out;
  12.  
  13.    counter BLK1 (clk, rst, en, out);  
  14.  
  15.    initial begin
  16.       rst = 0;        en = 0;          clk = 0;                
  17.       #1 rst = 1;     #1 rst = 0;      #1;
  18.       #2 en = 1;      #2;              #2 en = 0;
  19.       #2;             #2 en = 1;       #2 en = 0;
  20.       #2 $finish;
  21.  
  22.    end // initial begin
  23.  
  24.    always #1 clk = ~clk;
  25.  
  26.    initial begin
  27.       $monitor ("%t | rst = %d | clk = %d | en = %d | out = %d", $time, rst, clk, en, out);
  28.       $dumpfile("dump.vcd");
  29.       $dumpvars();
  30.    end // initial begin
  31. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement