Why Study Logic Design?: Obvious Reasons
Why Study Logic Design?: Obvious Reasons
Obvious reasons
this course is part of the CS/CompE requirements it is the implementation basis for all modern computing devices
building large things from small components provide a model of how a computer works
the inherent parallelism in hardware is often our first exposure to parallel computation it offers an interesting counterpoint to software design and is therefore useful in furthering our understanding of computation, in general
I - Introduction
hardware description languages tools to simulate the workings of our designs logic compilers to synthesize the hardware blocks of our designs mapping onto programmable hardware
sequential and parallel implementations specify algorithm as well as computing/storage resources it will use
Copyright 2004, Gaetano Borriello and Randy H. Katz 2
I - Introduction
Embedded products
Scientific equipment
I - Introduction
maps logical propositions to symbols permits manipulation of logic statements using mathematics his Masters thesis its switching elements are vacuum tubes (a big advance from relays) 18,000 vacuum tubes several hundred multiplications per minute replaces vacuum tubes enable integration of multiple devices into one package gateway to modern electronics
1945: John von Neumann develops the first stored program computer
I - Introduction
What is design?
given a specification of a problem, come up with a way of solving it choosing appropriately from a collection of available components while meeting some criteria for size, cost, power, beauty, elegance, etc.
determining the collection of digital logic components to perform a specified control and/or data manipulation and/or communication function and the interconnections between them which logic components to choose? there are many implementation technologies (e.g., off-the-shelf fixed-function components, programmable devices, transistors on a chip, etc.) the design may need to be optimized and/or transformed to meet design constraints
Copyright 2004, Gaetano Borriello and Randy H. Katz 5
I - Introduction
Collection of devices that sense and/or control wires that carry a digital value (i.e., a physical quantity that can be interpreted as a 0 or 1)
example: digital logic where voltage < 0.8v is a 0 and > 2.0v is a 1 example: pair of transmission wires where a 0 or 1 is distinguished by which wire has a higher voltage (differential) example: orientation of magnetization signifies a 0 or a 1 logic computation devices (sense and drive)
are two wires both 1 - make another be 1 (AND) is at least one of two wires 1 - make another be 1 (OR) is a wire 1 - then make another be 0 (NOT)
sense
AND
drive
6
I - Introduction
larger and larger designs shorter and shorter time to market cheaper and cheaper products
pervasive use of computer-aided design tools over hand methods multiple levels of design representation emphasis on abstract design representations programmable rather than fixed function components automatic synthesis techniques importance of sound design methodologies higher levels of integration use of simulation to debug designs simulate and verify before you build
Copyright 2004, Gaetano Borriello and Randy H. Katz 7
Scale
Time
Cost
I - Introduction
Understanding the basics of logic design (concepts) Understanding sound design methodologies (concepts) Modern specification methods (concepts) Familiarity with a full set of CAD tools (skills) Realize digital designs in an implementation technology (skills) Appreciation for the differences and similarities (abilities) in hardware and software design
New ability: to accomplish the logic design task with the aid of computer-aided design tools and map a problem description into an implementation with programmable logic devices after validation via simulation and understanding of the advantages/disadvantages as compared to a software implementation
I - Introduction Copyright 2004, Gaetano Borriello and Randy H. Katz 8
Up to now, computation has been a mental exercise (paper, programs) This class is about physically implementing computation using physical devices that use voltages to represent logical values Basic units of computation are:
representation: assignment: data operations: control: sequential statements: conditionals: loops: procedures:
"0", "1" on a wire set of wires (e.g., for binary ints) x = y x+y5 A; B; C if x == 1 then y for ( i = 1 ; i == 10, i++) A; proc(...); B;
We will study how each of these are implemented in hardware and composed into computational structures
Copyright 2004, Gaetano Borriello and Randy H. Katz 9
I - Introduction
open switch (if A is 0 or unasserted) and turn off light bulb (Z)
Z A
I - Introduction Copyright 2004, Gaetano Borriello and Randy H. Katz 10
Switches (contd)
B
Z A and B
A OR Z A or B
I - Introduction
11
Switching networks
Switch settings
determine whether or not a conducting path exists to light the light bulb
use a light bulb (output of the network) to set other switches (inputs to another network). to construct larger switching networks, i.e., there is a way to connect outputs of one network to the inputs of the next.
I - Introduction
12
Relay networks
A simple way to convert between conducting paths and switch settings is to use (electro-mechanical) relays. What is a relay?
conducting path composed of switches closes circuit current flowing through coil magnetizes core and causes normally closed (nc) contact to be pulled open
when no current flows, the spring of the contact returns it to its normal position
Transistor networks
I - Introduction
14
MOS transistors
they act as switches in the following way: if the voltage on the gate terminal is (some amount) higher/lower than the source terminal then a conducting path will be established between the drain and source terminals
G G
n-channel open when voltage at G is low closes when: voltage(G) > voltage (S) +
p-channel closed when voltage at G is low opens when: voltage(G) < voltage (S)
I - Introduction
15
MOS networks
X 3v Y 0v
3 volts
I - Introduction
16
3v
Z2 0v
I - Introduction
0 volts
0 volts 0 volts NOR
3 volts 3 volts
0 volts
NAND
17
I - Introduction
18
Physical devices (transistors, relays) Switches Truth tables Boolean algebra Gates Waveforms Finite state behavior Register-transfer behavior Concurrent abstract specifications
I - Introduction
19
Convenient to think of digital systems as having only discrete, digital, input/output values In reality, real electronic components exhibit continuous, analog, behavior
switches operate this way easier to think about a small number of discrete values
I - Introduction
20
I - Introduction
21
a digital circuit is combinational if its output values only depend on its input values
I - Introduction
22
Common combinational logic systems have standard symbols called logic gates
Buffer, NOT
A Z
AND, NAND
A B Z
OR, NOR
A B Z
easy to implement with CMOS transistors (the switches we have available and use most)
I - Introduction
23
Sequential logic
Sequential systems
exhibit behaviors (output values) that depend not only on the current input values, but also on previous input values
because the outputs do not change instantaneously after an input change why not, and why is it then sequential?
look at the outputs only after sufficient time has elapsed for the system to make its required changes and settle down
I - Introduction
24
The steady-state abstraction is so useful that most designers use a form of it when constructing sequential circuits:
the memory of a system is represented as its state changes in system state are only allowed to occur at specific times controlled by an external periodic clock the clock period is the time that elapses between state changes it must be sufficiently long so that the system reaches a steady-state before the next state change at the end of the period
I - Introduction
25
Combinational:
input A, B wait for clock edge observe C wait for another clock edge observe C again: will stay the same
input A, B wait for clock edge observe C wait for another clock edge observe C again: may be different
A C B Clock
Sequential:
I - Introduction
26
Abstractions
digital interpretation of analog values transistors as switches switches as logic gates use of a clock to realize a synchronous sequential circuit
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
I - Introduction
27
An example
used in controlling the display of a wrist-watch LCD screen inputs: month, leap year flag outputs: number of days
I - Introduction
28
Implementation in software
integer number_of_days ( month, leap_year_flag) {
switch (month) {
case 1: return (31); case 2: if (leap_year_flag == 1) then return (29) else return (28); case 3: return (31); ... case 12: return (31); default: return (0);
I - Introduction
29
Encoding:
how many bits for each input/output? month binary number for month 0000 0001 four wires for 28, 29, 30, and 31 combinational truth table specification
0010 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 111
Behavior:
month
leap
leap 0 1
d28 0 1 0 0 0 0 0 0 0 0 0 0 0
d29 0 0 1 0 0 0 0 0 0 0 0 0 0
d30 0 0 0 0 1 0 1 0 0 1 0 1 0
d31 1 0 0 1 0 1 0 1 1 0 1 0 1
30
d31 = 1 when month=0001 or month=0011 or ... month=1100 d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) + ... (m8m4m2'm1') month leap d28 d29 d30 d31 d31 = can we simplify more? 0001 0 0 0 1
symbol for and symbol for or
0010 0010 0011 0100 ... 1100 1101 111 0000 0 1 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
1
31
I - Introduction
d28 = m8'm4'm2m1'leap d29 = m8'm4'm2m1'leap d30 = (m8'm4m2'm1') + (m8'm4m2m1') + (m8m4'm2'm1) + (m8m4'm2m1) = (m8'm4m1') + (m8m4'm1) d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) + (m8'm4m2'm1) + (m8'm4m2m1) + (m8m4'm2'm1') + (m8m4'm2m1') + (m8m4m2'm1')
I - Introduction
32
Activity
What if we started the months with 0 instead of 1? (i.e., January is 0000 and December is 1011)
More complex expression (0, 2, 4, 6, 7, 9, 11): d31 = m8m4m2m1 + m8m4m2m1 + m8m4m2m1 + m8m4m2m1 + m8m4m2m1 + m8m4m2m1 + m8m4m2m1 d31 = m8m1 + m8m4m2 + m8m1 (includes 13 and 15) d31 = (d28 + d29 + d30)
I - Introduction
33
d28 = m8'm4'm2m1'leap d29 = m8'm4'm2m1'leap d30 = (m8'm4m2'm1') + (m8'm4m2m1') + (m8m4'm2'm1) + (m8m4'm2m1) d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) + (m8'm4m2'm1) + (m8'm4m2m1) + (m8m4'm2'm4') + (m8m4'm2m1') + (m8m4m2'm1')
I - Introduction
34
Another example
punch in 3 values in sequence and the door opens; if there is an error the lock must be reset; once the door opens the lock must be reset
inputs: sequence of input values, reset outputs: door open/close memory: must remember combination or always have it available as an input
I - Introduction
35
Implementation in software
integer combination_lock ( ) {
integer v1, v2, v3; integer error = 0; static integer c[3] = 3, 4, 2; while (!new_value( )); v1 = read_value( ); if (v1 != c[1]) then error = 1; while (!new_value( )); v2 = read_value( ); if (v2 != c[2]) then error = 1; while (!new_value( )); v3 = read_value( ); if (v2 != c[3]) then error = 1; if (error == 1) then return(0); else return (1);
}
I - Introduction Copyright 2004, Gaetano Borriello and Randy H. Katz 36
Encoding:
how many bits per input value? how many values in sequence? how do we know a new input value is entered? how do we represent the states of the system?
new
value
Behavior:
reset
clock wire tells us when its ok to look at inputs (i.e., they have settled after change) clock sequential: sequence of values must be entered sequential: remember if an error occurred finite-state specification
Copyright 2004, Gaetano Borriello and Randy H. Katz
state
open/closed
I - Introduction
37
Finite-state diagram
states: 5 states
represent point in execution of machine each state has outputs changes of state occur when clock says its ok based on value of inputs
closed C2!=value & new S3 closed C3!=value & new
ERR
OPEN
open
not new
I - Introduction
not new
not new
38
Internal structure
data-path
control
finite-state machine controller control for data-path state changes controlled by clock
new value C1 C2
multiplexer comparator
equal
reset
C3 mux control
controller
clock
equal
I - Introduction
open/closed
Copyright 2004, Gaetano Borriello and Randy H. Katz 39
Finite-state machine
I - Introduction
40
Finite-state machine
ERR closed
not equal not equal not equal & new & new & new S1 S2 S3 OPEN closed closed closed open mux=C1 equal mux=C2 equal mux=C3 equal & new & new & new not new not new not new
reset 1 0 0 0 0 0 0 0 0 0 0 0
new 0 1 1 0 1 1 0 1 1
equal 0 1 0 1 0 1
mux C1 C1 C2 C2 C3 C3
open/closed closed closed closed closed closed closed closed closed closed open open closed
41
I - Introduction
needs at least 3 bits to encode: 000, 001, 010, 011, 100 and as many as 5: 00001, 00010, 00100, 01000, 10000 choose 4 bits: 0001, 0010, 0100, 1000, 0000 needs 2 to 3 bits to encode choose 3 bits: 001, 010, 100 needs 1 or 2 bits to encode choose 1 bits: 1, 0
I - Introduction
42
I - Introduction
Activity
Have lock always wait for 3 key presses exactly before making a decision
remove reset
new
OPEN
open
I - Introduction
44
mux control
controller
I - Introduction
45
Design hierarchy
system
data-path
control
comparator
state registers
combinational logic
logic
46
Summary
converting solutions to problems into combinational and sequential networks effectively organizing the design hierarchically doing so with a modern set of design tools that lets us handle large designs effectively taking advantage of optimization opportunities
I - Introduction
47