Advertisement
Guest User

Untitled

a guest
Nov 5th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. ////////////////////////////////////////////////////////////////////////////////
  4. // Company:
  5. // Engineer:
  6. //
  7. // Create Date:   21:40:13 11/05/2018
  8. // Design Name:   counter
  9. // Module Name:   /home/ise/Desktop/counter/tb.v
  10. // Project Name:  counter
  11. // Target Device:  
  12. // Tool versions:  
  13. // Description:
  14. //
  15. // Verilog Test Fixture created by ISE for module: counter
  16. //
  17. // Dependencies:
  18. //
  19. // Revision:
  20. // Revision 0.01 - File Created
  21. // Additional Comments:
  22. //
  23. ////////////////////////////////////////////////////////////////////////////////
  24.  
  25. module tb;
  26.  
  27.     // Inputs
  28.     reg rst;
  29.     reg clk;
  30.     reg load;
  31.     reg [5:0] initVal;
  32.  
  33.     // Outputs
  34.     wire [5:0] cout;
  35.  
  36.     // Instantiate the Unit Under Test (UUT)
  37.     counter uut (
  38.         .rst(rst),
  39.         .clk(clk),
  40.         .load(load),
  41.         .initVal(initVal),
  42.         .cout(cout)
  43.     );
  44.  
  45.     initial begin
  46.         // Initialize Inputs
  47.         rst = 0;
  48.         clk = 0;
  49.         #10;
  50.         rst = 1;
  51.  
  52.         // Wait 100 ns for global reset to finish
  53.         #100;
  54.         rst = 0;
  55.       forever #20 clk = ~clk;
  56.         // Add stimulus here
  57.  
  58.     end
  59.    
  60.     initial begin
  61.         initVal = 20;
  62.         forever #100 initVal = {$random} % 1000;
  63.     end
  64.    
  65.     initial begin
  66.         load = 1;
  67.         forever #100 load = {$random} % 2;
  68.     end
  69.      
  70. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement