Lecture01_Intro
Lecture01_Intro
Introduction
2
What will we learn in this class? (1/2)
3
What will we learn in this class? (2/2)
4
Applications of logic design
◼ Embedded products
❑ in cars, toys, appliances, entertainment devices
◼ Scientific equipment
❑ testing, sensing, reporting
5
Global processor/controller market
6
What is logic design? (1/2)
◼ Logic design is to design digital hardware
❑ Digital hardware consists of components
sense 9
Computation: abstract vs. implementation
sequential statements: A; B; C
conditionals: if x == 1 then y
loops: for ( i = 1 ; i == 10, i++)
procedures: A; proc(...); B;
◼ We will study how each of these are implemented in hardware
and composed into computational structures
10
Switches: basic element of physical
implementations
◼ Implementing a simple circuit
A Z
close switch (if A is “1” or asserted)
and turn on light bulb (Z)
Z
A
open switch (if A is “0” or unasserted)
and turn off light bulb (Z)
Z A
11
Switches (cont’d)
A B
AND
Z A and B
A
OR
Z A or B
12
Switching networks
◼ Switch settings
❑ determine whether or not a conducting path exists to light
the light bulb
◼ To build larger computations
❑ use a light bulb (output of the network) to set other switches
(inputs to another network).
◼ Connect together switching networks
❑ to construct larger switching networks, i.e., there is a way to
connect outputs of one network to the inputs of the next.
13
A switch?
◼ A mechanical switch
14
Transistor networks
15
n-channel (or n-type) MOS (nMOS) circuit
n+ n+
p bulk Si
p+ p+
n bulk Si
17
MOS transistors
S D S D
n-channel p-channel
open when voltage at G is low closed when voltage at G is low
closed when voltage at G is high open when voltage at G is high
18
MOS networks
X what is the
relationship
between x and y?
3v x y
Y 0 volts 3 volts
0v 3 volts 0 volts
X Y
0v
20
Three input NAND gate
21
Digital vs. analog
22
Combinational logic symbols
A Z
❑ AND, NAND
A
Z easy to implement
B with CMOS transistors
(the switches we have
❑ OR, NOR available and use most)
A
Z
B
23
Combinational vs. sequential digital circuits
◼ Sequential systems
❑ exhibit behaviors (output values) that depend not only
on the current input values, but also on previous input values
24
Combinational vs. sequential digital circuits
In Out
Logic Logic
In Out
Circuit Circuit
State
25
Example of combinational and sequential logic
◼ Combinational:
❑ input A, B
❑ wait for clock edge
A
❑ observe C C
B
❑ wait for another clock edge
❑ observe C again: will stay the same Clock
◼ Sequential:
❑ input A, B
❑ wait for clock edge
❑ observe C
❑ wait for another clock edge
❑ observe C again: may be different
26
Intermediate Summary
◼ Some we've seen already
❑ digital interpretation of analog values
❑ transistors as switches
❑ switches as logic gates
❑ use of a clock to realize a synchronous sequential circuit
◼ Some others we will see
❑ truth tables and Boolean algebra to represent combinational logic
❑ encoding of signals with more than two logical values into
binary form
❑ state diagrams to represent sequential logic
❑ hardware description languages to represent digital logic
❑ waveforms to represent temporal behavior
27
An example
28
Implementation in software
29
Implementation as a combinational digital system
◼ Encoding:
❑ how many bits for each input/output?
Don’t
❑ binary number for month care
❑ four wires for 28, 29, 30, and 31
month leap d28 d29 d30 d31
◼ Behavior: 0000 – – – – –
0001 – 0 0 0 1
❑ combinational 0010 0 1 0 0 0
0010 1 0 1 0 0
❑ truth table 0011 – 0 0 0 1
0100 – 0 0 1 0
specification month leap 0101 – 0 0 0 1
0110 – 0 0 1 0
0111 – 0 0 0 1
1000 – 0 0 0 1
1001 – 0 0 1 0
1010 – 0 0 0 1
1011 – 0 0 1 0
1100 – 0 0 0 1
1101 – – – – –
d28 d29 d30 d31 111– – – – – –
30
Combinational example (cont’d)
32
Combinational example (cont’d)
◼ d28 = m8'•m4'•m2•m1'•leap’
◼ d29 = m8'•m4'•m2•m1'•leap
◼ d30 = (m8'•m4•m2'•m1') + (m8'•m4•m2•m1') +
(m8•m4'•m2'•m1) + (m8•m4'•m2•m1)
◼ d31 = (m8'•m4'•m2'•m1) + (m8'•m4'•m2•m1) +
(m8'•m4•m2'•m1) + (m8'•m4•m2•m1) +
(m8•m4'•m2'•m1') + (m8•m4'•m2•m1') +
(m8•m4•m2'•m1')
33
Summary of Combinational Circuit Design
◼ Step 3: Implementation
34
Another example (Door combination lock)
35
Implementation in software
integer combination_lock ( ) {
integer v1, v2, v3;
integer error = 0;
static integer c[3] = 3, 4, 2;
36
Implementation as a sequential digital system
new value reset
◼ Encoding:
❑ how many bits per input value? state
clock
❑ how many values in sequence?
❑ how do we know a new input value is entered?
open/closed
❑ how do we represent the states of the system?
◼ Behavior:
❑ clock wire tells us when it’s ok
to look at inputs
(i.e., they have settled after change)
❑ sequential: sequence of values
must be entered
❑ sequential: remember if an error occurred
❑ finite-state specification
37
Sequential example (cont’d): abstract control
◼ Finite-state diagram
❑ states: 5 states
• represent point in execution of machine
• each state has inputs and outputs
❑ transitions: 6 from state to state, 5 self transitions, 1 global
• changes of state occur when clock says it’s ok
ERR
• based on value of inputs
closed
❑ inputs: reset, new, results of comparisons
❑ output: open/closed C1!=value
C2!=value C3!=value
& new
& new & new
S1 S2 S3 OPEN
reset closed closed closed open
C1=value C2=value C3=value
& new & new & new
38
Sequential example (cont’d): data-path vs. control
◼ Internal structure
❑ data-path ❑ control
• storage for combination • finite-state machine controller
• comparators • control for data-path
• state changes controlled by clock
equal open/closed
* Multiplexer (MUX)
39
Sequential example (cont’d): FSM
ERR
closed
40
Sequential example (cont’d): FSM
ERR
◼ Finite-state machine closed
❑ generate state table (much like a truth-table) not equal not equal not equal
& new & new & new
S1 S2 S3 OPEN
closed closed closed
reset open
mux=C1 equal mux=C2 equal mux=C3 equal
& new & new & new
42
Sequential example (cont’d): encoding
◼ Encode state table
❑ state can be: S1, S2, S3, OPEN, or ERR
• choose 4 bits: 0001, 0010, 0100, 1000, 0000 Internal
input
❑ output mux can be: C1, C2, or C3 system’s
• choose 3 bits: 001, 010, 100 Internal or external
❑ output open/closed can be: open or closed output output
• choose 1 bits: 1, 0
next
reset new equal state state mux open/closed
1 – – – 0001 001 0
external 0 0 – 0001 0001 001 0
input 0 1 0 0001 0000 – 0 good choice of encoding!
0 1 1 0001 0010 010 0
0 0 – 0010 0010 010 0 mux is identical to
0 1 0 0010 0000 – 0 last 3 bits of next state
0 1 1 0010 0100 100 0
0 0 – 0100 0100 100 0 open/closed is
0 1 0 0100 0000 – 0 identical to first bit
0 1 1 0100 1000 – 1 of next state
0 – – 1000 1000 – 1
0 – – 0000 0000 – 0
43
Sequential example (cont’d): controller
implementation
◼ Implementation of the controller
special circuit element, called a register, for
mux
control controller new equal reset
clock
mux
comb. logic
open/closed control
state clock
open/closed
44
Sequential Circuit Design hierarchy
system
data-path control
register logic
switching
networks
45
Summary of Sequential Circuit Design
◼ Step 5: Implementation
46
Terminologies
SYSTEM
MODULE
+
GATE
CIRCUIT
DEVICE
G
S D
n+ n+
47
Summary
48