Well I remade my gates as well as fixed my XOR gate yet again (It's finally working) and I put them all together into a make shift 4 bit adder. What it does is allows the user to input bits into the adder denoted by A and B for each 1 bit adder, and then depending if there is a carry it will carry the carry bit into the next adder until all 4 bits are added.
Lets break this down by looking at one of the full-adder gates. You have two inputs A and B and a CARRY, lets say A = 1, B = 0, CARRY = 1. A and B first XOR gate, and being the way XOR works(same inputs output 0, different inputs output 1), our gate outputs 1. This out then goes into another XOR gate along with our CARRY bit. Since the output was 1 and the CARRY was 1 this XOR gate outputs 0. Directly below the second XOR gate is a AND gate. It takes our output from our first XOR gate (1) as well as our CARRY bit, and the way AND works is if the bits are 1,1 it outputs 1, if they are not they output 0. In this case since our output was 1 and our CARRY bit is 1 this AND gate outputs 1. Below the AND gate is a second AND gate which takes our A and B inputs and puts them into the gate. Since A was 1 and B was 0, this gate outputs 0. Finally to the right of the AND gates is an OR gate. If any input of an OR gate is 1, it will output 1, so in this case we sent it 1 and 0 causing it to output 1.
So when adding 1 + 0 + 1CARRY, this full-adder outputted 1 and the CARRY flag meaning the sum was to large for it to fully calculate.
Here are some examples of what a single full-adder will produce with given inputs (if my math is correct its late :< ) C being input carry, A being first bit, B being second bit, O being output sum, OC being output carry:
Code
C 0 0 0 0 1 1 1 1
A 0 0 1 1 0 0 1 1
B 0 1 0 1 0 1 0 1
----------------------------
O 0 1 1 0 1 0 0 1
OC 0 0 0 1 0 1 1 1
String these together via chaining the carry bits to each other and you can make a fairly decent ALU for adding.
This post was edited by AbDuCt on Feb 21 2014 04:26am