Guest User

Untitled

a guest
May 24th, 2018
97
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:   12:21:44 01/09/2012
  8. // Design Name:   cpu6
  9. // Module Name:   D:/Uczelnia/Systemy Wbudowane/cpu6/cpu6_testbench.v
  10. // Project Name:  CPU6
  11. // Target Device:  
  12. // Tool versions:  
  13. // Description:
  14. //
  15. // Verilog Test Fixture created by ISE for module: cpu6
  16. //
  17. // Dependencies:
  18. //
  19. // Revision:
  20. // Revision 0.01 - File Created
  21. // Additional Comments:
  22. //
  23. ////////////////////////////////////////////////////////////////////////////////
  24.  
  25. module cpu6_testbench;
  26.  
  27.     // Inputs
  28.     reg clk;
  29.     reg rst;
  30.     reg INT;
  31.     reg [7:0] PORTA_in;
  32.  
  33.     // Outputs
  34.     wire [7:0] PORTA_out;
  35.  
  36.     // Instantiate the Unit Under Test (UUT)
  37.     cpu6 uut (
  38.         .clk(clk),
  39.         .rst(rst),
  40.         .INT(INT),
  41.         .PORTA_out(PORTA_out),
  42.         .PORTA_in(PORTA_in)
  43.     );
  44.     localparam T = 20;
  45.    
  46.     always
  47.         begin
  48.             clk = 1'b0;
  49.             #(T/2);
  50.             clk = 1'b1;
  51.             #(T/2);
  52.         end
  53.  
  54.     initial
  55.         begin
  56.             rst = 1'b0;
  57.             #(T);
  58.             rst = 1'b1;
  59.         end
  60.        
  61.     initial begin
  62.  
  63.         INT = 1;
  64.         PORTA_in = 8'b00000001;
  65.  
  66.         #100;
  67.         INT = 0;
  68.         #80;
  69.        
  70.         PORTA_in = 8'b11111111;
  71.  
  72.         #100;
  73.         INT = 0;
  74.         PORTA_in = 8'b00001001;
  75.  
  76.         #100;        
  77.  
  78.     end
  79.      
  80. endmodule
Add Comment
Please, Sign In to add comment