Advertisement
Holey_yan

20141002_KUAS_Verilog_FullAdder(GateLevel)

Oct 17th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************/
  2. /** 20141002 Full Adder (Use Gate Level) **/
  3. /** Maker  : Yan                         **/
  4. /** E-Mail : ssas1115577@gmail.com       **/
  5. /** Date   : 2014/10/02 pm.10:05         **/
  6. /******************************************/
  7.  
  8. module FullAdder(input1, input2, carryIn, sum, carryOut);
  9.     input       input1, input2, carryIn;
  10.     output      sum, carryOut;
  11.     wire        w1, w2, w3;
  12.    
  13.     HalfAdder   tmp1(.input1(input1), .input2(input2), .sum(w1), .carryOut(w2));
  14.     HalfAdder   tmp2(.input1(w1), .input2(carryIn), .sum(sum), .carryOut(w3));
  15.    
  16.     or      (carryOut, w2, w3);
  17. endmodule
  18.  
  19. module HalfAdder(input1, input2, sum, carryOut);
  20.     input       input1, input2;
  21.     output      sum, carryOut;
  22.    
  23.     xor     (sum, input1, input2);
  24.     and     (carryOut, input1, input2);
  25. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement