Advertisement
Ailrun

Untitled

May 31st, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. module EleCont_Test;
  4.  
  5.     // Inputs
  6.     reg clk;
  7.     reg reset;
  8.     reg [11:0] nRFB;
  9.     reg [9:1] nIB1;
  10.     reg [9:1] nIB2;
  11.  
  12.     // Outputs
  13.     wire [2:0] currentFloor1;
  14.     wire [2:0] currentFloor2;
  15.     wire [1:0] currentDirection1;
  16.     wire [1:0] currentDirection2;
  17.     wire [11:0] currentRealFloorButton;
  18.     wire [9:1] currentInternalButton1;
  19.     wire [9:1] currentInternalButton2;
  20.     wire doorState1;
  21.     wire doorState2;
  22.  
  23.     // Instantiate the Unit Under Test (UUT)
  24.     ElevatorController#(40,40,0) uut (
  25.         .clk(clk),
  26.         .reset(reset),
  27.         .newRealFloorButton(nRFB),
  28.         .newInternalButton1(nIB1),
  29.         .newInternalButton2(nIB2),
  30.         .currentFloor1(currentFloor1),
  31.         .currentFloor2(currentFloor2),
  32.         .currentDirection1(currentDirection1),
  33.         .currentDirection2(currentDirection2),
  34.         .currentRealFloorButton(currentRealFloorButton),
  35.         .currentInternalButton1(currentInternalButton1),
  36.         .currentInternalButton2(currentInternalButton2),
  37.         .doorState1(doorState1),
  38.         .doorState2(doorState2)
  39.     );
  40.  
  41.  
  42.     initial begin
  43.         clk = 0;
  44.         reset = 1;
  45.         nRFB = 0;
  46.         nIB1 = 0;
  47.         nIB2 = 0;
  48.         #10000;
  49.         reset = 0;
  50.        
  51.        
  52.         #10000;
  53.         nRFB = 12'b0_00_01_01_00_00_1;
  54.         #100;
  55.         nRFB = 0;
  56.        
  57.         #20000;
  58.         nIB1 = 9'b00_000_1010;
  59.         nIB2 = 9'b00_000_1001;
  60.         #100;
  61.         nIB1 = 0;
  62.         nIB2 = 0;
  63.        
  64.         #20000;
  65.         nIB1 = 9'b10_000_0010;
  66.         nIB2 = 9'b00_001_0010;
  67.         nRFB = 12'b1_00_00_01_00_10_0;
  68.         #100;
  69.         nIB1 = 0;
  70.         nIB2 = 0;
  71.         nRFB = 0;
  72.        
  73.         #10000;
  74.         nRFB = 12'b0_10_00_00_01_00_0;
  75.         #100;
  76.         nRFB = 0;
  77.        
  78.         #30000;
  79.         nIB1 = 9'b00_000_0101;
  80.         nIB2 = 9'b10_000_1001;
  81.         nRFB = 12'b0_00_00_00_00_10_0;
  82.         #100;
  83.         nIB1 = 0;
  84.         nIB2 = 0;
  85.         nRFB = 0;
  86.        
  87.         #20000;
  88.         nIB1 = 9'b00_000_0100;
  89.         nRFB = 12'b0_00_00_10_00_01_0;
  90.         #100;
  91.         nIB1 = 0;
  92.         nRFB = 0;
  93.        
  94.         #40000;
  95.         nIB1 = 9'b00_000_0100;
  96.         nIB2 = 9'b00_000_0100;
  97.         nRFB = 12'b0_00_11_00_01_00_0;
  98.         #100;
  99.         nIB1 = 0;
  100.         nIB2 = 0;
  101.         nRFB = 0;
  102.        
  103.         #40000;
  104.         nIB1 = 9'b10_000_1010;
  105.         nIB2 = 9'b00_001_1000;
  106.         nRFB = 12'b0_00_00_00_10_00_0;
  107.         #100;
  108.         nIB1 = 0;
  109.         nIB2 = 0;
  110.         nRFB = 0;
  111.        
  112.         #10000;
  113.         nIB1 = 9'b00_000_0100;
  114.         nRFB = 12'b1_00_00_10_00_11_0;
  115.         #100;
  116.         nIB1 = 0;
  117.         nRFB = 0;
  118.        
  119.         #20000;
  120.         nIB1 = 9'b00_001_0100;
  121.         nIB2 = 9'b00_001_0000;
  122.         #100;
  123.         nIB1 = 0;
  124.         nIB2 = 0;
  125.        
  126.         #100000;
  127.         nIB2 = 9'b10_000_0000;
  128.         nRFB = 12'b0_00_01_00_01_10_0;
  129.         #100;
  130.         nIB2 = 0;
  131.         nRFB = 0;
  132.        
  133.         #10000;
  134.         nRFB = 12'b0_00_00_01_00_10_0;
  135.         #100;
  136.         nRFB = 0;
  137.        
  138.         #10000;
  139.         nIB1 = 9'b00_000_0001;
  140.         nIB2 = 9'b00_000_1001;
  141.         #100;
  142.         nIB1 = 0;
  143.         nIB2 = 0;
  144.        
  145.         #10000;
  146.         nIB2 = 9'b00_000_1001;
  147.         #100;
  148.         nIB2 = 0;
  149.        
  150.         #20000;
  151.         nRFB = 12'b0_00_00_00_01_10_0;
  152.         #100;
  153.         nRFB = 0;
  154.        
  155.         #20000;
  156.         nIB1 = 9'b00_001_0000;
  157.         nRFB = 12'b0_00_00_01_00_00_0;
  158.         #100;
  159.         nIB1 = 0;
  160.         nRFB = 0;
  161.        
  162.         #200000;
  163.         $finish;
  164.     end
  165.    
  166.     always begin
  167.         #25 clk = ~clk;
  168.     end
  169.      
  170. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement