Notes DigitalSystems
Notes DigitalSystems
Additional Reading:
Textbook (Donzellini et. al.): Sections 1.1, 2.8.1
Textbook (Ashenden): Sections 1.1, 1.2, 1.3, 1.5, 2.3.3, 10.1, 10.24.1.1, 4.1.3
Note that the material presented in the course notes, videos, and exercise sets should be
considered as the main source for notations, formulations, and design principles while the
textbook material should be only considered as complementary.
Language, Words and Symbols
Current digital systems make it possible to communicate with
spacecraft at the edge of the Solar system, see activity inside
the living human brain, and probe the structure of atoms,
although they can not reliably predict next week's weather.
All achieved with machinery which can be described by, and is
constructed from, just two basic elements:
2
ELEE08015 Digital System Design 2 Introduction to digital signals
Language, Words and Symbols
3
ELEE08015 Digital System Design 2 Introduction to digital signals
Language, Words and Symbols
4
ELEE08015 Digital System Design 2 Introduction to digital signals
Design Abstraction Layers
RELATIONAL/FUNCTIONAL LAYER(S)
identify and define features of the problem
estimate likelihood that a solution exists within physical constraints
ALGORITHMIC/PROCEDURAL LAYER(S)
define large-scale features (method & modules) of alternative solutions
complexity choices strongly affect timing and other physical properties
GATE LAYER
define small-scale logic structure (Boolean operations)
extract good timing, power and area estimates
Digital system design progresses down through the layers shown above
starting from more abstract designs to more detailed designs. It also
usually involves design revisions using feedback from one layer to the
layer above. Longer distance feedback may indicate a serious design or
process flaw. Repeated feedback cycles increase commercial costs.
5
ELEE08015 Digital System Design 2 Introduction to digital signals
Design Abstraction Layers
RELATIONAL/FUNCTIONAL LAYER(S)
identify and define features of the problem
estimate likelihood that a solution exists within physical constraints
INCREASING CORRUPTION
INCREASING PHYSICALITY
ALGORITHMIC/PROCEDURAL LAYER(S)
INCREASING ABSTRACTION
INCREASING PERFECTION
define large−scale features (method & modules) of alternative solutions
complexity choices strongly affect timing and other physical properties
GATE LAYER
define small−scale logic structure (Boolean operations)
extract good timing, power and area estimates
The simplest set of basic symbols for digital logic has just one
symbol, but this makes the electronic circuitry awkward to build.
In digital circuits we usually use a binary symbol set, containing
two symbols, so a single digital electrical signal carries one or
other of just two (logic) meanings:
TRUE or FALSE
We shall also write logic values in a variety of other ways, but
first we shall look at how an analogue electrical signal, having
a seemingly infinite range of possible values, can represent
binary digital TRUE and digital FALSE values.
Examples will be based on 5V CMOS logic technology. Many
others exist, but all share the same essential principles.
8
ELEE08015 Digital System Design 2 Introduction to digital signals
Making Continuous Signals Discrete
Voltage Transfer (Input-Output) Characteristic
+V ANALOGUE CIRCUIT
AMPLIFIER
input output
BIG
LINEAR
OUTPUT VOLTAGE
0V
SMALL BIG +V
INPUT VOLTAGE RANGE
input output
non-logic region
NON-LINEAR
logic transition region
A valid logic signal is in either the high or low region. Valid Input regions
are assumed to be wider than valid output regions. Thus, the nonlinear
behaviour reduces the intensity of the added input noise at the
output (no stage by stage degradation).
10
ELEE08015 Digital System Design 2 Introduction to digital signals
Making Continuous Signals Discrete
Voltage Transfer (Input-Output) Characteristic
+5V ANALOGUE CIRCUIT
logic HIGH AMPLIFIER
region input output
LINEAR
non-logic region
MEDIUM OUT
circuit symbol BIG IN -> BIG OUT
DIGITAL CIRCUIT
GATE (NON-INVERTING BUFFER)
input output
NON-LINEAR
+5V
HIGH region
90% A gate's output is limited in the rate at which it can
change voltage. The consequent waveform
distortion can change logic VALID periods
i on
tran
sit
n
sitio
tra
VALID
n
logic VALID VALID
LOW logic INVALID logic HIGH logic INVALID logic LOW
10%
LOW region
0V
RISE TIME FALL TIME TIME
tTLH or tr tTHL or tf
Switching an output between HIGH and LOW takes time: the Rise
time (L to H) or fall time (H to L). The signal is not a valid logic value
during this transition time from one valid region to the other and thus
systems are designed to not use the output during this time.
12
ELEE08015 Digital System Design 2 Introduction to digital signals
Making Continuous Signals Discrete
Input to Output Propagation Delay
input output
OUTPUT A gate's output will not change instantaneously
VOLTAGE
with a change at its input
+5V The common propagation delay parameter
tPD or td
can be used to simplify propagation delay
calculations for a series of gates
nominal logic transition
50%
threshold - 50%
0V
TIME
RISING OUTPUT
PROPAGATION DELAY tPLH or tdr tPHL or t df
FALLING OUTPUT
PROPAGATION DELAY
13
ELEE08015 Digital System Design 2 Introduction to digital signals
Representing Logic Gate Signals
Schematic (Stylised) Form of Signals
VOH
90% VO
10%
VOL
time tTLH / tTHL
tTLH tTHL tr / tf
tr tf
VIH
50%
VIL
VI VO
time
VOH
50%
time tPD
common form
tPLH tPHL td (dr-df)
tdr tdf
15
ELEE08015 Digital System Design 2 Introduction to digital signals
Symbols Representing Logic Value
D Logic R Logic
TRUE FALSE
FALSE TRUE
16
ELEE08015 Digital System Design 2 Introduction to digital signals
Symbols Representing Logic Value
Some closing words on the definition of truth:
Sometimes, we just don’t care, so a third symbol enters the
binary language: * (asterisk, sometimes X is used)
This "don’t care" symbol represents cases where 1 or 0 is
actually used, but we don’t yet know, or it doesn’t matter.
Finally, if there is a leak in your logical/physical layer boundary
(e.g., voltage remaining in a transitional level): Z may be used to
indicate that a logic value is neither 1 nor 0, but is invalid.
1 and 0 are the only logic values
Z is NOT a logic value
17
ELEE08015 Digital System Design 2 Introduction to digital signals
Summary So Far
Binary logic deals with abstract perfection: TRUE and FALSE
... but in electronic circuitry there are transition periods of
neither — circuitry is always imperfect — during which we
must avoid looking for an answer (using the output)
Voltages to represent TRUE/FALSE need a code: +ve or -ve logic
18
ELEE08015 Digital System Design 2 Introduction to digital signals
RTL Layer Time/Sequence Control: The CLOCK Signal
Different layers of logic value coding may be required to produce an
RTL-layer abstraction for basic algorithmic-layer data and operations.
Operations, description of behaviour, involves no time property. For
composing RTL operations into higher-layer behaviour, we need
structured time, to build sequence of operations.
19
ELEE08015 Digital System Design 2 Introduction to digital signals
GATE/RTL LAYER DELAY CONTROL: Sequential Gates
CODE P COMBINATIONAL GATES CODE Q CODE X(t ) SEQUENTIAL GATES CODE X(t−1)
codeword a,b , ... down from RTL TRUTH TABLE gate
codeword y, z , ... codeword codeword ..., a, b ,c
gate layer properties:
n bits layer properties: m bits ..., b, c ,d n bits LOGIC TIME delay − MEMORY n bits
BITS and LOGIC operations
physical layer properties:
physical layer properties: clock cycle synchronisation
transition time, propagation delay setup/hold time, propagation delay
THE CLOCK
LOGIC TIME CONTROL SIGNAL
Larger machines will generate more delay and more delay variability.
Clock period partitions delay and its variability into fixed delays blocks
and allows for scalability to any size of machine in principle.
20
ELEE08015 Digital System Design 2 Introduction to digital signals
Sequential Gates: The Positive Edge Triggered D (data) FLIP-FLOP
DANGER ZONE
input data input data (D) nput
i data
may change transitions forbidden m
ay change
IN
IN OUT
OUT
D Q
tsu tPD
CLOCK
Ck
su h
th
t PD
CLOCK
time zero reference
21
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
22
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL tsu
23
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL tsu
24
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
th
25
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
tPD
26
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
VH
DS1
VL
VH
DS2 V
L
VH
CLOCK VL
tsu
th
Input D is ignored in (long) period after hold and before next setup
Inactive (negative, falling) clock edge ignored
This is the time window in which combinational gates compute new
codewords causing temporary (glitch) and final transitions of signal.
ELEE08015 Digital System Design 2 IAB Lindsay L5 CONTROLLING TIME DELAY - THE CLOCK FOIL 15
27
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
tsu
th
28
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
tPD
29
ELEE08015 Digital System Design 2 Introduction to digital signals
The D (data) FLIP-FLOP (positive edge triggered)
CLOCK CONTROLLED LOGIC VALUE PROPAGATION
IN DS1 DS2
D Q D Q
Ck Ck
CLOCK CLOCK
VH
IN
VL
DS1 VH
VL
DS2 VH
VL
CLOCK VH
VL
30
ELEE08015 Digital System Design 2 Introduction to digital signals
1. Introduction to Digital Signals
1.2 Boolean Algebra
Additional Reading:
Textbook (Donzellini et. al.): Sections 1.2-1.8, 1.12, 1.13, 2.6.1
Textbook (Ashenden): Sections 2.1.1, 2.1.2 4.1.1, 4.1.3
Note that the material presented in the course notes, videos, and exercise sets should be
considered as the main source for notations, formulations, and design principles while the
textbook material should be only considered as complementary.
Boolean Variables and Functions
Boolean variables are binary variables that can assume two values X = 0 indicating
logic value false and X = 1 indicating logic value true.
𝑋! 𝑋" 𝑋#. f
0 0 0 Values
Let’s assume a three-variable 0 0 1
function 𝑋! , 𝑋" , 𝑋$ . We can
0 1 0 assumed
construct a table with all the
values assumed by f :
0 1 1
1 0 0 by function
1 0 1
1 1 0 f (𝑋!, 𝑋",𝑋$)
ELEE08015 Digital System Design 2 Introduction to digital signals
1 1 1 32
Fundamental Elements of Boolean algebra: Logic Gates
Circuit diagram
symbols:
33
ELEE08015 Digital System Design 2 Introduction to digital signals
Basic Principles of Boolean Algebra:
De Morgan’s Theorem
A logical product of two variables can be substituted by the negation of their logical
sum. Dual: a logical sum of two variables can be substituted by the negation of their
logical product:
𝑋 ( 𝑌 = 𝑋) + 𝑌)
(dual:) 𝑋 + 𝑌 = 𝑋) ( 𝑌)
Algebraic symbols: (𝑋 ( 𝑌) (𝑋 + 𝑌)
Circuit diagram
symbols:
36
ELEE08015 Digital System Design 2 Introduction to digital signals
Other Operations: XOR
Generalized XOR:
1 if there is an odd number of inputs = 1
𝑋!⨁𝑋"⨁ … ⨁𝑋# = 0
0 if there is an even number of inputs = 1
37
ELEE08015 Digital System Design 2 Introduction to digital signals
NOR-only Design
We can obtain the fundamental logic gates AND, OR and NOT from NOR only. If we
connect a NOR as in the figure below, we obtain a NOT. Given that the X and Y
inputs are connected together, we obtain the following from the NOR table:
𝑋 𝑌 𝑋 nor 𝑌
𝑋 𝑋% 0 0 1
1 1 0
However, we obtain the OR gate by negating the NOR output with a NOT:
𝑋+𝑌
𝑋
𝑋+𝑌
𝑌
𝑋(𝑌
𝑌
𝑌%
38
ELEE08015 Digital System Design 2 Introduction to digital signals
NAND-only Design
Similar to NOR, NAND can be used to generate fundamental gates, e.g., NOT is
obtained as follows,
𝑋 𝑌 𝑋 nand 𝑌
𝑋 𝑋% 0 0 1
1 1 0
Therefore, to obtain the AND, it is sufficient to connect the NAND to a NOT made
with a NAND. :
𝑋(𝑌
𝑋
𝑋(𝑌
𝑌
𝑋+𝑌
𝑌
𝑌%
39
ELEE08015 Digital System Design 2 Introduction to digital signals
Minterms and Maxterms
Minterm: If an AND term in a Boolean expression contains all the direct or negated
variables in the entire expression, it is called a fundamental product, or minterm. For
example:
𝑓 𝑋!, 𝑋",𝑋) = 𝑋! ( 𝑋" ( 𝑋) is a minterm.
An n-variable function has 2# minterms since every variable in the function must be
part of a minterm, in its direct or negated form.
Maxterm: If an OR term in a Boolean expression contains all the direct or negated
variables in the entire expression, it is called a fundamental sum, or maxterm. As above, if
there are n-variables, there are 2# maxterms. For example:
Remember that there is only one combination of variables for which a certain maxterm
equals zero, e.g., 𝑋! + 𝑋" + 𝑋$ = 0 if and only if 𝑋! = 0, 𝑋" = 1, 𝑋$ = 0, or a certain minterm
equals 1, e.g., 𝑋! ' 𝑋" ' 𝑋$ = 1 if and only if 𝑋! = 1, 𝑋" = 1, 𝑋$ = 0.
Also a general Boolean function can be written either in terms of sum of minterms (sum
of products) or in terms of product of maxterms (product of sums).
40
ELEE08015 Digital System Design 2 Introduction to digital signals
Example: Decoder
Row and column decoders are typically used to implement accessing data in a specific
part of memory arrays. They have n inputs and 2n outputs: every combination of inputs
activates one and only one output.
● Truth table:
– k = 3 address line inputs A2 , A1 and A0
Row
– 2k = 8 word line outputs WL0 - WL7 Decoder
A A A WL WL WL WL WL WL WL WL WL 0
2 1 0 0 1 2 3 4 5 6 7
0 0 0 1 0 0 0 0 0 0 0 WL 1
0 0 1 0 1 0 0 0 0 0 0 WL 2
A2
0 1 0 0 0 1 0 0 0 0 0 WL 3
0 1 1 0 0 0 1 0 0 0 0 A1
WL 4
1 0 0 0 0 0 0 1 0 0 0 A0
WL 5
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0 WL 6
1 1 1 0 0 0 0 0 0 0 1 WL 7
ELEE08015 Digital System Design 2 Introduction to digital signals
41
Decoder Circuit Implementation
WL 1 WL1 = A2 . A1 . A0
WL 2
WL2 = A2 . A 1 . A0 ... etc
WL 3 A A A WL WL WL WL WL WL WL WL
2 1 0 0 1 2 3 4 5 6 7
0 0 0 1 0 0 0 0 0 0 0
WL 4
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
WL 5 0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
WL 6 1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
WL 7 1 1 1 0 0 0 0 0 0 0 1
ELEE08015 Digital System Design 2 Introduction to digital signals
42
L2.1 Non-Number Codes
Codes
In the digital world, everything is in code: it is encoded.
There are innumerable digital codes in use and new codes are
invented every day. Codes are simple languages.
• The code used for a design affects the logical structure and
physical properties of the system (we will see later how).
• Weaknesses and strengths of physical circuitry influence the
design of the code(s) used to describe the data being
processed in the machine and also the machine design itself
(e.g., algorithm).
For good system design, engineers have to select or invent
codes appropriate to the application (top layer), the physical
fabric (bottom layer), and many layers in-between.
How Are Codes Used?
• To hide information - cryptography (One-time pad)
• To preserve information - integrity (error correcting codes)
• To condense information - compression (Lempel-Ziv, mp3)
• and finally to represent information - the underlying function of
all codes and the primary focus within this course
Transistor circuits form logic gates which work only with true
and false, but engineers design complex networks of gates to
process more complex types of information, and so:
• The information must be encoded in carefully designed
collections of the basic 1/0 symbols (TRUE/FALSE, Hi/Lo)
It is vital to keep track of which code is in use in each section of
any digital system: lose the code and you lose the meaning
Some Language for Talking About Codes
Symbol: The basic element(s) used to construct codewords
Cardinality: The number of different symbols available
Codeword: A particular arrangement of symbols
000100
true <−> lamp on
LOGIC MAPPING
false <−> lamp off
3
Codeword Notation:
binary hexadecimal octal decimal
00000000 0000 0000 00 00 000 000 000 ...
00000001 0000 0001 01 00 000 001 001 ...
00000010 0000 0010 02 00 000 010 002 ...
00000011 0000 0011 03 00 000 011 003 ...
00000111 0000 0111 07 00 000 111 007 ...
00001000 0000 1000 08 00 001 000 010 ...
00001001 0000 1001 09 00 001 001 011 ...
00001010 0000 1010 0A 00 001 010 012 ...
00001011 0000 1011 0B 00 001 011 013 ...
00001111 0000 1111 0F 00 001 111 017 ...
00010000 0001 0000 10 00 010 000 020 ...
00010001 0001 0001 11 00 010 001 021 ...
11111110 1111 1110 FE 11 111 110 376 ...
11111111 1111 1111 FF 11 111 111 377 ...
hexadecimal & octal notations are simple compact ways of writing binary
codewords but they are not numbers. Hexadecimal notation in engineering
is not the base-16 number in maths.
4
Binary Natural Number (BNN) Code (‘‘binary’’, ‘‘unsigned binary’’)
0 1 0 1 0 1 0 codeword: false/true
+1 32 0 8 0 2 0 +1 × (32 + 8 + 2) = 42
1 1 0 1 0 1 0 codeword: false/true
-1 32 0 8 0 2 0 -1 × (32 + 8 + 2) = -42
Two codewords for zero (Not ± zero as number zero is unsigned)
The sign bit makes structure irregular, but it gives a symmetrical
value range which mathematically convenient.
Range: -(2(N -1) - 1) to +(2(N -1) - 1) for N bits (zero balanced),
Resolution: uniform, unity
Offset / Excess BNN Number Codes (many variants)
Add a positive constant (the "bias") to the value to be encoded
and then encode the biased value (which is now strictly positive)
in BNN. See examples of 4-bit offset BNN with a bias of +7:
0010 minus five: -5 + 7 = 2 Encode 2 in BNN
1001 plus two: +2 + 7 = 9 Encode 9 in BNN
0000 minus seven: -7 + 7 = 0 Encode 0 in BNN
1111 plus eight: 8 + 7 = 15 encode 15 in BNN
0111 zero: 0+7=7 encode 7 in BNN
Range: -bias: 2N -1-bias, range limit changes by bias value
(but never zero balanced),
Resolution: uniform, unity
Unique value for each codeword
Natural codeword order same as many other codes (BNN &c.)
One’s Complement (1’sC) Number Code
For positive values, same as BNN with the msb false:
0010 two
0111 seven (maximum positive value in 4 bits)
For negative values, invert the corresponding +ve codeword:
1101 minus two
1000 minus seven ( the most negative value in 4 bits)
Zero has two possible codewords: 0000 and 1111 (in 4 bits)
Range: -(2(N -1) - 1) to +(2(N -1) - 1) for N bits (zero balanced),
Resolution: uniform, unity.
Most 1’sC systems use only one codeword for zero,
the other may represent "no value" - distinct from "zero value" or
the system is designed to convert it to the proper codeword.
widely used in digital communications e.g. TCP/IP packet
checksums
Two’s Complement (2’sC) Number Code
Like BNN code, but most significant bit has negative weight
b5 b4 b3 b2 b1 b0 bits
-(25) 24 23 22 21 20 weights (exponential form)
-32 16 8 4 2 1 weights (plain form)
1 0 1 0 1 0 codeword: false/true (de-)/selects
-32 0 8 0 2 0 effective place/bit value
-32 + 8 + 2 = -22 numeric value of codeword
Range: -2(N -1) to +(2(N -1) - 1) for N bits (not zero balanced),
Resolution: uniform, unity
Add/Subtract logic for 2’sC and BNN identical (except overflow),
not good for multiply/divide.
Large Hamming distance for small value codewords around
zero implies large switching energy, compared with SM code.
L2.3 Number Codes II: Real Numbers
Binary Coded Decimal (BCD) Number Codes
This is a code within a code.
Create ten "super-symbols" using groups of four binary symbols:
These 4-bit super-symbols represent numbers 0-9 (encoded by
BNN, or others), with six unused codewords.
Partition number value as base-10 place-value and encode with
new super-symbols. Using 4-bit BNN super-symbols, we have:
Example: 11 + 7 = 18
D D D
Example: 11 + 7 = 18
D D D
Full Adder Truth Table 1−bit Full Addition
A B Cin Cout Sum
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1 ●
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
Synthesising Truth Table: Karnaugh map
• A Karnaugh map is a table of cells with each cell representing one minterm (or maxterm).
• Maps for two variables have four cells, for three variables eight cells, for four variables
sixteen cells and so on.
• The cells are laid out so that moving from one cell to any adjacent cell results in a
change in one variable, i.e., hamming distance of 1 between codewords.
• Where a minterm is to be included in the logic function a 1 is written in the cell.
Otherwise a 0 is written in or it is left blank. Don’t cares can be also included and treated
as 1 or 0 as appropriate!
• Thus, any two adjacent cells that both contain a 1 represent terms that differ in one
variable and can be combined as: X.Y+ X.𝑌= ത X
• The map can be inspected for groups of ones and BC
their minimised form can be written.
A 00 01 11 10
• The minimisation relies on combining adjacent 1s into
0 1 1 0 1
groups as large as possible of given the group has a
size of power of 2 and a rectangular shape. 1 1 1 0 0
• Note that the maps have cyclic property and thus the
groups can be rolls over from left end to the right and 3-variable Karnaugh Map
so on.
Synthesising Truth Table: Karnaugh map
• A Karnaugh map is a table of cells with each cell representing one minterm (or maxterm).
• Maps for two variables have four cells, for three variables eight cells, for four variables
sixteen cells and so on.
• The cells are laid out so that moving from one cell to any adjacent cell results in a
change in one variable, i.e., hamming distance of 1 between codewords.
• Where a minterm is to be included in the logic function a 1 is written in the cell.
Otherwise a 0 is written in or it is left blank. Don’t cares can be also included and treated
as 1 or 0 as appropriate!
• Thus, any two adjacent cells that both contain a 1 represent terms that differ in one
variable and can be combined as: X.Y+ X.𝑌= ത X
• The map can be inspected for groups of ones and BC
their minimised form can be written.
A 00 01 11 10
• The minimisation relies on combining adjacent 1s into
0 1 1 0 1
groups as large as possible of given the group has a
size of power of 2 and a rectangular shape. 1 1 1 0 0
• Note that the maps have cyclic property and thus the
groups can be rolls over from left end to the right and 3-variable Karnaugh Map
so on.
Synthesising Truth Table: Karnaugh map
• A Karnaugh map is a table of cells with each cell representing one minterm (or maxterm).
• Maps for two variables have four cells, for three variables eight cells, for four variables
sixteen cells and so on.
• The cells are laid out so that moving from one cell to any adjacent cell results in a
change in one variable, i.e., hamming distance of 1 between codewords.
• Where a minterm is to be included in the logic function a 1 is written in the cell.
Otherwise a 0 is written in or it is left blank. Don’t cares can be also included and treated
as 1 or 0 as appropriate!
• Thus, any two adjacent cells that both contain a 1 represent terms that differ in one
variable and can be combined as: X.Y+ X.𝑌= ത X
• The map can be inspected for groups of ones and BC
their minimised form can be written.
A 00 01 11 10
• The minimisation relies on combining adjacent 1s into
0 1 1 0 1
groups as large as possible of given the group has a B
size of power of 2 and a rectangular shape. 1 1 1 0 0
• Note that the maps have cyclic property and thus the
groups can be rolls over from left end to the right and 3-variable Karnaugh Map
so on.
Synthesising Truth Table: Karnaugh map
• A Karnaugh map is a table of cells with each cell representing one minterm (or maxterm).
• Maps for two variables have four cells, for three variables eight cells, for four variables
sixteen cells and so on.
• The cells are laid out so that moving from one cell to any adjacent cell results in a
change in one variable, i.e., hamming distance of 1 between codewords.
• Where a minterm is to be included in the logic function a 1 is written in the cell.
Otherwise a 0 is written in or it is left blank. Don’t cares can be also included and treated
as 1 or 0 as appropriate!
• Thus, any two adjacent cells that both contain a 1 represent terms that differ in one
variable and can be combined as: X.Y+ X.𝑌= ത X
• The map can be inspected for groups of ones and BC
their minimised form can be written.
A 00 01 11 10
• The minimisation relies on combining adjacent 1s into
0 1 1 0 1
groups as large as possible of given the group has a B
size of power of 2 and a rectangular shape. 1 1 1 0 0
• Note that the maps have cyclic property and thus the
groups can be rolls over from left end to the right and 3-variable Karnaugh Map
so on.
Synthesising Truth Table: Karnaugh map
• A Karnaugh map is a table of cells with each cell representing one minterm (or maxterm).
• Maps for two variables have four cells, for three variables eight cells, for four variables
sixteen cells and so on.
• The cells are laid out so that moving from one cell to any adjacent cell results in a
change in one variable, i.e., hamming distance of 1 between codewords.
• Where a minterm is to be included in the logic function a 1 is written in the cell.
Otherwise a 0 is written in or it is left blank. Don’t cares can be also included and treated
as 1 or 0 as appropriate!
• Thus, any two adjacent cells that both contain a 1 represent terms that differ in one
variable and can be combined as: X.Y+ X.𝑌= ത X
• The map can be inspected for groups of ones and BC
their minimised form can be written.
A 00 01 11 10
• The minimisation relies on combining adjacent 1s into
0 1 1 0 1
groups as large as possible of given the group has a B
size of power of 2 and a rectangular shape. 1 1 1 0 0 A.C
• Note that the maps have cyclic property and thus the
groups can be rolls over from left end to the right and 3-variable Karnaugh Map
so on.
Karnaugh Map
Consider the following map for two variables. All four
minterms are present and given a truth table can be entered
B
in the map. Now assume the Kmap for truth table below:
A 0 1
0 A.B A.B
1 A.B A.B
Karnaugh Map
Consider the following map for two variables. All four
minterms are present and given a truth table can be entered
B
in the map. Now assume the Kmap for truth table below:
A 0 1
A B F 0 A.B A.B
B
0 0 1 1 A.B A.B
A 0 1
0 1 1
0 1 1
1 0 0
1 0 1
1 1 1
• We can now draw loops round groups of 1s in • Hence F = A + B directly from the
the map to represent the mimimised terms. map. We know how to reduce the
function using Boolean algebra too:
B
A 0 1
0 1 1
1 0 1
A
B
Karnaugh Map
Consider the following map for two variables. All four
minterms are present and given a truth table can be entered
B
in the map. Now assume the Kmap for truth table below:
A 0 1
A B F 0 A.B A.B
B
0 0 1 1 A.B A.B
A 0 1
0 1 1
0 1 1
1 0 0
1 0 1
1 1 1
• We can now draw loops round groups of 1s in • Hence F = A + B directly from the
the map to represent the mimimised terms. map. We know how to reduce the
function using Boolean algebra too:
B
A 0 1
0 1 1
1 0 1
A
B
Full Adder synthesis:
C C
A B in out AB
0 0 0 0 Cin 00 01 11 10 A⋅B
0 0 1 0 0 0 0 1 0
0 1 0 0 A⋅C in
0 1 1 1 1 0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1 B⋅C in
1 1 1 1
C = A ⋅ B+A ⋅ C + B ⋅ C
out in in
Full Adder synthesis:
AB
C
A B in Sum Cin 00 01 11 10
0 0 0 0
0 0 1 0 1
0 0 1 1
0 1 0 1
1 1 0 1 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0 Sum = 𝐴 ⋅ 𝐵 ⋅C i n +𝐴 .B⋅ 𝐶 𝑖𝑛 + A ⋅ B⋅C i n +𝐴 ⋅ 𝐵 ⋅ C i n
1 1 1 1
Using Boolean
algebra:
Full adder circuit #1
A
Sum
B
C
in
Sum = A ⊕ B ⊕ C in
C = A ⋅ B + A ⋅ C + B⋅ C C
out in in out
Full adder circuit #2
C = A ⋅ B + (A ⊕ B ) . C
out in
4-bit ripple carry adder
A B3 A B2 A B1 A B0 An Bn
3 2 1 0
Cout + Cin
C
out + + + + C
in
Sn
S S S S Full adder symbol
3 2 1 0
– Carry generated at the lsb position propagates all the way to the msb position
– Carry consumed at msb position to produce the sum
Propagation delay from Cin to Cout : tcarry
●
Assume that both the delay from input signals
Propagation delay from Cin to Sum: tsum A0 (or B0) to Cout,0 for the lsb, and the Cin to
●
Cout delay for all other bits equal to tcarry .
For an 8-bit addition the following values of A7:0 and B7:0 set up a worst case delay:
A = { 0, 0, 0, 0, 0, 0, 0, 1}, B= { 0, 1, 1, 1, 1, 1, 1, 1}
Carry ripples through addition:
Subtraction
S = A− B is the same as S = A + ( − B)
● Create the code for -B from the input +B and then add to A to (-B)
−2n −1
≤ MD < 2
3 3
●
−2 ≤ M < 2
i.e. -8 to +7 D
− 8 ≤ MD < 8
Add +3 to +4 :
D D
– result correct!
Further Examples
despite overflow!
● Overflow detected by
noting msb has changed:
out of range
Overflow = A n−1 ⋅ B n−1 ⋅ S n − 1 + A n−1 ⋅ Bn − 1 ⋅ S n −1
●
Binary Subtraction
Any two's complement number can have its sign changed by
●
1 0 1
1 1 0 A A A A
3 2 1 0
C
out,3
+ + + +
S S S S
3 2 1 0
bit = 0 : adder
invert
bitinvert = 1 : subtracter
Overflow
3. Combinational Logic
3.2 CMOS Implementation of Boolean Functions
CMOS technology
● Complementary Metal Oxide Semiconductor
technology (CMOS)
– dominant integrated circuit technology
– implements digital circuits with high noise immunity
and low static power consumption
– implements analogue circuits and image sensors
– technology development over many decades has
provided ever smaller transistors
– current microprocessors contain hundreds of millions
of CMOS logic gates (transistors) on a single chip.
Switches in CMOS technology
● Two fundamental transistor/switch types: NMOS and PMOS transistors.
NMOS Transistors:
A
– ON/closed when control G = hi
G
– Poor conduction if A/B signals hi
– Good conduction of A/B signals lo
B
– Hence used in pull-down networks.
PMOS transistor
– ON/closed when control G = lo A
– Good conduction if A/B signals hi G
– Hence used in pull-up networks.
–
●
CMOS inverter (NOT gate) V dd
in hi: M1 OFF, M2 ON, out lo V dd R1
in lo: M1 ON, M2 OFF, out hi M1 SW 1
in
out out
in out SW0
M2
R0
0V
Vdd
in
0V
0V ● Output signal with propagation delay,
Vdd
●
rise and fall time.
out
0V
Virtually no power consumption for
Imax
I static signals.
0A
● Power consumed when signals change.
time (S)
CMOS NAND gate Design
●
Output F lo (connected to 0V) only when both inputs are hi.
A B F V dd
A
F 0 0 1
B 0 1 1 Pull− up
1 0 1
network
F= A. B 1 1 0
0V
CMOS NAND gate Design
● Output F hi (connected to Vdd) when either input is lo.
A A B F V dd
F 0 0 1
B 0 1 1
1 0 1
F= A. B 1 1 0 A B
F
Pull− down
network
0V
CMOS NAND gate Design
A A B F V dd
F 0 0 1
B 0 1 1
1 0 1
F= A. B 1 1 0 F
0V
CMOS NAND gate Design
A A B F V dd
F 0 0 1
B 0 1 1
1 0 1
F= A. B 1 1 0 F
B
● Complete circuit
– When PMOS transistors
A
connect F to Vdd, NMOS
transistors do not connect to
0V (and vice-versa). 0V
A B C F
0 0 0 1 V dd
0 0 1 1
0 1 0 1
0 1 1 1
F
1 0 0 1
1 0 1 1 A
1 1 0 1
1 1 1 0 B
F= A. B. C C
0V
CMOS AND gate
● Not possible to V dd
implement AND
function with simple
pull-up and pull-down F
network
A
A F
B B
A F 0V
B
CMOS NOR gate Design
● Output F lo (connected to 0V) when either inputs is hi.
A A B F
F 0 0 1
V dd
B 0 1 0
1 0 0 Pull−u p
F= A+B 1 1 0
network
A B
0V
CMOS NOR gate Design
● Output F hi (connected to Vdd) when both inputs are lo.
A A B F V dd
F 0 0 1
B 0 1 0 A
1 0 0
F= A+B 1 1 0
B
F
Pull− down
network
0V
CMOS NOR gate Design
● Output F hi (connected to Vdd) when both inputs are lo.
A A B F V dd
F 0 0 1
B 0 1 0 A
1 0 0
F= A+B 1 1 0
B
● Complete circuit
– When PMOS transistors F
connect F to Vdd, NMOS
transistors do not connect to
0V (and vice-versa).
0V
– No short circuit between Vdd and 0V.
3-input CMOS NOR gate
V dd
A B C F A
0 0 0 1
0 0 1 0
B
0 1 0 0
0 1 1 0
1 0 0 0 C
1 0 1 0
1 1 0 0 F
1 1 1 0
F= A+ B+ C 0V
CMOS OR gate
● Not possible to V dd
implement OR A
function with simple
pull-up and pull-down F
B
network
A F
B
A F 0V
B
Number of transistors per gate
● Different gates require different numbers of transistors:
– 4 transistors for 2-input NAND and 2-input NOR
– 6 transistors for 2-input AND and 2-input OR
● Therefore in a CMOS implementation of a Boolean expression it is
more efficient to use NAND/NOR gates
● De Morgan's laws can usually be used to convert expressions into forms
using NAND and NOR.
Number of transistors per gate
● Different gates require different numbers of transistors:
– 4 transistors for 2-input NAND and 2-input NOR
– 6 transistors for 2-input AND and 2-input OR
● Therefore in a CMOS implementation of a Boolean expression it is
more efficient to use NAND/NOR gates
● De Morgan's laws can usually be used to convert expressions into forms
using NAND and NOR.
Example I: Define the minimum number of CMOS transistors required to
implement the following Boolean expression:
F= A. B
A F
B
8 transistors
Number of transistors per gate
● Different gates require different numbers of transistors:
– 4 transistors for 2-input NAND and 2-input NOR
– 6 transistors for 2-input AND and 2-input OR
● Therefore in a CMOS implementation of a Boolean expression it is
more efficient to use NAND/NOR gates
● De Morgan's laws can usually be used to convert expressions into forms
using NAND and NOR.
Example I: Define the minimum number of CMOS transistors required to
implement the following Boolean expression:
F = A . B+ C . D
A
B F
C
D 18 transistors
Number of transistors per gate
● Different gates require different numbers of transistors:
– 4 transistors for 2-input NAND and 2-input NOR
– 6 transistors for 2-input AND and 2-input OR
● Therefore in a CMOS implementation of a Boolean expression it is
more efficient to use NAND/NOR gates
● De Morgan's laws can usually be used to convert expressions into forms
using NAND and NOR.
Example II: Minimise the number of CMOS transistors required:
F = A . B + C . D |Apply De Morgan F = A . B . C . D
A A
B F B F
C C
D 18 transistors D 12 transistors
NAND versus NOR
0V
General CMOS gate: Form of Boolean expression
● Boolean expression must be of the form: F = (SOP) (SOP: Sum Of Products)
● Bar over whole term indicates an inverter is not needed at the output
No bar indicates the need for an inverter at the output of the pull-up/pull-
● down network: use inverse of the SOP expression to design
V dd
Example: Sketch a CMOS transistor network to implement
A B
the Boolean expression: F = (A.B)+C
0V
General CMOS gate: Form of Boolean expression
● Boolean expression must be of the form: F = (SOP) (SOP: Sum Of Products)
● Bar over whole term indicates an inverter is not needed at the output
No bar indicates the need for an inverter at the output of the pull-up/pull-
● down network: use inverse of the SOP expression to design
Example: Sketch a CMOS transistor network to implement V dd
the Boolean expression: F = (A.B)+C B
A
Pull-up network: rearrange expression
C
using De Morgan:
F
F = (A+B).C A
Connect F to Vdd when A is lo OR B is C
lo AND C is lo. B
0V
L4.1 The D-Flip Flop
Circuit-level feedback
Feedback over one invertor: '1' ' 0' ' 0' '1'
• Signal feedback gives new behaviour
• Signal feedback around one inverter is
unstable 5V 5V
– Behaviour may be used as basis of an
analogue oscillator but useless for 0V 0V
constructing controlled-time logic systems. t t
t PD tr = t f = 0 t PD < t r = t f
'
– if a particular stable condition can be set by other
–
5V
(combinational) circuit signals.
0V
t
Circuit-level feedback: External Control
Add switches to input (Sin) and feedback (Sfb) paths:
S fb
Sfb
'X'
S in ' 0' '1' ' 0'
D 'X' '1' ' 0' '1'
Q
–
NMOS Transistors:
– ON/closed when control G = hi A
– Poor conduction if A/B signals hi G
– Good conduction of A/B signals lo
– Hence used in pull-down networks.
B
PMOS transistor
– ON/closed when control G = lo A
– Good conduction if A/B signals hi G
– Poor conduction of A/B signals lo
– Hence used in pull-up networks.
B
–
● Neither NMOS nor PMOS transistors suitable for conducting BOTH hi and lo
values on A/B.
●
Transmission Gate/Switch
• Combine an A/B-hi switch (PMOS) with an A/B-lo switch (NMOS)
G = lo
G G
G
A B A B G = hi
G
D-Latch (Positive Transparent Latch)
• Combining circuit-level feedback with control by transmission gates gives
simple memory element
When G is hi ('1'):
– D/Q path transparent
– Q follows D in simple combinational behavior
D Q
G G
D Q
G Q
Q G
G G
D-Latch Waveform Diagrams
G = hi G = lo
G = lo G = lo G = hi G = hi
D Q D Q
G = hi Q G = lo Q
G = hi (transparent) G = lo (memory)
Q
D-Latch Operation Table
● Assume positive logic convention (lo = 0, hi = 1)
● Q- indicates value of Q just before a change in G
G D Q
1 1 1 transparent
●
1 0 0 transparent
↓ * D input value captured
●
Data Data
● When clock is lo: in
D Q D Q out
– master transparent Master Slave
Q Q
– slave retains memorised G G
Clock
–
output
● At clock lo – hi transition:
– master stores input, slave transparent D Q
Clock signal lo
open
Memory Transparent
D Q
Clock signal hi
Data Data
D Q D Q out D Q
in
Master Slave
Q Q Clk Q
G G
Clock
Clock
Q
Positive D Flip-Flop: Operation Table
Clk D Q
0 * Q- emit stored value
1 * Q- emit stored value
●
↓ * Q- emit stored value
* D input value captured
●
DANGER ZONE
input data (D)
input data transitions input data
may change forbidden may change
IN IN OUT
D Q
OUT
t SU t PD
Clk
Clock
th th
t SU t PD Clock
time zero
reference
WL 1
A0
( Address
bus )
WL 0
Row
Decoder
BL 0 BL 0 BL 1 BL 1
R/ W Sense amplifier (read) Sense amplifier (read)
(Control signal) Driver (write) Driver (write)
1 0 0 1
A0 = 1
ON ON ON ON
Row X X X X
Decoder
OFF OFF OFF OFF
1 0 0 1
R/ W = 1 Sense amplifier (read) Sense amplifier (read)
0
X X X X
A0 = 0
OFF OFF OFF OFF
0 1 1 0
Row
Decoder
ON ON ON ON
0 1 1 0
R/ W = 0
Driver (write) Driver (write)
● Read asserted (R/W = 1): data transferred from memory Data bus
Address Data
ROM
Decoder
Array
N M
Simple MOS ROM: internal architecture
V DD
• Bit lines connected to PMOS load transistors
• NMOS transistor exists in a cell if a cell is
storing a logic 0 W 1 =0
pulled up by PMOS
Address = 012
W 2 =1
Decoder
Example: Let address bus = 01 On On
Address Data
A2 A1 A0 D3 D2 D1 D0
0 0 0 0 0 0 0
Address 0 0 1 0 0 0 0
ROM 0 1 0 0 0 0 0
0 1 1 0 0 0 0
N
1 0 0 0 0 0 0
M 1 0 1 0 0 0 0
1 1 0 0 0 0 0
Data 1 1 1 0 0 0 0
L4.3 Shift Registers
Two D flip-flops in series
QA QB
Clock
D D Q D Q Din
in A B
Clk Clk QA
Clock QB
Clock
Din
QA
QB
QC
QD
SIPO Shift register application
● Switch debounce using an 8-bit shift register. Switch
● open – shift register fills up with logic 1's
– Out is a logic 1
● Switch closed – shift register fills up with 0's
– Out is a logic 0
+ve PSU
Out
R QA QB QC QD QE QF QG QH
D Q D Q D Q D Q D Q D Q D Q D Q
Switch Clk Clk Clk Clk Clk Clk Clk Clk
Clock −1 kHz
Time QA QB QC QD QE QF QG QH Out
1mS 1 1 1 1 1 1 1 1 1
2mS 0 1 1 1 1 1 1 1 1
3mS 1 0 1 1 1 1 1 1 1
4mS 0 1 0 1 1 1 1 1 1
5mS 1 0 1 0 1 1 1 1 1
6mS 0 1 0 1 0 1 1 1 1
bounce 7mS 0 0 1 0 1 0 1 1 1
8mS 0 0 0 1 0 1 0 1 1
9mS 0 0 0 0 1 0 1 0 1
10mS 0 0 0 0 0 1 0 1 1
11mS 0 0 0 0 0 0 1 0 1
12mS 0 0 0 0 0 0 0 1 1
13mS 0 0 0 0 0 0 0 0 0
14mS 0 0 0 0 0 0 0 0 0
debounced output
The Multiplexer
● A combinational logic circuit that selects one of two (or more) logic input
signals to output onto a single logic output.
● In general, an N-bit control signal, C, selects the output from 2N input signals.
Example: Generate a truth table circuit for 2-to-1 multiplexer (N = 2)
– 3 inputs A, B and C for truth table; 23 = 8 input combinations.
A B C F
– When C is high, let F = A and when C is low, let F = B 0 0 0 0
0 0 1 0
C 0 1 0 1
0 1 1 0
A A 1 0 0 0
F F 1 0 1 1
B B
Mux 1 1 0 1
C 1 1 1 1
AB
A
C C
F = A.C + B.C F
B
Alternative designs for a 2-to-1 Multiplexer
NAND-only design: Apply De Morgan's laws and use the equivalent expression
for circuit implementation:
A
C
F = A.C + B.C F = A.C . B.C F
B
Design using Transmission Gates: For this design the output is not directly
connected to Vdd or 0V so Output signal, F, drive strength dependent upon drive
strength of inputs A, B and properties of transmission gate
A
F
C
Parallel Input Serial Output (PISO) Shift Register
● Formed by a cascade of multiplexers and D flip-flops.
C
● A 2-to-1 multiplexer is combined with each D flip-flop A
– D flip-flop input can come from one of two sources,
B F D Q
A or B determined by control bit C.
Clk Q
Load /
shift AC AC AC AC
F F F F Dout
Logic 0 B D Q B D Q B D Q B D Q
Clk Clk Clk Clk
Clock
PISO Shift Register application
● Converting parallel data to serial data for transmission down a serial
communication link.
● Data is stored in computer systems in parallel form.
– For example in an 8-bit register
• But data may be transmitted between computers in serial form
– Over a communications link e.g. a wireless radio link
• Data may be corrupted in transmission
– Data may be protected against corruption using coding techniques (using parity bits).
Assume B0 = 1, B1 = 0, B2 = 1, B3 =0 for timing diagram below:
Clock
Load / shift
QA 1
QB 0
1
QC
Q D or D out B3 = 0 B2 B1 B0
Error control using Parity Bits
• Parity bit: an extra bit added to data. Used in the simplest error detecting code.
• Even parity: parity bit chosen to ensure there is an even number of logic 1s in
the whole data word.
• Odd parity: parity bit chosen to ensure there is an odd number of logic 1s in
the whole data word.
3 bits data with parity bit
Example: 3-bit data words with even and of data even odd
odd parity bits indicated in bold: 000 0000 1000
Draw a truth table and K-map for Even parity: 101 0101 1101
• 3 inputs B0, B1 and B2; 23= 8 input combinations 111 1111 0111
• Odd parity output, Podd and even parity output, Peven
B0 B1 B2 Podd. Peven
The checkerboard pattern in K-map indicates 0 0 0 1 0
that even parity can be implemented using XORs! 0 0 1 0 1
B0 B 1 0 1 0 0 1
B2 0 1 1 1 0
1 0 0 0 1
Peven = B0⊕ B 1 ⊕B 2 1 0 1 1 0
1 1 0 1 0
1 1 1 0 1
PISO Shift Register transmitter with parity bit
● Load/shift high: D flip-flops loaded with B0 – B3 (data with even parity bit, B3)
on active clock edge.
● Load/shift low: data shifts right on clock edge.
B0 B1 B2 B3 = Peven = B0 ⊕B1⊕
B2
Load /
shift AC AC AC AC
F F F F D out
Logic 0 B D Q B D Q B D Q B D Q
Clk Clk Clk Clk
Clock
Serial data receiver circuit with parity check
● Receives data from a serial communication link using a SIPO shift register
converting it to parallel data
● XOR gates perform a parity check – simple form of error detection. The error
is declared if even parity is not satisfied and requestion is sent for
retransmission. Q A
Q B Q Q C D
CLOCK
CLOCK
For RTL-layer design, the Finite St at e Machine (FSM) is a
general model capable of describing all machine structure and
behaviour. Other ("architectural") techniques exist, but are less
systematic, so require more human intervention.
2
ELEE08015 Digital System Design 2 Finite State Machine Design
... review
3
ELEE08015 Digital System Design 2 Finite State Machine Design
Finite State Machine Classification (RTL Block Structure)
Class-1 FSM
(codeword feed-forward only)
Delay Machine, Pipeline Machine
CLOCK CLOCK
4
ELEE08015 Digital System Design 2 Finite State Machine Design
Finite State Machine Classification (RTL Block Structure)
Class-2 FSM
(codeword feedback, output without external input)
State-Output Direct State-Transition Machine
CURRENT−STATE CODEWORD
CLOCK
Codeword feedback gives a complex behaviour but internal state clock
regulates codeword flow through State Register.
Internal state in state register evolves and determines output.
5
ELEE08015 Digital System Design 2 Finite State Machine Design
Finite State Machine Classification (RTL Block Structure)
Class-3 FSM
(codeword feedback, external input)
State-Output Conditional State-Transition Machine (Moore*)
CURRENT−STATE
CODEWORD
CLOCK
Codeword feedback gives complex behaviour but internal state clock
regulates codeword flow through State Register.
External input history modifies internal state hence the output.
* Moore, E.F. (1956) "Gedanken-experiments on Sequential Machines" Automata Studies, Annals of Mathematical Studies, 34,
129-153. Princeton University Press
6
ELEE08015 Digital System Design 2 Finite State Machine Design
Finite State Machine Classification (RTL Block Structure)
Class-4 FSM
(codeword feedback, external input, I/O bypass)
Conditional-Output Conditional State-Transition Machine (Mealy*)
CURRENT−STATE
CODEWORD
CLOCK
* Mealy, George H. (September 1955). "A Method for Synthesizing Sequential Circuits". Bell Systems Technical Journal
7
ELEE08015 Digital System Design 2 Finite State Machine Design
Larger-Scale Machine Structures: Modularity and Linked FSM
NEXT-STATE NEXT−STATE STATE OUTPUT MAPPING NEXT-STATE NEXT−STATE STATE OUTPUT MAPPING NEXT-STATE NEXT−STATE STATE OUTPUT MAPPING
LOGIC CODEWORD REGISTER LOGIC OUTPUT LOGIC CODEWORD REGISTER LOGIC OUTPUT LOGIC CODEWORD REGISTER LOGIC OUTPUT
rN PU T
rN PU T
GATES COMBINATIONAL SEQUENTIAL COMBINATIONAL GATES
GATES COMBINATIONAL SEQUENTIAL COMBINATIONAL
COMBINATIONAL SEQUENTIAL COMBINATIONAL GATES
GATES GATES
GATES
GATES GATES
CLOCK CLOCK
CLOCK
NEXT-STATE NEXT−STATE STATE OUTPUT MAPPING NEXT-STATE NEXT−STATE STATE OUTPUT MAPPING
LOGIC CODEWORD REGISTER LOGIC OUTPUT LOGIC CODEWORD REGISTER LOGIC OUTPUT
rN PU T
rN PU T
COMBINATIONAL SEQUENTIAL COMBINATIONAL GATES
COMBINATIONAL SEQUENTIAL COMBINATIONAL GATES
GATES GATES
GATES
GATES
CLOCK CLOCK
CLOCK CLOCK
INPUT 2
8
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - RTL Structure: Shows Body but not Soul
FINITE STATE MACHINE: STRUCTURE in Register Transfer Language
(current state codeword FEEDBACK)
WHAT IS IT THINKING?...
CODED VALUES & OPERATION CODED VALUES & OPERATION
input output input output INTERNAL STATE ORGANISATION
a2 a1 a0 b1 b0 y1 y0 z1 z0 Output is COPY of input a2 a1 a0 b1 b0 y1 y0 z1 z0
1 0 1 1 0 0 1 1 1 FROM
1 0 1 1 0 0 1 1 1 ...ANOTHER LANGUAGE IS NEEDED
1 1 0 1 0 1 1 0 0 1 1 0 1 0 1 1 0 0
1 0 1 0 PREVIOUS CLOCK PERIOD 0 1 1 1 0 1 0 1 0
0 1 1 1 0
VIH DANGER ZONE VIH
A LOGIC LANGUAGE description of MORE A LOGIC LANGUAGE description of MORE 50%
transitions forbidden
input data (D)
50%
rN
ABSTRACT LANGUGE, suitable for ABSTRACT LANGUGE, suitable for VIL
VI VO
OUT
VIL
VI VO
IN
translation to PHYSICAL circuits and signals translation to PHYSICAL circuits and signals VOH
time OUT D Q VOH
time
tsu tPD
50%
tPHL/ tPLH tdf / tdr
CLOCK Ck 50%
tPHL/ tPLH tdf / tdr
VOL VOL
t su th
Arrangement of INTERNAL STATES CRYPTIC sort out physical-layer imperfections ... later
RTL structure brings circuit clarity, but limited insight into behaviour
The state structure (evolving in the state register) gives a complex behaviour.
The abstract state structure is obscure - only physical storage obvious in RTL
9
ELEE08015 Digital System Design 2 Finite State Machine Design
... REVIEW
10
ELEE08015 Digital System Design 2 Finite State Machine Design
The Finite State Machine
(Algorithmic) State Machine, ASM, FSM
Combinational logic (Truth Table) gives simple behaviour:
• output depends directly on input
Feedback in FSM structure produces complex behaviour: output depends
on internal state which depends on sequence of many past inputs, e.g.
• Constant input (or none) may give regularly (clock) changing output
• Regularly changing input may give constant output
Output depends on current internal state
• The evolution of the current state is influenced by external input, if any
• Number and arrangement of possible states finite/fixed (hence name)
Engineer designs abstract state structure:
a) number of states, b) their relation to input and c) their control of output
- Automation (+help) translates state structure to physical circuit
• can synthesise many circuits with same behaviour - physical differences
11
ELEE08015 Digital System Design 2 Finite State Machine Design
The ASM Chart Language:
A formal language with precise usage and meaning (strict grammar)
• elements may only be used as formally defined
— Cannot invent our own language interpretation
* not a flowchart - different language/syntax/semantics
— Formality necessary for automated processing – CAD
Symbolic and Easy to Read/Write
Strong Structure:
• Most types of incompleteness are obvious
• Most types of ambiguity are obvious
12
ELEE08015 Digital System Design 2 Finite State Machine Design
ASM Chart: Illustration of Correct Construction (Syntax)
(Class 3 FSM: conditional transition, state output)
13
ELEE08015 Digital System Design 2 Finite State Machine Design
Elements (Vocabulary) of the ASM Chart Language
STATE NAME
State Box:
LOOK, RUN unique name written in elipse by upper left corner
Output value(s) constant for state duration
Only True output values written inside the box
State Transition Decision Box:
0
INPUT
1 true/false exit path decision based on
the condition of the named input(s)
no dynamic conditions (no input change, only static true/false)
State Transition Link:
indicates path to (alternative) next state(s)
no delay or logic function
no state/input/output function
14
ELEE08015 Digital System Design 2 Finite State Machine Design
Principal Unit of the ASM Chart — The ASM Block
FSM instantaneously in a single (new) state at
start of clock period for the whole period
Logic outputs named in state box are S NAME
OUTPUT_X
true while state active. That is all other OUTPUT_Y
period. 1
1
INPUT_C
Transition to (new) next state, selected by 0
0
Decision Box (Triangular Ends)
INPUT
1
Enter decision box at top, Exactly two exits: choose from each side and bottom
Inside box: Logic expression of one or more INPUT logic symbols, result True or False
0
INPUT(s)
1 Tests only signal true/false value, no sequence property (no edge test, no pulse test, ...)
Represents no part of a clock period, no time delay (ideal truth−table)
Box order sets only logical precedence of inputs (no time order or sequence of test)
Transition/Link Line
Lines may merge but not split (split with decision box)
Every loop must include one or more state boxes (no loops around decision boxes
alone) Represents no part of a clock period, no time delay
Conditional Output Box (Round Ends) Class−4 Machines Only − not used in this course
STATE 1
STATE N
STATE N
SIG
STATE 2
IN
wrong direction
wrong face
17
ELEE08015 Digital System Design 2 Finite State Machine Design
ASM Chart: Illustrations of Unusual Syntax
(Require Special Attention for Synthesis)
S_FINAL S_INITIAL
18
ELEE08015 Digital System Design 2 Finite State Machine Design
The Finite State Machine: Design Process
1 Define and encode names for logic signal inputs:
switch, temperature, number value, … these affect internal state
2 Define and encode names for logic signal outputs: lamp, heater,
number value, … these are driven by internal state
3 Design required behaviour (algorithmic structure):
define the number, the names for, and sequence of, internal states
- to create particular output value sequence(s)
- Output names in state boxes
- to match/detect particular input value sequences
- Input names in decision boxes
19
ELEE08015 Digital System Design 2 Finite State Machine Design
VL5.2 FSM Design Using ASM chart
The FSM - Traffic Light Examples
Stage 1: I/O Names and Logic/Bit Mapping
NANO STREET
RED
INPUTS:
TLS_NS VEHICLE PRESENT => TRUE
TLS_EW VEHICLE PRESENT => TRUE
GREEN
SENSOR
TRAFFIC
OUTPUTS:
GREEN
NS_RED TRUE => LAMP ON
RED
NS_GRN TRUE => LAMP ON
EW_RED TRUE => LAMP ON
EW_GRN TRUE => LAMP ON ELECTRON WAY
2
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - Traffic Light Examples
Stage 1: I/O Codewords and Semantic Mapping (Meaning)
RED RED
GREEN GREEN
STOP PROCEED ? ?
WITH CAUTION (hazardous) (fail−safe)
3
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - Traffic Light Example 1 (Class-2, no input)
Stage 2: Behaviour: Output-Codeword Sequence
NANO STREET
RED RED
RED RED
GREEN GREEN
GREEN
RED
STOP PROCEED
W ITH CAUTION
ELECTRON WAY
RED
GREEN
Notes:
RED RED
4
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - Traffic Light Example 1 (Class-2, no input)
Stage 2: Behaviour: State Sequence
NANO STREET
RED RED
RED RED ALL_STP_A
NS_RED GREEN GREEN
EW_RED
GREEN
RED
STOP PROCEED
W ITH CAUTION
ELECTRON WAY
RED EW_PWC
NS_RED
GREEN EW_GRN
ASM Chart Notes:
ALL_STP_B States:
RED RED
NS_RED ALL_STP_A,
EW_RED ALL_STP_B: Allow moving traffic to stop before
permitting flow on other carriageway.
NS_PWC EW_PWC,
RED
NS_GRN NS_PWC: Permit flow on only one carriageway.
GREEN
EW_RED
5
ELEE08015 Digital System Design 2 Finite State Machine Design
The Finite State Machine: Design Process
6
ELEE08015 Digital System Design 2 Finite State Machine Design
CURRENT−STATE CURRENT−STATE
CODEWORD
... recapitulation CODEWORD
CLOCK CLOCK
calculates the next state value, using the New behaviour due to feedback poorly expressed
NEED HIGHER LEVEL LOGIC BEHAVIOUR LANGUAGE
7
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - Traffic Light Examples
Stage 1: I/O Names and Logic/Bit Mapping
NANO STREET
RED
INPUTS:
TLS_NS VEHICLE PRESENT => TRUE
TLS_EW VEHICLE PRESENT => TRUE
GREEN
SENSOR
TRAFFIC
OUTPUTS:
GREEN
NS_RED TRUE => LAMP ON
RED
NS_GRN TRUE => LAMP ON
EW_RED TRUE => LAMP ON
EW_GRN TRUE => LAMP ON ELECTRON WAY
8
ELEE08015 Digital System Design 2 Finite State Machine Design
The FSM - Traffic Light Example 1 (Class-2, no input)
Stage 2: State Sequence and Output Definition
NANO STREET ELECTRON WAY
NANO STREET
RED RED
RED RED ALL_STP_A
NS_RED GREEN GREEN
EW_RED
GREEN
RED
STOP PROCEED
WITH CAUTION
ELECTRON WAY
RED EW_PWC
NS_RED
GREEN EW_GRN
ASM Chart Notes:
States:
ALL_STP_B
RED RED
ALL_STP_A,
NS_RED ALL_STP_B: Allow moving traffic to stop before
EW_RED permitting flow on other carriageway.
EW_PWC,
NS_PWC: Permit flow on only one carriageway.
9
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 2a (Class-3 FSM)
ASM Chart Notes:
ALL_STP: Allow moving traffic to stop before
ALL_STP permitting flow on other carriageway.
NS_RED
Rapid response when little traffic.
EW_RED
EW_PWC,
NS_PWC: Permit flow on only one carriageway.
0 1
TLS_NS
NANO STREET
RED
0
TLS_EW
GREEN
SENSOR
TRAFFIC
GREEN
RED
1
EW_PWC NS_PWC
NS_RED NS_GRN ELECTRON WAY
EW_GRN EW_RED
TRAFFIC
SENSOR
10
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 2a (Class-3 FSM)
ALL_STP
ALL_STP NS_RED
NS_RED EW_RED
EW_RED Identical
Truth Tables 0
TLS_EW
0 1
TLS_NS 1 0
TLS_NS
0
0 1 1
TLS_EW
TLS_NS
1
EW_PWC NS_PWC EW_PWC NS_PWC
NS_RED NS_GRN NS_RED NS_GRN
EW_GRN EW_RED EW_GRN EW_RED
11
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 2a (Class-3 FSM)
ASM Chart Notes:
ALL_STP: Allow moving traffic to stop before
ALL_STP permitting flow on other carriageway.
NS_RED
EW_RED Rapid response when little traffic.
BEWARE − PERSISTENT NS
TRAFFIC BLOCKS EW TRAFFIC.
0 1 EW_PWC,
TLS_NS
NS_PWC: Permit flow on only one carriageway.
NANO STREET
RED
TLS_EW
GREEN
1
SENSOR
TRAFFIC
EW_PWC
GREEN
NS_PWC
RED
NS_RED NS_GRN
EW_GRN EW_RED ELECTRON WAY
TRAFFIC
SENSOR
12
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 2b (Class-3 FSM)
ASM Chart Notes:
ALL_STP: Allow moving traffic to stop before
ALL_STP permitting flow on other carriageway.
NS_RED
EW_RED Rapid response when little traffic.
BEWARE − PERSISTENT EW
TRAFFIC BLOCKS NS TRAFFIC.
0 1 EW_PWC,
TLS_NS
NS_PWC: Permit flow on only one carriageway.
0 1 1 0
NANO STREET
TLS_EW TLS_EW RED
GREEN
SENSOR
TRAFFIC
GREEN
EW_PWC NS_PWC
RED
NS_RED NS_GRN
EW_GRN EW_RED ELECTRON WAY
TRAFFIC
SENSOR
Graphical order of input tests drawn as before, but logic of structure (Truth table)
now gives TLS_EW precedence, so unfair priority now goes to waiting EW
traffic. What does fairness require?
Alternate between two decision structures by remembering previous direction
priority: additional states give memory of previous direction ☞
13
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 2c (Class-3 FSM)
ALL_STP_NS ALL_STP_EW
NS_RED NS_RED
EW_RED EW_RED
0 1 1 0
TLS_NS TLS_EW
EW_PWC2
0 0
NS_RED TLS_NS
TLS_EW
EW_GRN
NS_PWC1
1 1
NS_GRN
EW_PWC1 NS_ PWC2
EW_RED
NS_RED NS_GRN
EW_GRN EW_RED
This FSM does not count the number of vehicles waiting/moving, so a subtle bias is
still present.
14
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 3 (LINKED FSMs)
FSM_A ALL_STP
NS_RED
EW_PREV
PRI_NS = 1
EW_RED
Road Signals 1 0
0
ACT_NS
PRI_NS
1
1
1
TLS_NS TLS_EW
NS_PREV
0 0 PRI_NS = 0
0 0
TLS_EW TLS_NS
0 1
1 1 ACT_EW
15
ELEE08015 Digital System Design 2 Finite State Machine Design
Traffic Light Example 3 (LINKED FSMs)
Translation to RTL Structure
ACT_NS
NEXT−STATE NEXT−STATE STATE OUTPUT MAPPING OUTPUT
LOGIC CODEWORD REGISTER LOGIC
CLOCK CLOCK
16
ELEE08015 Digital System Design 2 Finite State Machine Design
By using successive stages/layers of abstraction, we have designed a quite complex
system of subsystems
At each stage, only problems relevant to that layer are solved, turning one large
complex task into many smaller simpler essentially independent tasks
Process not perfect, a decision in one layer may cause problems in another, requiring
a previous layer to be revisited, but the approach is generally effective
Using it, we have designed a digital machine (previous two slides) needing about 40
NAND gates (160 transistors) for its construction, without ever needing to know what a
NAND gate or transistor is…
Stage 2 is complete
17
ELEE08015 Digital System Design 2 Finite State Machine Design
VL6.1 Design Synthesis I: Fabrics
... review of design layers
FSM Behavioural Structure - ASM Chart Model
2
ELEE08015 Digital System Design 2 Design Synthesis I
... review of design layers
FSM Function Block Structure (Register Transfer Model)
3
ELEE08015 Digital System Design 2 Design Synthesis I
... review of design layers
FSM Gate-Level Structure (Logic Switching Netlist Model)
4
ELEE08015 Digital System Design 2 Design Synthesis I
... review of design layers
Transistor-Level Structure (Analogue/Physical Model)
5
ELEE08015 Digital System Design 2 Design Synthesis I
Synthesis of Physical Circuits
The following lectures explore the SYNTHESIS of physical (non-ideal)
realisations of the desired abstract (ideal) behaviour which must meet
physical/commercial constraints
non−finite state structure, which is data dependent S_A if (++a) return rf(a);
F_9 return a;
}
symbolic behaviour (non−Adaptive): ASM Chart, Synthesisable Verilog 0
Q_8
LOGIC
higher abstract logic: Register Transfer Language (RTL)
CODEWORD transforms and storage NEXT−STATE STATE
LOGIC REGISTER
Q
6
ELEE08015 Digital System Design 2 Design Synthesis I
Synthesis of Physical Circuits
7
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements
8
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements - overview
9
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements
Custom Gate ASIC
10
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements
Library Cell ASIC
11
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements
FPGA
12
ELEE08015 Digital System Design 2 Design Synthesis I
Fabric Examples and Elements
Computer Processor/Microcontroller
All physical circuit features, physical logic architecture, and certain logical
behaviour features (serialisation) fixed by physically pre-constructed chip.
•chip fabrication process already complete
•logic and interconnect structure complete (fixed by chip)
•programmable logical behaviour, with serialisation restrictions (designer)
Potentially rapid design and short time-to-market
Physical chip size, speed, energy trade-off mostly fixed by choice of chip
Acceptable technical performance possible at moderate to low commercial
cost. Almost any sales volume can be accommodated.
13
ELEE08015 Digital System Design 2 Design Synthesis I
Custom/Library CMOS ASIC
14
ELEE08015 Digital System Design 2 Design Synthesis I
FPGA — Physical Structure
15
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: Look-Up Table (LUT) Logic
(‘‘Truth Table In A Box’’)
A
LUT F
B
PROGRAM
BITS (function)
P3 P2 P1 P0
A
SOP
F
TERMS
B
16
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: Look-Up Table (LUT) Logic
17
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: The Logic Cell
18
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: The Logic Cell
19
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: Programmable Interconnect
SWT
BOX
20
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: Programmable Interconnect
Single logic cell more complex than simple NAND or D-FF, but too small for
whole solution to most non-trivial problems
• Most commercial cell designs incorporate only one or two flip-flops and not
usually more than five or six inputs and two outputs
Hence PLACE logic across cells AND ROUTE signals between them to
compose more complex structures
21
ELEE08015 Digital System Design 2 Design Synthesis I
Simplified FPGA Architecture: Programmable Interconnect
22
ELEE08015 Digital System Design 2 Design Synthesis I
Synthesis Parameters - ASIC vs FPGA - Simple Summary
FPGA: Combinational functions: LUT FAN-IN limit: below limit, complexity COST-FREE, BUT
if function doesn’t fit in single LUT then at least 3 cells needed + extra interconnect
EXPENSIVE
Flip-flops cheap (1 in every cell) if used, expensive if wasted (not used).
??? replace combinational logic with flip-flops !!! yes, but not directly...
Interconnect cheap up to threshold density, then very expensive: routing congestion -
use cells as wire: F = A (!!!), or leave cells unused (costly)
Field upgrade possible, allowing post-release design improvement/correction (shorter time
to market).
ASIC: Combinational logic may share terms (factorisation): high fan-in functions CHEAP in
area, but slow. cost changes smooth, but finding optimum expensive.
Flip-flops more expensive than combinational functions:
??? replace flip-flops with combinational logic !!! yes, but not directly...
Can trade-off interconnect area cost with logic density, at any scale: interconnect cost
and difficult routing problems less frequent than FPGA.
Errors found post-fabrication very costly: longer time to market, but low cost per unit.
23
ELEE08015 Digital System Design 2 Design Synthesis I
6.2 Design Synthesis I: State Code Design
FSM State Encoding: The State-Code (State Map)
2
ELEE08015 Digital System Design 2 Design Synthesis I
... PREVIEW
State Code Design and The Transition Table
STATE CODE DESIGN STYLE:
choice of style guided by fabric properties and technical/commercial performance targets
Within EACH STYLE, MANY DIFFERENT (unique) CODE DESIGNS possible
EACH UNIQUE design of STATE CODE gives DIFFERENT PHYSICAL structure and
TECHNICAL performance, but IDENTICAL ALGORITHMIC behaviour to others
CODE DENSITY directly affects number of flip-flops, one per codeword bit - indirectly affects
combinational logic complexity (FLIP-FLOP <=> NAND GATE TRADE-OFF, ASIC vs FPGA)
3
ELEE08015 Digital System Design 2 Design Synthesis I
The State-Code - Choice of Style
Consider three styles for generating the state-code (others possible):
• Unit-Distance (UD)
• 1-Hot (1H)
• Direct State-Output Map (DSOM)
CHOICE of style GUIDED BY THE SYNTHESIS PARAMETERS seen earlier
Particular properties of each style/scheme do not predict exact technical
performance outcomes, but bias physical performance in particular directions
MANY DIFFERENT CODES possible, in same or different style, giving
MANY DIFFERENT CIRCUITS, all with
Identical behaviour but different physical properties
• This stage of synthesis gives most opportunity for optimising use of the fabric.
Can generate and evaluate several codes (design time cost), but exhaustive search
for best is impractical. No analytical evaluation process known.
Mixed-Styles and others not studied here are possible
4
ELEE08015 Digital System Design 2 Design Synthesis I
The State-Code - Effect of Density
Density affects number of flip-flops in circuit: one FF per codeword bit
In some state-code styles, density can be made high or low, according to design
choice in code construction details
Dense codes generally lead to combinational logic with high fan-in (many inputs
combined to each output). This may lead to poor FPGA logic cell utilisation, but
may give efficient combinational gate area use in ASIC
Dense codes may ease clock energy consumption in circuits with a very high
number of states (fewer flip-flops to be driven by clock signal)
5
ELEE08015 Digital System Design 2 Design Synthesis I
State Code Style: Unit Distance
Key property: sequentially adjacent codewords differ in only one bit.
Recall Gray, Johnson and thermometer codes.
Natural sequence defined by state transition sequence, visible on ASM chart
Single state-register bit change per state transition implies low signal switching
activity, hence potential for low energy.
Synthesis of glitch-free output mapping logic made easier.
Can be designed with high or low density (e.g. Gray vs. thermometer), so can be
optimised for either ASIC or FPGA.
EXACT unit-distance for ALL transitions is not always (easily) possible, and may
not be essential - e.g. for power consumption benefit.
If exact unit-distance is required, it may be achieved by duplicating certain states
(two states, different state codes, same behaviour), or by adjustments to
behavioural description (addition of extra "link" states).
A KARNAUGH MAP, or similar tool which displays codewords in unit-distance
adjacency, assists construction of such codes.
6
ELEE08015 Digital System Design 2 Design Synthesis I
Unit-Distance Style: Example
01 00 10
EAGER GRUMPY DOZY S1 S 0
LOOK, RUN LOOK LOOK STATE STAT E
NAME CODEW RD
0 1 0 S1 S0
COLD && WET COLD 11
ASLEEP
1 EAGER 0 1
1 0 GRUMPY 0 0
COLD
1 DOZY 1 0
WET
0 ASLEEP 1 1
S
S
0 0 1
1
7
ELEE08015 Digital System Design 2 Design Synthesis I
Unit-Distance Style: Example
8
ELEE08015 Digital System Design 2 Design Synthesis I
State Code Style: 1-Hot
Key property: one bit per state, each codeword has one bit true ("hot") and all
others false.
As with all codes where some available codewords are not assigned to states in the
FSM, the consequences of an invalid codeword appearing in the state register must
be addressed (see later).
9
ELEE08015 Digital System Design 2 Design Synthesis I
1-Hot Style: Example
0001 0010 0100 S3 S2 S1S0
EAGER GRUMPY DOZY
LOOK, RUN LOOK LOOK STATE STATE
NAME CODEWORD
0 1 0
1000
S3 S2 S1 S 0
COLD && WET COLD
ASLEEP
1 EAGER 0 0 0 1
1 0 GRUMPY 0 0 1 0
COLD
1 DOZY 0 1 0 0
WET
0 ASLEEP 1 0 0 0
Sparse code: Many potential codewords not used to represent valid FSM states.
10
ELEE08015 Digital System Design 2 Design Synthesis I
State Code Style: Direct State-Output Map
Key property: OUTPUT CODEWORD is a FIELD within STATE CODEWORD,
so no additional logic is required for generation of the output signals.
Starting point for creating code is list of output codewords for each state. If all the
output codewords are unique, then these may be used as the state codewords,
without modification. Otherwise, extra bits must be added to each state codeword,
and given different values for the states where the output codewords are identical.
All outputs taken directly from (clocked) flip-flops, so Direct State-Output Mapping
can be particularly useful where output signal delay or output signal skew (synthesis
performance parameter) must be tightly controlled
Depending on the application, it may be sufficient to direct-map just a subset of
the output signals.
Direct State-Output mapping may arise naturally in conjunction with other code
styles, according to the state-codeword/output-codeword relationships and specific
code design.
11
ELEE08015 Digital System Design 2 Design Synthesis I
Direct State-Output Map Style: Example
*11 010 110
EAGER GRUMPY DOZY S2 S1S0
LOOK, RUN LOOK LOOK
0 1 0
COLD && WET COLD *00
ASLEEP
1
1 0
COLD
1
WET
0
RUN direct mapped to S 0
LOOK direct mapped to S 1
State codeword bit S2 is added (making the code sparse) to distinguish states GRUMPY
and DOZY, which do not differ in S0 and S1 due to the direct mapping of those bits to
RUN and LOOK (o/p same in both states)
The use of DON’T CARE for S2 in EAGER and ASLEEP indicates a FREE CHOICE of
1/0 to a later stage of synthesis (increasing potential for optimisation).
It DOES NOT indicate multiple state codewords per state
12
ELEE08015 Digital System Design 2 Design Synthesis I
State Code Style: Summary of Examples
STATE UNIT DISTANCE STATE 1−HOT STATE STATE−OUTP T
NAME CODEWORD NAME CODEWORD NAME CODEWOR D
S1 S0 S S2 S1 S S2 S1 S0
0
0 1 0
THREE codes, derived from COLD && WET COLD
ASLEEP
imply: 1
WET
13
ELEE08015 Digital System Design 2 Design Synthesis I
Design Flow: Linking Design Views and Processes
BEHAVIOURAL LOGICAL
REQUIREMENTS STRUCTURE
STATE−CODE
MAP
TRANSITION TRUTH TABLES LOGIC FUNCTION PHYSICAL GATE PHYSICAL GATE PHYSICAL
TABLE N/S + O/P LOGIC OPTIMISATION STRUCTURE PLACE AND ROUTE FABRICATION
S 1 S 0
A B S+S+1 0
YZ
STATE ENCODING 0 0 0 0 0 1 0 1
0 0 0 1 0 1 0 1
STATE STATE 0 0 1 0 0 0 0 1
NAME CODEWORD
0 0 1 1 0 0 0 1
WILMA 01010011100
+ =>
0 1 0 0 1 0 0 1
FRED 10110011101 0 1 0 1 1 0 0 1
PEBBLE 00010010101 0 1 1 0 1 0 0 1
0 1 1 1 1 0 0 1
BETTY 00110111101 1 0 0 0 1 0 0 0
1 0 0 1 1 0 0 0
BARNEY 10101101101
1 0 1 0 1 1 0 0
DINO 10100000001 1 0 1 1 0 0 0 0
Fourth stage: Construct TRANSITION TABLE from the ASM Chart link paths
and the State Code Table
This is a completely automated process - no design input required
14
ELEE08015 Digital System Design 2 Design Synthesis I
Transition Table Fields
STATE INPUT NEXT STATE OUTPUT CURRENT−STATE
+ + Y Z
CODEWORD
S1 S 0 A B S1 S0
0 0 0 0 0 1 0 1 NEXT−STATE STATE
NEXT−STATE OUTPUT MAPPING
0 0 0 1 0 1 0 1 LOGIC CODEWORD REGISTER LOGIC OUTPUT
0 0 1 0 0 0 0 1 INPUT
COMBINATIONAL MEMORY COMBINATIONAL
0 0 1 1 0 0 0 1 GATES GATES GATES
0 1 0 0 1 0 0 1
0 1 0 1 1 0 0 1
0 1 1 0 1 0 0 1 CLOCK
0 1 1 1 1 0 0 1
1 0 0 0 1 0 0 0
1 0 0 1 1 0 0 0
1 0 1 0 1 1 0 0
1 0 1 1 0 0 0 0
1 1 0 0 1 1 1 1
1 1 0 1 1 1 1 1
1 1 1 0 1 1 1 1
1 1 1 1 0 0 1 1
15
ELEE08015 Digital System Design 2 Design Synthesis I
The Transition Table
STATE INPUT NEXT STATE OUTPUT
STATE STATE
EAGER GRUMPY DOZY NAME CODE COLD WET + + RUN LOOK
LOOK, RUN LOOK LOOK S 1 S 0
S1 S 0
S 1 S
0
0 1 0
0 0 0 0 0 1 0 1
COLD && WET COLD 0 0 0 1 0 1 0 1
ASLEEP EAGER 1 1
0 0 1 0 0 0 0 1
1 0 0 1 1 0 1
0 0
GRUMPY 0 0
1 0 0 1 0 0 1 0 0 1
COLD 0 1 0 1 1 0 0 1
DOZY 0 1
0 1 1 0 1 0 0 1
1
WET ASLEEP 1 0 0 1 1 1 1 0 0 1
1 0 0 0 1 0 0 0
0 1 0 0 1 1 0 0 0
1 0 1 0 1 1 0 0
STATE−CODE MAP
ASM CHART (BEHAVIOURAL STRUCTURE) 1 0 1 1 0 0 0 0
1 1 0 0 1 1 1 1
1 1 0 1 1 1 1 1
INPUT, STATE, NEXT−STATE and OUTPUT codewords 1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
1
combine to describe the
TRANSITION TABLE (LOGIC STRUCTURE)
FSM STRUCTURE in BOOLEAN LOGIC
For each link path in the ASM Chart, one row is entered into the
transition table. Each row has two principal fields:
• Input data: concatenated STATE and INPUT codewords
— Class-2: there is no input codeword.
• Output data: concatenated NEXT-STATE and OUTPUT codewords
— Class-3: output codeword not dependent on input codeword (only
state)
16
ELEE08015 Digital System Design 2 Design Synthesis I
The Transition Table
STATE STATE STATE INPUT NEXT STATE OUTPUT
EAGER GRUMPY DOZY + + RUN LOOK
NAME CODE S S COLD WET S S
LOOK, RUN LOOK LOOK 1 0 1 0
S S
1 0 0 0 0 * 0 1 0 1
0 1 0
COLD && WET COLD
ASLEEP EAGER 1 1
0 0 1 * 0 0 0 1
1
0 1 * * 1 0 0 1
GRUMPY 0 0 1 0 0 * 1 0 0 0
1 0 1 0 1 0 1 1 0 0
COLD
DOZY 0 1 1 0 1 1 0 0 0 0
1
WET ASLEEP 1 0 1 1 0 * 1 1 1 1
1 1 1 0 1 1 1 1
0
1 1 1 1 0 0 1 1
STATE−CODE MAP
BEHAVIOURAL STRUCTURE TRANSITION TABLE
Where ASM decision trees (diamond clusters) have few alternate outcomes,
using don’t-care symbol (*) makes the transition table more compact.
Essentially different from a truth table: during any given clock period, only
the row(s) corresponding to the (single) current state are relevant.
During any given clock period, in a current-state row, the next-state codeword
shows which row(s) of the table will describe external input/output relation
during the following clock period.
17
ELEE08015 Digital System Design 2 Design Synthesis I
7.1 Design Synthesis II:
Timing consideration and initialisation
Digital System Technical Performance
SIMPLIFIED three-way categorisation of technical performance:
• POWER
— or a more appropriate "energy per unit result" measure
• AREA
— ASIC: literal die size in square millimetres
— FPGA: cell utilisation (% chip active) or number of chips
• SPEED
— THROUGHPUT: result per second (recall class-1 FSM)
LATENCY: total delay in production of single result unit
—
NOT SIMPLE to control these parameters independently
OFTEN a trade-off (balance) or one critical (dominant)
Commercial targets may also have indirect influence
ALL THREE (and others) ARE IMPORTANT performance
measures, but we shall just focus on speed (which is sometimes what
people mean when they just say "performance")
2
ELEE08015 Digital System Design 2 Design Synthesis II
Speed: Propagation Delay Prediction/Calculation
Synthesis uses MODELS to predict signal delay through network of logic gates.
Different complexity of models available — accuracy vs. computational effort
• FABRICATION PROCESS MEASUREMENTS and MODELLING:
Used to model individual transistors and generate parameters for simpler models
- measure test structures and calculate complex integrals over device geometry: extract
parameters: gm Rds Cgg Cdd &c., under various operating conditions, to use in
simpler models. Suitable only for individual transistors or very simple gate structures
• TRANSISTOR-LEVEL MODELLING (e.g. SPICE)
Used to model individual gates or critical simple gate networks
- Uses gm/Rds/Cgg/Cdd/... derived above for analogue circuit model of interconnect and
gate. Computationally expensive for even a few gates. Usually used for worst-case
modelling of whole gates and calculation of parameters for simpler models: tR tF tPD Ci
• SWITCH-LEVEL SIMULATION
Used for most interconnect and gate network modelling
- Take tPD value (above) defined at standard load, apply simple linear adjustment for
interconnect and gate-input (fan-out) LOAD CAPACITANCE
Computationally simple enough for effective (re-)SIMULATION DURING SYNTHESIS,
but may (should!) be pessimistic - WORST-CASE MODELLING.
3
ELEE08015 Digital System Design 2 Design Synthesis II
Propagation Delay Model for CMOS Logic Gates
+Vdd +Vdd
R_pmos
R
R_nmos
50%
C_gg C_dd C
4
ELEE08015 Digital System Design 2 Design Synthesis II
Propagation Delay Models for Interconnect (‘‘wire’’)
• On-Chip SHORT INTERCONNECT:
Essentially zero resistance, but significant CAPACITANCE
Add extra capacitance to output of logic gate model: tPD of gate increases
• On-Chip LONG INTERCONNECT:
Significant RESISTANCE (+routing switches in FPGA) with CAPACITANCE
Use Resistance-Capacitance model for separate interconnect tPD parameter:
Rwire
50%
Cwire
5
ELEE08015 Digital System Design 2 Design Synthesis II
System-Critical Interconnect Delay
CLOCK SKEW
Clock Skew: DIFFERENCE IN ARRIVAL TIME OF SAME CLOCK EDGE AT INDIVIDUAL FLIP-FLOPS
Absolute delay value from clock source to any flip-flop not usually a significant
concern, but clock skew can be a major concern in medium and large systems
A B
FF5 FF1
DQ DQ DQ
CK CK CK DQ
t5 t1 t3 CK
DQ t4
CLOCK t0 CK
t2
MAXIMUM DIFFERENCE in clock interconnect delay (clock skew tcs) in figure above
is t5 -t1. CLOCK EDGES arrive tcs later at FF5 than at FF1.
A)Q-FF5 data signal has tcs less time to reach D-FF1 before next clock edge:
this situation makes clock skew equivalent to extra data propagation delay
B)Q-FF1 data signal to D-FF5: FF5 MAY NEVER capture input correctly...
Q-FF1 data change starts before completion of D-FF5 hold-time
6
ELEE08015 Digital System Design 2 Design Synthesis II
... recapitulation
Combinational Gate Propagation Delay: Data I/P to Data O/P
VIH
50%
VIL VI VO
time
VOH
50%
tPD or td
VOL
time
tPD tPD
7
ELEE08015 Digital System Design 2 Design Synthesis II
... recapitulation
Flip-Flop Propagation Delay: CLOCK Change to Data O/P Change
DANGER ZONE
input data input data (D) input data
may change transitions forbidden may change
D Q
tsu Ck tPD
t su th
th
t PD
8
ELEE08015 Digital System Design 2 Design Synthesis II
Synthesising FSM Circuitry — Timing Constraints
SYNCHRONOUS DESIGN: every data signal starts from a flip-flop, passes through
combinational logic and/or interconnect, arrives at a flip-flop.
The flip-flops ensure that TIME (re-)STARTS AT each active CLOCK EDGE:
(1) this edge may be slightly late, due to clock skew at the source flip-flop
(2) the data signal must propagate to the source flip-flop output, then:
(3) propagate through interconnect to a combinational gate input, then:
(4) propagate through the combinational gate, then:
... (2) and (3) may happen any number of times, from zero upward
(4) propagate through interconnect to a flip-flop input, then:
(5) remain steady for no less than the flop-flop setup time, before:
(6) the NEXT clock edge arrives at the destination flip-flop, which:
(7) may happen slightly early (skew again).
9
ELEE08015 Digital System Design 2 Design Synthesis II
Timing Constraints — Calculation and Application
MINIMUM CLOCK SIGNAL PERIOD governed by the WORST-CASE possible
combination of time values for getting any data signal from a flip-flop o/p to the
next flip-flop i/p
Time parameter values obtained by measurements and/or modelling.
Increased accuracy of calculation brings greatly increased computational
complexity — time/effort required to get result.
Use gross approximations to estimate timing properties at very abstract
(high-level) design description layers
General use of moderate accuracy models/calculations in early stage(s) of
synthesis process — to RTL or gate-layer.
Selective use of high-accuracy at lowest layer(s) IF/WHEN most time-critical
sub-section of design is identified AND can not readily meet target by
ALTERNATIVE SYNTHESIS approach.
ALWAYS making calculated result WORST-CASE (pessimistic)
10
ELEE08015 Digital System Design 2 Design Synthesis II
Class-2 FSM Clock Period
Budget
11
ELEE08015 Digital System Design 2 Design Synthesis II
Class-3 FSM Clock Period Budget
t
STATE−LOGIC INTERCONNECT: TOTAL PROPAGATION DELAY: PD−is
Flip-Flop data input must remain stable for minimum period th AFTER active
clock edge, as well as being stable for set-up period before edge, so new
codeword must arrive neither too late, nor too early.
Not usually troublesome, unless total propagation delay very small (shift-
registers) or clock skew large.
tPD-t - tcs > th N.B: NO RELATION to clock period (tck)
CANNOT FIX hold-time problem by changing clock period
must REDUCE clock skew or ADD EXTRA DELAY to problem data signal:
Note that here MINIMUM tPD value is the worst-case for hold time
calculations.
13
ELEE08015 Digital System Design 2 Design Synthesis II
Gate-Level Synthesis: Logic Function Optimisation
• Boolean algebraic transforms, term minimisation (K-map), and methods
not covered in this course may be applied to the Truth Tables, either
individually or jointly (common-term sharing), to meet performance
targets
• The presence of any "don’t care" conditions in the Truth Tables may be
exploited at this stage. This includes "partial decoding" of the state
codewords produced by sparse state-encoding styles, whereby the
evaluation of just one or a few key bits of the codeword is sufficient to
identify the state, implicitly making other bits "don’t care"
• For some fabrics and/or applications, specific optimisations may be weak
or useless, but would increase design time (commercial cost)
• For some fabrics certain transformations would be undone by later,
fabric structure specific processing, making futile the use of those
transforms
• As so often in digital system design, the engineer’s role is not to carry out the
brute effort of processing, but to apply both specific knowledge and heuristic
insight, to select or reject processing options available from the CAD tool
chest, guiding the force applied by the tools to give best effect
14
ELEE08015 Digital System Design 2 Design Synthesis II
Gate-Level Synthesis: Map Logic to Physical Gate Structure
We have seen how in an ASIC the 8-input AND function may usefully be re-
mapped into a NAND/NOR cascade of lower fan-in gates.
For an FPGA logic cell employing LUT combinational logic, the fan-in limit is
critical and the Boolean function complexity otherwise irrelevant.
By this stage, the balance of combinational logic to flip-flops has been almost
entirely fixed by the state encoding.
Product development time limits and human frailty increasingly require that
those who have acquired such skill and knowledge produce not end-product,
but CAD tools for other engineers to use, with caution and higher-level insight
into a solution’s structure.
15
ELEE08015 Digital System Design 2 Design Synthesis II
Gate-Level Synthesis: Physical Gate Place and Route
or
Why Is Routing Expensive ?
The problem of finding a good logical structure for a Boolean function may be challenging,
but it is trivial in comparison to the difficulty of working out how to wire together a network of
such functions, at the level of complexity quite common in current applications.
The archetype of this problem is the "travelling salesman" problem, which has been studied
for decades, perhaps centuries, and continues to sap the will to live of talented people.
Lacking much in the way of analytic or systematic methods for this task, logic circuit
designers typically fall back on the systematically-minded digital systems engineers: going
with random chance.
16
ELEE08015 Digital System Design 2 Design Synthesis II
Gate-Level Synthesis: Physical Gate Place and Route
or
Why Is Routing Expensive ?
• Designers (or their synthesis tools) scatter the logic in an arbitrary pattern across the
fabric, then try to connect it all together with wires sent off in initially random directions.
Often there will be heuristic guidance too, based on such measures as the distance to be
covered by a wire, or the total number of gate inputs driven by it.
• The measures used are typically easy to calculate, but may have only indirect relevance
to the desired objective.
• Most of these random attempts lead to dead-ends, at which point a small (...or large)
region of the interconnect and/or logic is ripped up and placed in a different (arbitrary)
arrangement and more random routing attempts are made.
• Each place-and-route episode which actually manages to interconnect all the logic within
some time limit is measured for goodness of result and stored for comparison to other
candidate solutions.
• This process continues until a solution which can be passed off as acceptable turns up, or
the engineer finds a new job, or the world as we know it comes to an end.
17
ELEE08015 Digital System Design 2 Design Synthesis II
Why Is FIRST State/Codeword Important?
Most behaviour in form of inter-linked LOOPS: no special start/end
• Can get TO any state FROM any state.
BUT WHAT IF
circuitry can represent state(s) not shown in description of behaviour?
• CODEWORDS represent STATES:
• BINARY codewords come in sets of 2n
• Even dense codes likely to have a few unused codewords
— if unused codeword appears in state register, what happens next?
18
ELEE08015 Digital System Design 2 Design Synthesis II
Why Is FIRST State/Codeword Important?
Modular design: Linked FSM:
19
ELEE08015 Digital System Design 2 Design Synthesis II
Why Is FIRST State/Codeword Important?
Non-Loop Behaviour:
20
ELEE08015 Digital System Design 2 Design Synthesis II
FSM Initialisation
When May Initialisation Be Required?
• Shortly After Power is First Applied
• After Power is Lost and Then Restored - Sometimes
• When An Error in Behaviour/Operation is Found - Sometimes
• Sometimes to End a Phase of Active Operation
21
ELEE08015 Digital System Design 2 Design Synthesis II
FSM Initialisation
Natural Initial Logical Condition of Flip-Flops (State Register) Unpredictable, SO:
1 Provide Special Circuitry (Fabric) to Identify Need and Generate
Initialisation Codeword for State Register (preset/clear/reset)
— This requires co-ordination between behaviour/synthesis and
design/use of initialisation fabric
— For example: Flip-Flop Circuit RESET (Clear/Preset) Signal can
control the initial state of the State Register (Fabric) to Match
State Code Assignment of the desired initial State (Behaviour)
22
ELEE08015 Digital System Design 2 Design Synthesis II