Advertisement
crying234324

Untitled

Mar 25th, 2025
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 4.05 KB | Source Code | 0 0
  1. // tutorial1_tb
  2. //
  3. // Uriel Martinez-Hernandez
  4. // Updated 2022
  5.  
  6. `timescale 1ns / 1ps
  7. // The line above determines that the # delay
  8. // command uses 1ns steps and that the shortest
  9. // delay considered is 1 ps.
  10.  
  11. // The testbench has no inputs or outputs. That
  12. // would be like having wires hanging randomly
  13. // off the side of your desk. Don't do that: you
  14. // you might trip over them!
  15. module tutorial1_tb();
  16.  
  17.       // The module under test has 4 inputs and 1
  18.       // output. By using the same name in the
  19.       // testbench we are able to make use of .*
  20.       // in the instantiation of the module.
  21.       logic A,B,C,D,Z;
  22.  
  23.       // Change the name on the line below to match
  24.       // the module name you used. uut stands for
  25.       // "unit under test". It's convention but not
  26.       // required you could call it Susan if you
  27.       // really wanted to.
  28.       tutorial1 uut (.*);
  29.  
  30.       // The initial block describes what happens to
  31.       // our module inputs during the test.
  32.       initial
  33.       begin
  34.       
  35.             // By starting with a short wait, we can
  36.             // observe that the inputs start at neither
  37.             // 1 nor 0.
  38.             #10;
  39.             
  40.             // Now we clear all the inputs to zero.
  41.             A = '0;
  42.             B = '0;
  43.             C = '0;
  44.             D = '0;
  45.             
  46.             // Finally we set each input to one over a
  47.             // period of 40 ns.
  48.             #10 A = 1;        
  49.                    B = 0;
  50.                 C = 0;
  51.                 D = 0;
  52.  
  53.             #10 A = 0;        
  54.                    B = 1;
  55.                 C = 0;
  56.                 D = 0;
  57.  
  58.             #10 A = 1;        
  59.                    B = 1;
  60.                 C = 0;
  61.                 D = 0;
  62.  
  63.             #10 A = 0;        
  64.                    B = 0;
  65.                 C = 1;
  66.                 D = 0;
  67.  
  68.             #10 A = 1;        
  69.                    B = 0;
  70.                 C = 1;
  71.                 D = 0;
  72.  
  73.             #10 A = 0;        
  74.                    B = 1;
  75.                 C = 1;
  76.                 D = 0;
  77.                   
  78.             #10 A = 1;        
  79.                    B = 1;
  80.                 C = 1;
  81.                 D = 0;
  82.  
  83.             #10 A = 0;        
  84.                    B = 0;
  85.                 C = 0;
  86.                 D = 1;
  87.                   
  88.             // This is an incomplete test. Try to
  89.             // modify it to test all input combinations.    
  90.       end
  91.       
  92. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement