1WaKa_WaKa1

shift_reg_tb

Apr 6th, 2023
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. module shift_reg_tb;
  3.  
  4. reg clock, rst, en, mux_ld;
  5. reg[31:0] inp;
  6. wire outp;
  7.  
  8. shift_reg shft_reg(
  9.     .clk (clock),
  10.     .reset (rst),
  11.     .enable (en),
  12.     .inp (inp),
  13.     .mux_load(mux_ld),
  14.     .s_out (outp)
  15. );
  16.  
  17. integer i;
  18. initial begin
  19.     i = 0;
  20.  
  21.     inp = 32'haaaa;
  22.     clock = 0;
  23.     rst = 0;
  24.     mux_ld = 1;
  25.     en = 0;
  26.     #5 clock = ~clock;
  27.     #5 clock = ~clock;
  28.    
  29.     mux_ld = 0;
  30.     en = 1;
  31.    
  32.      for (i = 0 ; i < 20 ; i = i + 1) begin
  33.         #5 clock = ~clock;
  34.         #5 clock = ~clock;
  35.         $display("Shifted val:%b", shft_reg.shifted_reg);
  36.         $display("Shifted reg:%b", shft_reg.s_out);
  37.     end
  38.     $stop;
  39.  
  40. end
  41. endmodule
  42.  
Add Comment
Please, Sign In to add comment