Advertisement
kekellner

Lab10 - Ej04 - Buffer tri-estado y su testbench

Nov 8th, 2021
2,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module tri_buffer(input E, input [3:0] A, output [3:0] Y);
  2.  
  3.     assign Y = E ? A : 4'bz;
  4.  
  5. endmodule
  6.  
  7. module tb();
  8.  
  9.     reg E;
  10.     reg [3:0] A;
  11.     wire [3:0] Y;
  12.  
  13.     tri_buffer DUT (E, A, Y);
  14.  
  15.     initial begin
  16.         A = 0; E = 0;
  17.         $monitor("E: %b A: %b Y: %b", E, A, Y);
  18.         #1
  19.         A = 7; E = 0;
  20.         #1
  21.         A = 7; E = 1;
  22.         #1
  23.         A = 2; E = 1;
  24.         #1
  25.         A = 2; E = 0;
  26.         #1
  27.         A = 14; E = 0;
  28.     end
  29.  
  30. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement