🔌
nand2tetris
  • Introduction
  • Combinational Chips
    • Nand Gate
    • Not Gate
    • And Gate
    • Or Gate
    • Xor Gate
    • Multiplexor Chip
    • Demultiplexor Chip
    • Not16 Chip
    • And16 Chip
    • Or16 Chip
    • Mux16 Chip
    • Or8Way Chip
    • Mux4Way16 Chip
    • Mux8Way16 Chip
    • DMux4Way Chip
    • DMux8Way Chip
    • Half Adder Chip
    • Full Adder Chip
    • Add16 Chip
    • Inc16 Chip
    • Half Subtractor Chip
    • Full Subtractor Chip
    • Subtract16 Chip
    • Dec16 Chip
    • Arithmetic Chip
    • ALU
  • Misc
    • Int2Bool
    • Bool2Int
    • Arrayto16
Powered by GitBook
On this page
  • Full Adder Chip
  • Implementation of Full Adder Chip in HDL
  • Implementation of Full Adder Chip in Java™
  1. Combinational Chips

Full Adder Chip

Abstraction and Implementation of Full Adder Chip in Hardware Design Language and Java™.

PreviousHalf Adder ChipNextAdd16 Chip

Last updated 3 years ago

Full Adder Chip

Full Adder chip is used to add 3-bits.

Chip name: FullAdder
Inputs: a, b, c
Outputs: sum, carry
Function: sum = LSB of a + b + c
          carry = MSB of a + b + c

Implementation of Full Adder Chip in HDL

The function in the above abstraction can help in the implementation of Full Adder Chip.

You can use the Half Adder Chip you've built earlier.l

sum = a XOR b XOR c

carry = (a AND b) OR (b AND c) OR (c AND a)

CHIP FullAdder {
    IN a, b, c;  // 1-bit inputs
    OUT sum,     // Right bit of a + b + c
        carry;   // Left bit of a + b + c

    PARTS:
    HalfAdder(a=a, b=b, sum=sumab, carry=carryab);
    HalfAdder(a=sumab, b=c, sum=sum, carry=temp);
    Or(a=temp, b=carryab, out=carry);
}

Implementation of Full Adder Chip in Java™

Similar to the Implementation in HDL

package CombChips;

class FullAdder_Gate extends HalfAdder_Gate {

    protected static int[] FullAdder(int a, int b, int c) {
        int[] out = new int[2];

        int[] ab = HalfAdder(a, b);
        int[] temp = HalfAdder(ab[0], c);
        int carry = Or_Gate.Or(temp[1], ab[1]);

        out[0] = temp[0];
        out[1] = carry;

        return out;
    }
}
Abstraction of Full Adder Chip - Representation and Truth Table