Advertisement
Holey_yan

20141002_KUAS_Verilog_FullAdder_4Bit(DataFlow)

Oct 17th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /***********************************************/
  2. /** 20141002 4-Bit Full Adder (Use Data Flow) **/
  3. /** Maker  : Yan                              **/
  4. /** E-Mail : ssas1115577@gmail.com            **/
  5. /** Date   : 2014/10/02 pm.10:45              **/
  6. /***********************************************/
  7.  
  8. module FullAdder_4Bit(input1, input2, carryIn, sum, carryOut);
  9.     input       [3:0]   input1, input2;
  10.     input       carryIn;
  11.     output      [3:0]   sum;
  12.     output      carryOut;
  13.    
  14.     FullAdder_EightBit  #4  tmp1(.input1(input1), .input2(input2), .carryIn(carryIn), .sum(sum), .carryOut(carryOut));
  15. endmodule
  16.  
  17. module FullAdder_EightBit(input1, input2, carryIn, sum, carryOut);
  18.     parameter   BitLenght = 8;
  19.     input       [BitLenght - 1 : 0] input1, input2;
  20.     input       carryIn;
  21.     output      [BitLenght - 1 : 0] sum;
  22.     output      carryOut;
  23.    
  24.     assign  {carryOut, sum} = input1 + input2 + carryIn;
  25. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement