Week 1
Combinational Circuits – The Half Adder
COS10004 Computer Systems · Lecture 1.6 Combinational Circuits - The Half Adder
COMBINATIONAL CIRCUIT
- A combinational circuit is a connected arrangement of logic gates with the set of inputs and outputs.
- A combinational circuit can be described by a truth table showing the binary relationship between n input variables and m output variables.
- Two examples: half adder, full adder
- These circuits serve as basic building blocks for the construction of more complicated arithmetic circuits.
BINARY ADDITION
- Consider: 0 1 0 1 1 1 0 + 0 0 1 1 1 0 0 0 1 1 1 1 0 0 carry
_______________________
1 0 0 1 0 1 0
- We need 1-bit adders…
HALF-ADDER
- The most basic arithmetic circuit is the addition of two binary digits.
- A combinational circuit that performs the arithmetic addition of two bits is called a half-adder.
- It consists of two inputs and two outputs:
- Two inputs get summed
- Two outputs: sum and carry bits + 1 is binary 10, which has two digits.
A half-adder
Input X Sum S
Half adder Input Y Carry out Co
X Y S Co The plus-circle 0 0 0 0 (modulo addition 0 1 1 0 of 1-bit values) 1 0 1 0 means XOR, 1 1 0 1 the dot means AND
S = X ⊕ Y Co = X •Y
Half-adder
The XOR gate calculates the sum
The AND gate calculates the carry
FULL-ADDER
- A full-adder is a combination circuit that forms the arithmetic sum of three input bits.
- It consists of three inputs and two outputs.
- Two of the inputs represent the two bits to be added.
- The third input represents the carry from the previous lower significant position.
- One of the outputs will be the carry into the next higher significant position, i.e. into the next full adder.
- Of course two output bits are necessary because the arithmetic sum of three binary digits ranges from 0 to 3, and 2 and 3 need two bits.
A full adder
Input X Sum S
Input Y Full adder Carry in Ci Carry out Co
Ci X Y S Co
a 0 0 0 0 0 b 0 0 1 1 S = X ⊕ Y 0 Co = X • Y c 0 1 0 1 0 d 0 1 1 0 1 e 1 0 0 1 0 f 1 0 1 0 S = X ⊕ Y 1 Co = X + Y g 1 1 0 0 1 h 1 1 1 1 1
A full adder
- We could make this from two half-adders:
Counts how many buttons are on in binary!
0 + 1 + 1 = 10
Time to Imagine
- A full-adder is a combination circuit that forms the arithmetic sum of three input bits.
- Suppose we added a second full adder (A2) to the output of the first adder (A1), and connected the Ci pin of A2 to Co of A1?
- Wouldn't we be able to add two 2-bit numbers?
- A 3rd adder?
- A 4th....
Multi bit addition – combine 8 adders with carry to get 8-bit addition (of two 8-bit
numbers).
Sn S2 S1 S0 C0 C0
Carry
full full full ½ adder adder adder adder
Y X Ci Ci Ci
n n Y2 X2 Y1 X1 Y0 X0
In the Lab...
- Play with Gates (in a “sim”) and construct truth tables.
- Design a half adder
- I made some video tutorials that might also help:
- Logisim introduction: https://youtu.be/fwPw28O5ORI
- Half-adder tutorial: https://youtu.be/BpvlMgb40U4
- Full-adder tutorial: https://youtu.be/1qLAk0AsH40
- Computer Systems:
- We’re building a computer up conceptually!
- Get your Pi and hardware
- Check Canvas regularly
- Information and bits
- Digital Circuit Design:
- Gates, Half-Adders and Full-Adders
- Next week: more complex circuits and Flip Flops (memory)!