Advertisement
kekellner

Lab08 - Ej01 - Testbench

Oct 15th, 2021
2,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module testbench();
  2.  
  3.     reg A, B, Cin;
  4.     wire S, Cout;
  5.  
  6.     full_adder U1(A, B, Cin, S, Cout);
  7.  
  8.     initial begin
  9.         $display("Cin A B | S Cout");
  10.         $display("----------------");
  11.         $monitor("  %b %b %b | %b  %b", Cin, A, B, S, Cout);
  12.         Cin = 0; A = 0; B = 0;
  13.         #1
  14.         Cin = 0; A = 0; B = 1;
  15.         #1
  16.         Cin = 0; A = 1; B = 0;
  17.         #1
  18.         Cin = 0; A = 1; B = 1;
  19.         #1
  20.         Cin = 1; A = 0; B = 0;
  21.         #1
  22.         Cin = 1; A = 0; B = 1;
  23.         #1
  24.         Cin = 1; A = 1; B = 0;
  25.         #1
  26.         Cin = 1; A = 1; B = 1;
  27.         #1
  28.         $finish;
  29.     end
  30.  
  31. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement