Professional Documents
Culture Documents
Logic Design 1
Let's make a 1-bit adder (half adder) we can think of it as a Boolean function with two
inputs and the following defining table:
A
B
Sum
0
Logic Design 2
The carry-out value from the 1-bit sum can also be expressed via a truth table.
However, the result won't be terribly useful unless we also take into account a carry-in.
A
Cin
Sum
Cout
= A B Cin + A B Cin + A B
= B C + AC + A B
Logic Design 3
The expressions for the sum and carry lead to the following unified implementation:
Sum = A B Cin + A B Cin
+ A B Cin + A B Cin
Carry = B C + A C + A B
LogiSim Implementation
Logic Design 4
Logic Design 5
Logic Design 6
Carry = B C + A C + A B
Logic Design 7
This has one serious shortcoming. The carry bits must ripple
from top to bottom, creating a lag before the result will be
obtained for the final sum bit and carry.
Computer Science Dept Va Tech March 2006
Logic Design 8
We know that every Boolean function can be expressed in sum-of-products form, and it is
obvious that a sum-of-products form can be implemented with two levels of logic, the
first consisting of AND gates and the second of OR gates.
A programmable logic array (PLA) is a structured logic element consisting of a set of N
inputs (and corresponding input complements), and two stages of logic the first generating
P product terms of the inputs and the second generating S sums of the product terms.
...
AND array
...
...
OR array
PLA Example
Logic Design 9
Consider the collection of Boolean functions defined by the following truth table:
Inputs
Functions
Since there are 7 rows in which at least one function is 1, we will need 7 AND gates.
We will need an OR gate to form the output for each function.
PLA Example
Logic Design 10
Logic Design 11
A read-only-memory (ROM) is a decoder-like circuit that takes n bits as input and selects
one of 2n k-bit sequences as its output.
The shape of the ROM is its height, which is 2n, and its width, which is k.
A ROM exactly encodes a truth table.
A ROM is generally larger than the equivalent PLA.
32
Logic Design 12
1-bit full
adder
The multiplexor is used to select the desired function the ALU will perform.
Additional features can be incorporated fairly easily.
Logic Design 13
Logic Design 14
As we saw earlier with the adder, we can chain 1-bit ALUs together to produce an ALU
for any width input we desire.
A 4-bit ALU
Logic Design 15
Logic Design 16
To support conditional branch we need the slt instruction, and a way to test whether the
inputs are equal (or non-equal). This can be added fairly trivially:
InvA
InvB
FnSel
ALU Fn
00
AND
01
OR
10
add
10
sub
11
slt
00
NOR
Logic Design 17
From the user perspective, the ALU may be considered as a black box with a relatively
simple interface:
InvA
InvB
FnSel
ALU Fn
00
AND
01
OR
10
add
10
sub
11
slt
00
NOR