IE2104 Digital Electronics Summary (By Garage@EEE)
IE2104 Digital Electronics Summary (By Garage@EEE)
IE2104 Digital Electronics Summary (By Garage@EEE)
IE2104 Digital Electronics Summary & Review | Prepared by: Lai Fu Jun 1
IE2104 SEEENIORS Telegram Link
https://t.me/+LU1EjwWXiS0yNTdl
Ask your questions here! I’ll try my best to help :)
2
Content
7. Latches & Flip Flops
1. Number Systems
2. Digital Circuits 8. Synchronous State
3. Combinational Logic Machine Analysis &
Principles Design
4. Karnaugh Maps 9. Timing &
5. Programmable Logic Synchronisation
Devices
6. Combinational Logic 10. Counters & Shift
Modules Registers
11. Memory
3
1. Number Systems
4
Definitions
Decimal: 10
Binary: 2
Octal: 8
Hexadecimal: 16 (0-9, A-F)
MSB: Most significant bit (ie the leftmost bit)
LSB: Least significant bit (ie the rightmost bit)
5
Changing Bases
𝑟 means radix/base
6
Signed Numbers
MSB: 0 ~ positive, 1 ~ negative
Sign & magnitude representation
MSB represents sign bit, other bits do not change
2 patterns represent 0 (0000 = +0 and 1000 = −0)
7
Overflow
For 𝑛-bit binary, the range is:
Unsigned 0 → +(2𝑛 − 1)
If a result exceeds the range of the number system, overflow is said to occur.
Addition of two numbers of the same sign may result in an overflow.
8
Codes
Binary-Coded Decimal (BCD) / 8421 Code Gray Code
Unsigned binary representations; 0000 through 1001; Same as regular binary 0 to 9
2421 Code
2-4-2-1 are the weights from the MSB to LSB
Self complementing (two numbers with a sum of 9 complements each other)
Excess-3
BCD + 3; Self-complementing (two numbers with a sum of 9 complements each other)
Advantage: only 1 bit flips at a time
ASCII code
Use ASCII table for references; 7-bit code 1 character takes up 1 byte in notepad
Miscellaneous
For digits after the decimal point, it will be: 𝛼 × 𝑟−1 + 𝛽 × 𝑟−2 …
9
Different Bit Numbers Arithmetic
For +ve number, add 0’s to the front of the number, eg. 0110 (4 bit) ≡ 000110 (6 bit)
For −ve number, add 1’s to the front of the number, eg. 1010 (4 bit) ≡ 111010 (6 bit)
10
2. Digital Circuits
11
Binary Logic/Logic Gates
12
CMOS Logic
Logic families
A collection of different IC chips that have similar input, output, and internal circuit characteristics
but perform different logic functions.
Eg. transistor transistor logic (TTL), diode logic, CMOS logic
MOS-Switch equivalence
NMOS: 0 (open), 1 (close)
PMOS : 0 (close), 1 (open)
13
CMOS Logic Circuits
Fan in
● The number of inputs that a gate can
have in a particular logic family.
● An 𝑛 input gate has 𝑛 series and 𝑛
parallel transistors
● Increasing the number of inputs will
increase the “on” resistance of the
series transistors (limits are typically 4
for NOR gates and 6 for NAND gates).
14
CMOS Logic Circuits
CMOS AOI and OAI gates
Can perform two levels of logic with just one level of transistor delay
15
CMOS Static Electrical Behaviour
Input / output voltages Typical Values
Typically VCC = 5.0 V ± 10% VCC – 0.1V
VOHmin : The minimum output voltage for the HIGH state 70% of VCC
VIHmin : The minimum input voltage recognized as HIGH 30% of VCC
VILmax : The maximum input voltage recognized as LOW ground + 0.1V
VOLmax : The maximum output voltage for the LOW state
DC noise margin
A measure of how much noise it takes to corrupt a worse case output voltage into a value that may be
recognized properly by an input.
Low state DC noise margin (NML) = VILmax − VOLmax
High state DC noise margin (NMH) = VOHmin − VIHmin
* Note: VOHmin > VIHmin and VOLmax < VILmax to allow for noise to not interfere with logic operations
16
CMOS Static Electrical Behaviour
Input / output current
IILmax: The maximum current that flows into the input in LOW state
IIHmax: The maximum current that flows into the input in HIGH state
IOLmax: The maximum current that the output can sink in the LOW state
IOHmax: The maximum current that the output can source in the HIGH state
* Note: Current is positive when flowing into the gate, negative when flowing out
17
CMOS Static Electrical Behaviour
Fanout
The number of inputs that the gate can drive without exceeding its worst case loading specifications
(logic level still correct).
* Note: Left is always output (don’t follow sink & source)
High State: fanout = IOHmax / IIHmax; Low State: fanout = IOLmax / IILmax
Fanout = min(fanout-high, fanout-low)
If fanout is exceeded:
• In the LOW state, the output voltage (VOL) may increase beyond VOLmax.
• In the HIGH state, the output voltage (VOH) may fall below VOHmin.
• Propagation delay to the output may increase beyond specifications.
• Output rise and fall times increase beyond their specifications.
• The operating temperature of the device may increase, thereby reducing the reliability.
18
CMOS Static Electrical Behaviour
Unused inputs
Unused CMOS inputs should never be left unconnected (or floating, or open) *TTL also
Since CMOS inputs have high impedance, it takes only a small amount of circuit noise to temporarily
make a floating input look HIGH, creating some nasty intermittent circuit failures.
19
CMOS Dynamic Electrical Behaviour
Speed and power consumption depends on dynamic electrical behavior
Transition time
The amount of time that the output of a logic circuit takes to change from one state to another.
Propagation delay
The propagation delay, 𝑡𝑝 of a signal path is the amount of time that it takes for a change in the input signal to produce a
change in the output signal.
20
CMOS Dynamic Electrical Behaviour
Wired Logic
21
CMOS Logic Families
Part number in the form “74FAMnn” (74 is the number for commercial purposes, FAM is an alphabetic
family mnemonic, nn is a numeric function designator; 54 is for military purposes)
Power dissipation, P = CPD × VCC × f where
f = transition frequency of the output signal, CPD = power dissipation capacitance
22
3. Combinational
Logic Principles
23
Switching/Boolean Algebra
Positive logic convention → value 0 (LOW), value 1 (HIGH)
Negative logic convention → value 0 (HIGH), value 1 (LOW)
Prove by perfect induction → show that it is true for all possible cases
24
Switching/Boolean Algebra
DeMorgan’s theorem “Break the bar & change the sign”
(T12) (X + Y)’ = X’ · Y’ (T12’) (X · Y)’ = X’ + Y
Operator precedence
Parentheses > NOT > AND > OR
25
Boolean Functions
A literal is a variable in a product or sum term
A normal term is a product or sum term in which no variable appears more than once. Eg. w · x · y
Example of non-normal term: w · x · x · y
If function f has 𝑛 variables, each minterm/maxterm must have 𝑛 literals
26
Boolean Functions
Maxterm / standard sum
A sum in which each variable appears only once in either normal or complement form but NOT
BOTH. [product of sums (POS) of 0’s]
Canonical product
f1(x, y, z) = (f1’)’
= (Σm(0, 2, 3, 5, 7))’
= (x’y’z’ + x’yz’ + x’yz + xy’z + xyz)
= (x + y + z) · (x + y’ + z) · (x + y’ + z’) · (x’ + y + z’) · (x’ + y’ +z’)
=M0 ·M2 ·M3 ·M5 ·M7
= ∏M(0, 2, 3, 5, 7)
f2(x,y,z) = M0 ·M1 ·M3 ·M5
= ∏M(0, 1, 3, 5)
= Σm(2, 4, 6, 7)
27
Boolean Functions
Conversion to minterms / maxterms
Add terms without changing functionality
Minterm
f(a, b, c) = bc’
= bc’(a + a’) (x + x’ = 1)
= abc’ + a’bc’ (Distribution Law)
= Σm(2, 6)
Maxterm
f(a, b, c) = a’ + bc
= (a’ + b)(a’ + c’) (Distribution Law)
= (a’ + b + cc’)(a’ + c’ + bb’) (xx’ = 0)
= (a’ + b + c)(a’ + b + c’)(a’ + c’ + b)(a’ + c’ + b’) (Distribution Law)
= (a’ + b + c)(a’ + b + c’)(a’ + b’ + c’) (Ignore duplicate factor)
= ∏M(4, 5, 7)
28
Boolean Functions
Function and circuit manipulation
Functions can be simplified to their minimum literals
For circuits, it is faster to use NAND and NOR gates (due to CMOS logic) → add inverters
29
4. Karnaugh Maps
30
2 Variable K-map
m0= a’b’(00)
m1 = a’b (01)
m2 = ab’ (10)
m3 = ab (11)
31
3 Variable K-map
Since a 3-variable logic function has 8 minterms Logic Minimization for 3-variable K-map
and a truth table with 8 rows, it has 8 squares
f = m1 + m3 + m4 + m6
= a’b’c + a’bc + ab’c + abc’
= a’c(b’+b) + ac’(b’+b)
= a’c + ac’
The binary sequence of abc follows Gray code
This ensures that adjacent squares have only 1
variable value changed
32
3 Variable K-map for 4 Variable K-map
Logic Simplification
A 4-variable K-map has 16 squares
for ac, notice that a=1
& c=1 & b changes NOTE: The order is in Gray code
from 0 to 1 However, the minterms are NOT in sequence
for a’b’, notice that a=0 & b=0 & c changes from 0 to 1
f = a’b’ + ac
33
Terminologies
K-map Covering - A function is said to be covered if all logic -1 squares are grouped. Rules to cover K-map
Implicants - Each group gives a product term and is called an implicant of the 1. Cover all logic 1 squares with min
function. Each implicant is a product term of the function. number of groups
34
K-Map for Product of Sums 4 Variable K-map
Covering logic-1 squares in K-map gives us logic
functions in sum-of-products form. A 4-variable K-map has 16 squares
We can also cover logic-0 squares, which will give us NOTE: The order is in Gray code
logic functions in product-of-sums form.
However, the minterms are NOT in sequence
35
K-Map for XOR & XNOR DON’T CARE Conditions
In logic function, sometimes we do not have the
(m1, m7, m2, m4)
XOR specification for all the combinations
=a⨁b⨁c
We do not care about the logic value of the function for
This is an odd function since f=1 if 1 or 3 these undefined combinations
variables are logic 1
We call these combinations DON’T-CARE conditions.
They are usually denoted by ‘x’, or ‘X’ or ‘d’
This is an even function since f=1 if 0 or Note: Don’t care about the
2 variables are logic 1 DON’T-CAREs first
36
5. Programmable
Logic Devices
37
Programmable Logic Devices (PLDs)
● PLDs consist of AND & OR elements. Both PAL and PLA have 2n programmable
● The interconnections are programmable connections in the AND plane.
● Sum of Products (SOP) of logic functions can
PAL has fixed number of product terms for each
be implemented
OR gate output during the manufacturing and
Three common PLDs:
cannot be changed by the user.
❑ Programmable Array Logic (PAL)
❑ Programmable Logic Array (PLA) PLA has programmable number of product items
❑ Programmable Read Only Memory for each OR gate output
(PROM)
PAL PLA
The basic differences are whether the AND & OR
arrays are FIXED or PROGRAMMABLE
38
6. Combinational
Logic Modules
39
Binary Decoder Binary Encoder
Binary Decoder has n inputs and 2^n outputs, and is also They perform the reverse function of a decoder and hence have
2^n inputs and n outputs (2^n-to-n)
called n-to-2^n decoder
They can be built from OR gates.
Inputs have all the 2^n combinations
4-to-2 Encoder means 4 inputs, 2 outputs
Only 1 of the 2^n outputs is activated for each of the
corresponding input combinations
40
Multiplexers (MUX) Demultiplexers (DMUX)
It has many input lines but one output line. It is used to select It reverses the operation of a MUX
the input to go to the output.
It has 1 data input line, n select signals and 2^n data output lines
If 2^n inputs, n select signals are needed 1-to-4 DMUX
41
Parity Circuits
Parity – even or odd quality of the number of 1’s in a binary code [odd/even parity]
Parity checking application: single error detection
.
Add a parity bit to the original binary code
If the original code has even parity → parity bit =
‘1’; odd parity → parity bit = ‘0’
Hence, the final code will always have odd parity
(error if even)
42
Comparator
43
Binary Adders
Half adder . Carry-Look-Ahead adder .
• Inputs: a, b From half adder, we define:
• Outputs: s (sum), c (carry) •s=a⊕b, c=ab • Carry propagate, Pi = Ai ⊕ Bi
• Carry generate, Gi = AiBi
Full adder . Fromfulladder:Si =Pi ⊕Ci , Ci+1 =Gi +PiCi
• Inputs: a, b, ci (carry input) Hence, eg. C2 = G1 + P1C1
• Outputs: s (sum), co (carry output) = G1 + P1(G0 + P0C0)
• Can be built from 2 half adders = G1 + P1G0 + P1P0C0
•s=a⊕b⊕c, co =ab+bci +aci =ab+ci(a⊕b)
44
7. Latches & Flip
Flops
45
Sequential Circuits Clocks
Combinational circuits Specifications
• period (tper)
Output(s) depend only on present value of inputs and not on past
values. • frequency (1 / tper)
Outputs depend on both present and past input values. Device can be triggered by the rising or falling edge of the clock signal
46
Latches
A memory element whose excitation input signals control the state of Feedback circuits with external inputs
the device. Any change to output can only be initiated by the input.
Allow the designer to control the stored value in memory
Simple latches
• Output logic is well defined for inputs 01, 10
Feedback loop: 1 NOT gate
• Input of 11 does not change the initial state of memory
Due to propagation delay, output voltage oscillates
• Input of 00 and changed to 11 will make the output oscillate (we need to
Astable (non stable 0 or 1, signal keeps changing) discard this possibility)
Bi-stable elements
One output settle to a high level & the other to a low level
→No way to predict the output status
47
Basic Binary Cells (SR Latches)
Latches have a pair of complementary outputs; an asynchronous
sequential circuit
48
Timing Representation of SR Latch
49
Flip-Flop
Has a control signal called a clock which controls the state of the device. Any change to output can only be initiated by the clock.
Characteristic Table: A truth-table for specifying the operational characteristic of the clocked flip-flop
Characteristic equation: Specifies the value of the next state as a function of the present state and the inputs.
Excitation table: Provides the desired inputs to produce a specific output transition.
50
Flip-Flop
51
Flip-Flop
Asynchronous Preset & Clear
• These asynchronous inputs are standard for most integrated circuit, normally added in
order to make the device more flexible. [preset = 0 means set, clear = 0 means reset]
• Completely overrides J and K inputs. •
These inputs are NOT synchronized by the clock signal. When asserted, they affect the
output immediately.
Triggering Schemes of Flip-Flops
• Level triggering: Normally implemented with the use of a simple gating scheme to gate the clock. Can cause the flip-flop to be unstable under
certain input conditions.
• Edge triggering: Normally implemented with a pulse transition detector. Ensures that the output of the flip-flop changes only with a clock edge.
Predominant mode of triggering used in synchronous sequential systems. (only triggered once per clock cycle)
• Pulse triggering: Normally implemented with the use of the master-slave system. Under normal circumstances, this system does cause the output
to change with a clock edge. Can give rise to problems known as “ones catching” and “zeros catching”.
52
Flip-Flop Master/Slave JK Flip-Flop
• The whole flip-flop triggers only when a whole clock pulse has occurred (pulse- triggered
device). It guarantees stability against oscillatory state changes due to multiple operations
(race conditions).
• When Q = 0, K = 0/1 will have no effect (ie only rest (0, 0) and set (1, 0))
• When Q’ = 0, J = 0/1 will have no effect (ie only rest (0, 0) and reset (0, 1))
• “ones catching” and “zeros catching” -> false triggering due to noise
53
8. Synchronous State
Machine Analysis &
Design
54
Mealy Model
55
Moore Model
56
State Diagrams
57
Analysis of Synchronous Sequential Circuits
58
59
Design of Synchronous Sequential Circuits
60
9. Timing &
Synchronisation
61
Timing in Digital System
Background
Needed to read data from real circuits which might have:
• Different frequencies (eg. Bluetooth, 3G, clock speed, display port speed)
• Dynamic voltage and frequency changing (eg. processor rest vs normal load)
All digital devices have associated minimum and maximum propagation delays, 𝑡p or 𝑡d
For a typical clocked synchronous FSM (finite-state machine) structure, the time parameters are: 𝑡p(comb) (for combinational logic component) and
𝑡p(ff), 𝑡su, 𝑡h (for flip-flop).
62
Timing in Digital System
Setup constraint: 𝑡p(ff1) + 𝑡p(comb) + 𝑡su2 < 𝑇clk 𝑡su marg = 𝑇clk − 𝑡p(ff1) − 𝑡p(comb) − 𝑡su2
Important notes
• Setup/hold time violation occurs when setup/hold margins respectively are < 0
• The range of values for 𝑡p(comb) is taken from combinational logic paths (only from Q and Q’, not inclusive external asychrous inputs)
• Use 𝑡p(comb, max) and 𝑡p(ff, max) for setup constraint (worse case scenario), but 𝑡p(comb, min) and 𝑡p(ff, min) for hold constraint (best case
scenario)
63
Clock Skew & Metastability
Clock Skew
• The length of wire will introduce a small delay factor, Δ𝑡, called clock skew
• If clock skew is large enough, then only will it caused data to be misread
• Clock skew cannot be eliminated but can be reduced (eg. add delays)
64
Synchronization
Handling asynchronous inputs .
The best way to deal with asynchronous signals is to synchronize them to the clocked system
• Never allow asynchronous inputs to fan-out to more than one flip-flop directly
• Synchronize the asynchronous inputs as soon as possible and then treat as synchronous signal (ie synchronize first then pass through
combinational logic block)
• Do not synchronize at more than one place (may cause different SYNCIN values due to delay factor of ASYNCIN)
Synchronization failure .
• If the asynchronous input to the synchronizer FF changes too close to clock edge, the FF may enter a metastable state. It may stay in this state for
an indefinite amount of time. This is not likely in practice but has some probability.
• Synchronization failure is said to occur if a system uses a synchronizer output while the output is still in metastable state; the only way to recover
is to reset the entire circuit.
• While the probability of synchronizer failure can be made small, it can never be eliminated as long as there are asynchronous inputs
• Two ways to get a flip flop out the metastable state:
- Force the flip flop into a valid logic state using input signals that meet the specifications for minimum pulse width, setup and hold time
- Wait “long enough”, so the flip flop comes out of metastability on its own
65
66
10. Counters & Shift
Registers
67
Synchronous Counter Asynchronous Counter
• Synchronous has only one propagation delay of flip-flop + • Asynchronous is cheaper, has less circuitry (no decoding logic
propagation delay of decoding logic • Clock feeds into the first flip-flop only, however propagation delay of MSB
• All the flip-flops are connected to the clock, and there is decoding gets worse with more flip-flops added (𝑛 × propagation delay of 1 flip-flop)
logic
68
Shift Register
69
70
10. Memory
71
Read-Only Memory (ROM)
2𝑛 ×𝑏memory → No. of data lines=𝑏; No. of address lines=𝑛 [K=210, M=220, G=230 ...]
•1 byte = 8 bits
72
ROM Timing
73
Static RAM
• Volatility – most RAMs lose their memory when power is removed [NVRAM = RAM + battery] •
Or use EEPROM (electrically erasable programmable read-only memory) on Arduino
Az
74
SRAM Timing
75
Dynamic RAM
76
DRAM Timing
77
Credits
Special thanks to Philip Lee for his notes!
78
Thank You
79