Advertisement
symonhasan

And_Gate

Jan 7th, 2020
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* basic logic gate */
  2. /* and gate */
  3. /* 07 / 01 / 2020 */
  4.  
  5. module and_gate( x, y , z );
  6.     input x;
  7.     input y;
  8.     output z;
  9.     and( z , x, y );
  10. endmodule
  11.  
  12. module Test;
  13.     reg x_t , y_t;
  14.     wire z_t;
  15.  
  16. and_gate and_1( x_t , y_t, z_t );
  17.     initial
  18.         begin
  19.             x_t <=0 ; y_t <= 0;
  20.             #1 $display("A = %b , B = %b , Y = %b " , x_t , y_t , z_t );
  21.            
  22.             x_t <=0 ; y_t <= 1;
  23.             #1 $display("A = %b , B = %b , Y = %b " , x_t , y_t , z_t );
  24.  
  25.             x_t <= 1 ; y_t <= 0;
  26.             #1 $display("A = %b , B = %b , Y = %b " , x_t , y_t , z_t );
  27.  
  28.             x_t <=1 ; y_t <= 1;
  29.             #1 $display("A = %b , B = %b , Y = %b " , x_t , y_t , z_t );
  30.  
  31.         end
  32. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement