Digital Logic Structure
Digital Logic Structure
Chapter 3
© 2020 McGraw Hill. All rights reserved. Authorized only for instructor use in the classroom.
No reproduction or further distribution permitted without the prior written consent of McGraw Hill.
Transistor: Building Block of Computers
© McGraw Hill 2
A Simple Switch Circuit
A wall switch determines whether current flows through the light bulb.
If switch is closed, current flows, lamp is ON, voltage across lamp is non-zero.
If switch is open, no current flows, lamp is OFF, voltage across lamp is zero.
© McGraw Hill 3
Transistor = Voltage-Controlled Switch 1
© McGraw Hill 4
Transistor = Voltage-Controlled Switch 2
Consider the circuit below. The bar at the top represents the high voltage rail
(+1.2V) and the triangle at the bottom represents ground (0V).
© McGraw Hill 5
Transistor = Voltage-Controlled Switch 3
© McGraw Hill 6
Logic Gate
A logic gate is a circuit that transforms binary input signals into a single
binary output signal. Signals are voltages.
© McGraw Hill 7
NOT Gate (Inverter)
Example:
When input = 0, P-type transistor
turns on and N-type transistor
turns off. Output is connected to
+1.2V, so output = 1.
Input Output
0 1
1 0
© McGraw Hill 8
NOR Gate
A B C
0 0 1
0 1 0
1 0 0
1 1 0
© McGraw Hill 9
OR Gate
A B C D
0 0 1 0
0 1 0 1
1 0 0 1
1 1 0 1
© McGraw Hill 10
Why do we need NOT after NOR?
Why can't we simply put the P-type on the bottom and the N-type on top?
(b) A B C
0 volts 0 volts 1.0 volts
0 volts 1.2 volts 0.7 volts
1.2 volts 0 volts 0.7 volts
1.2 volts 1.2 volts 0.7 volts
© McGraw Hill 11
NAND and AND Gates
A B D
0 0 0
0 1 0 AND
1 0 0
1 1 1
© McGraw Hill 12
Standard Symbols for Logic Gates
Instead of drawing the circuit diagram, we can abstract these logic gates
and give each a symbol. The bubble indicates inversion (NOT).
© McGraw Hill 13
Gates with more than one input
(a) A B C OUT
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
Challenge: Draw the CMOS circuit
1 0 1 0 for a 3-input AND gate.
1 1 0 0
1 1 1 1
Access the text alternative for slide images.
© McGraw Hill 14
Building Logic Circuits from Gates
To build more complex logic functions, we create circuits using the basic
logic gates.
© McGraw Hill 15
Combinational Logic Circuits
© McGraw Hill 16
Decoder
2-bit decoder
© McGraw Hill 17
Multiplexer (Mux)
4-to-1 mux
4 input bits,
2 select bits
© McGraw Hill 18
Full Adder (1-bit binary addition)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Access the text alternative for slide images.
© McGraw Hill 19
N-bit Adder
Feed Cout from one bit into Cin of the next bit...
© McGraw Hill 20
Logical Completeness
Can implement any truth table using only AND, OR, and NOT.
See process below. This may not create the best circuit, but it will result in
a correct circuit. (Optimizing circuits is for another class...)
A B C D
0 0 0 0
1. AND combinations
0 0 1 0
that yield a "1" in the
0 1 0 1 truth table. (Invert
0 1 1 0 inputs as needed.)
1 0 0 0
2. OR the results of
1 0 1 1
the AND gates.
1 1 0 0
1 1 1 0
© McGraw Hill 21
Sequential Logic Circuits
© McGraw Hill 22
Storing One Bit: R-S Latch
© McGraw Hill 23
Clearing the latch: R = 0
© McGraw Hill 24
Setting the latch: S = 0
© McGraw Hill 25
R-S Latch Summary
R=S=1
R S Q'
Hold current value in latch 0 0 illegal
R = 0, S = 1 0 1 0
Clear/reset latch (value = 0) 1 0 1
1 1 Q
R = 0, S = 1
Set latch (value = 1) Q' is output. Q is previous output.
What about R = 0, S = 0?
Both outputs = 1, final state determined by electrical properties of the gates.
Don't do it!!! This set of inputs is prohibited and should never occur during the
operation of the latch.
© McGraw Hill 26
D-Latch: Simpler Control for One-Bit Latch
NOTE: This uses an R-S latch. R and S will never both be zero.
Access the text alternative for slide images.
© McGraw Hill 27
The Concept of Memory 1
Address Space:
number of locations
(usually a power of 2)
Addressability:
number of bits per location (for
example, byte-addressable)
© McGraw Hill 28
The Concept of Memory 2
© McGraw Hill 29
A Memory Circuit
© McGraw Hill 30
Example: Reading Address 3 of a 4×3 memory
© McGraw Hill 31
Notation: Mult-bit values
© McGraw Hill 32
More Info about Memory
© McGraw Hill 33
Sequential Logic Circuit: Finite State Machine
© McGraw Hill 34
What is State?
The state of a system is a snapshot of all the relevant data that describes
the system.
© McGraw Hill 35
Example: A Combination Lock
Four States:
A: The lock is not open, and no relevant operations have been performed.
B: The lock is not open, and the user has completed the R-13 operation.
C: The lock is not open, and the user has completed R-13, followed by L-
22.
D: The lock is open. (User completed R-13, L-22, and R-3.)
© McGraw Hill 36
State Diagram
© McGraw Hill 37
Finite State Machine: Definition
© McGraw Hill 38
Another Example: Drink Machine
Suppose you have an old drink machine that accepts nickels and dimes.
Inserting 15 cents will unlock the drink dispenser.
© McGraw Hill 39
Synchronous versus Asynchronous
In examples so far, no fixed notion of time. User can wait any amount of
time between inputs. This is an asynchronous system. The inputs
happen whenever they happen...
In a synchronous system, state transitions happen at fixed time
intervals. At each interval, the input and state determine the transition.
A clock signal is used to trigger the state transitions. For example, a
transition happens whenever the clock changes from 0 to 1.
© McGraw Hill 40
Implementing a Finite State Machine
Combinational Logic -- given current state and input, what is the next
state and output?
Storage Elements -- stores state bits until next cycle
© McGraw Hill 41
FSM Example: Danger Sign
1. No lights
2. 1 and 2 on.
3. 1, 2, 3, and 4 on.
4. 1, 2, 3, 4, and 5 on.
© McGraw Hill 42
Danger Sign: State Diagram
© McGraw Hill 43
Danger Sign: Implementation
Given current state,
what should outputs be?
© McGraw Hill 44
Danger Sign: Truth Tables
© McGraw Hill 45
Danger Sign: Combinational Logic
© McGraw Hill 46
Storage Elements: D-Latch?
© McGraw Hill 47
Storage Elements: Flip-flop
A flip-flop uses two latches to separate the reading phase and the writing
phase of the clock cycle.
When Clock = 0 (write phase), new data (D) When Clock = 1 (read phase),
is stored in the Master latch, but output (Q) data from Master is stored into the
does not change. Slave and the output (Q) changes
to the new value.
© McGraw Hill 48
Timing Diagram
As long as worst-case propagation delay through the logic is less than half of the
clock cycle, state will properly change each clock cycle.
Because of this behavior, flip-flop is considered an edge-triggered storage
element: its state changes on the clock edge. A latch is level-triggered, because it
changes as long as the WE signal is enabled.
© McGraw Hill 49
FSM Summary
State diagram, truth tables, and circuit are three different representations
of the state machine. Given one, can easily derive the other two.
© McGraw Hill 50
Preview: LC-3 Data Path
© McGraw Hill 51
Because learning changes everything. ®
www.mheducation.com
© 2020 McGraw Hill. All rights reserved. Authorized only for instructor use in the classroom.
No reproduction or further distribution permitted without the prior written consent of McGraw Hill.