Advertisement
toweber

relu_tb.v

Aug 29th, 2022
1,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `include "relu.v"
  2. `timescale 1us/1us
  3. module tf_tb;
  4.  
  5.    // parameters      
  6.    parameter WIDTH= 4;
  7.    parameter maxvalue = 2**(WIDTH-1)-1; // for one attribute
  8.    parameter minvalue = -(2**(WIDTH-1)); // for one attribute
  9.  
  10.    // on testbenches, inputs are regs
  11.    reg signed [WIDTH-1:0] in1;
  12.    reg clk;
  13.    
  14.    // on testbenches, outputs are wires
  15.    wire signed [WIDTH-1:0] out;
  16.    
  17.    //mac MAC1(in1,in2,clk, reset, out);
  18.  
  19.    relu #(.WIDTH(WIDTH))  TF1 (in1,out);
  20.    
  21.    initial begin
  22.       clk = 0;     in1 = minvalue;        
  23.       #(2*2**WIDTH) $finish;
  24.            
  25.    end // initial begin
  26.  
  27.    always  #1 clk = ~clk;
  28.    always  #2 in1 = in1+1;
  29.      
  30.    initial begin
  31.       $monitor ("%t | in1 = %d | clk = %d | out = %d", $time, in1, clk, out);
  32.       $dumpfile("dump.vcd");
  33.       $dumpvars();
  34.    end
  35. endmodule // sr_tb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement