Lecture02 Digital Design
Lecture02 Digital Design
Architecture
Anton Burtsev
April, 2021
Digital Design Basics
• Two voltage levels – high and low (1 and 0, true and false)
Hence, the use of binary arithmetic/logic in all computers
V V
0 V
V Conducting 0 Non-conducting
0 0
2
Logic Blocks
3
Truth Table
A B C E
4
Truth Table
A B C E
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1 Can be compressed by only
1 1 0 1
representing cases that
1 1 1 0
have an output of 1
5
Boolean Algebra
6
Boolean Algebra Rules
• Identity law : A + 0 = A ; A . 1 = A
• Inverse laws : A . A = 0 ; A + A = 1
• Commutative laws : A + B = B + A ; A . B = B . A
• Associative laws : A + (B + C) = (A + B) + C
A . (B . C) = (A . B) . C
• Distributive laws : A . (B + C) = (A . B) + (A . C)
A + (B . C) = (A + B) . (A + C)
7
DeMorgan’s Laws
• A+B=A.B
• A.B = A+B
8
Logic for common arithmetic operations
Simple ALU
Pictorial Representations
AND OR NOT
10
Boolean Equation
11
Sum of Products
• Can represent any logic block with the AND, OR, NOT operators
Draw the truth table
For each true output, represent the corresponding inputs
as a product
The final equation is a sum of these products
A B C E
0 0 0 0
0 0 1 0 (A . B . C) + (A . C . B) + (C . B . A)
0 1 0 0
0 1 1 1 • Can also use “product of sums”
1 0 0 0
• Any equation can be implemented
1 0 1 1
1 1 0 1 with an array of ANDs, followed by
1 1 1 0 an array of ORs
12
NAND and NOR
13
Common Logic Blocks – Decoder
I0 I1 I2 O 0 O 1 O 2 O3 O4 O 5 O 6 O7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
15
Adder Algorithm
1 0 0 1
0 1 0 1
Sum 1 1 1 0
Carry 0 0 0 1
1 0 0 1
0 1 0 1
Sum 1 1 1 0 Equations:
Carry 0 0 0 1 Sum = Cin . A . B +
B . Cin . A +
A . Cin . B +
Truth Table for the above operations: A . B . Cin
Equations:
Sum = Cin . A . B +
B . Cin . A +
A . Cin . B +
A . B . Cin
Cout = A . B . Cin +
A . B . Cin +
A . Cin . B +
B . Cin . A
=A.B +
A . Cin +
Source: H&P textbook B . Cin
1-Bit ALU with Add, Or, And
20
Source: H&P textbook
Incorporating Subtraction
21
Incorporating NOR and NAND
22
Source: H&P textbook
Incorporating cmp (set bit when less than)
23
Source: H&P textbook
Incorporating cmp (set bit when less than)
24
Source: H&P textbook
Incorporating jeq (jump when equal)
• Perform a – b and
confirm that the
result is all zero’s
25
Source: H&P textbook
Control Lines
Ai Bn Op
AND 0 0 00
OR 0 0 01
Add 0 0 10
Sub 0 1 10
SLT 0 1 11
NOR 1 1 00
• The carry propagates thru every 1-bit box: each 1-bit box sequentially
implements AND and OR – total delay is the time to go through 64 gates!
• We’ve already seen that any logic equation can be expressed as the
sum of products – so it should be possible to compute the result by
going through only 2 gates!
• Caveat: need many parallel gates and each gate may have a very
large number of inputs – it is difficult to efficiently build such large
gates, so we’ll find a compromise:
moderate number of gates
moderate number of inputs to each gate
moderate number of sequential gates traversed
28
Clocks
●
A microprocessor is composed of many different circuits that
are operating simultaneously – if each circuit X takes ininputs
at time TIX, takes time TEX to execute the logic, and produces
outputs at time TOX, imagine the complications in co-
ordinating the tasks of every circuit
●
A major school of thought (used in most processors built
today): all circuits on the chip share a clock signal (a square
wave) that tells every circuit when to accept inputs, how much
time they have to execute the logic, and when they must
produce outputs
29
Clock Terminology
Cycle time
30
Sequential Circuits
●
Until now, circuits were combinational – when inputs
change, the outputs change after a while (time =
logic delay thru circuit)
●
We want the clock to act like a start and stop signal – a “latch”
is a storage device that separates these circuits – it ensures
that the inputs to the circuit do not change during a clock cycle
Clock Clock
• This state will not change for an entire cycle (until next rising edge)
• Some of the outputs (for example, the value of next “state”) may feed
back (but through the latch so they’re only seen in the next cycle)
32
Sequential circuits
Designing a Latch
34
Source: H&P textbook
D Latch
• Incorporates a clock
• The value of the input D signal (data) is stored only when the clock
is high – the previous state is preserved when the clock is low
35
Source: H&P textbook
D Flip Flop
• Terminology:
Latch: outputs can change any time the clock is high (asserted)
Flip flop: outputs can change only on a clock edge
●
We want the clock to act like a start and stop signal – a “latch”
is a storage device that separates these circuits – it ensures
that the inputs to the circuit do not change during a clock cycle
Clock Clock
Next
Current Next-state state
Clock Function
State
Output Outputs
Inputs
Function
39
State Diagrams
D=0 D=1
This is a state diagram for ___?
D=1
0 0 1 1
D=0
40
3-Bit Counter
41
3-Bit Counter
42