ASE2207 - L3 - Jan2024 - Slides
ASE2207 - L3 - Jan2024 - Slides
INSTRUMENTATION SYSTEMS
Jan 2024
Lecture 3 Overview
• Basic logic circuits, Truth-table, Boolean equation, timing diagrams
• Combinatorial circuits: Adder, multiplexer, shifter, decoder/encoder, comparator
• Transistor-level implementation of logic circuit, digital circuit design using HDL
• Sequential circuits: SR latch, D and JK flip-flops, register, counters
• Computer Architecture and Communication
• Data buses and protocol
• OSI, transmission medium, networking and network topology
Important notes
• Please go thru the lecture materials and raise questions if you have any queries. Some relevant
videos are listed below, you are expected to search for the remaining topics (independent
learning)
• Video on Boolean algebra: https://www.youtube.com/watch?v=WW-NPtIzHwk
• Video on Sum of Product (SOP): https://www.youtube.com/watch?v=xnLBbOYYnHM&t=69s
2
Introduction
• Logic allows the reasoning on whether a
proposition (declarative statement) is true
if certain conditions are true.
• Propositions can be classified as true (1) or
false (0).
• In 1850s, the English Mathematician,
Philosopher and Logician George Boole
developed a mathematical system for
formulating logic statements.
• Logic statements can be realized using George Boole (/ˈbuːl/; 2 November 1815 – 8
December 1864) was an English
mathematician, philosopher and logician. He
electronic Logic Circuits. worked in the fields of differential equations
and algebraic logic, and is now best known as
• Logic circuits are classified into two types: the author of The Laws of Thought. As the
inventor of the prototype of what is now called
Boolean logic, which became the basis of the
̶ Combinatorial modern digital computer, Boole is regarded in
hindsight as a founder of the field of digital
̶ Sequential electronics.
3
Basic logic operations
Z = A = A' =~ A = ¬A
4
Basic logic operations: AND & NAND
1. Logic symbol and circuit
Z AND = A.B = A ∧ B
2. Logic/Boolean equation
4. Timing diagram
3. Truth table
AND NAND
A
Input A B output output
ZAND ZNAND B
010: 0 0 0 1
110: 0 1 0 1
ZAND
210: 1 0 0 1 ZNAND
310: 1 1 1 0 5
Basic logic operations: OR & NOR
1. Logic symbol and circuit
ZOR = A + B = A ∨ B
2. Logic/Boolean equation
4. Timing diagram
3. Truth table
OR NOR
Input A B output output A
ZOR ZNOR
B
010: 0 0 0 1
110: 0 1 1 0 ZOR
210: 1 0 1 0 ZNOR
310: 1 1 1 0
6
Electronic logic gates
f (a, b) = a.b f ( a , b) = a + b f(a)Z = A = A' =~ A = ¬A
a a
a
b b
& ≥1 1
AND gate OR gate NOT gate / Inverter
a
f (a, b) = a.b = a + b NAND gate
b
a
f (a, b) = a + b = a.b NOR gate
b
7
Electronic logic gates
9
Combinatorial Circuits
Index A B C g
Product-of-Sum (POS) or Conjunctive Normal form (CNF)
0 0 0 0 1
is the product (AND) of all sum (OR) maxterms.
1 0 0 1 0
condition) 0 0 0 0 0
1 0 0 1 1
- Input combinations that never occur
2 0 1 0 1
- Output condition required to be 1 or 0 only 3 0 1 1 0
for certain combination 4 1 0 0 x
- Usually denoted as × 5 1 0 1 x
- 𝑓𝑓 = ∑ 𝑚𝑚 1,2,7 + 𝑑𝑑(4,5,6) 6 1 1 0 x
7 1 1 1 1
- 𝑓𝑓 = ∏ 𝑀𝑀 0,3 . 𝐷𝐷(4,5,6)
12
Sum-of-Product (SOP) & Product-of-Sum (POS) form
( A + B + C ).( A + B + C )
A
A.B.C A
B A+ B +C
B
A.B.C
A+ B +C
Z1
Z2
A.B.C
C A+ B +C
C
A.B.C
A+ B +C
14
Performance matrices for Logic Circuits
15
7-Segment display work example
7-segment decoder (display)
WXYZ A B C D E F G
S0 0000 1 1 1 1 1 1 0
W
S1 0001 0 1 1 0 0 0 0
S2 0010 1 1 0 1 1 0 1
X
S3 0011 1 1 1 1 0 0 1
S4 0100 0 1 1 0 0 1 1
Y
S5 0101 1 0 1 1 0 1 1
S6 0110 1 0 1 1 1 1 1
Z
S7 0111 1 1 1 0 0 0 0
S8 1000 1 1 1 1 1 1 1
S9 1001 1 1 1 1 0 1 1
S10 1010 × × × × × × ×
S11 1011 × × × × × × ×
S12 1100 × × × × × × ×
S13 1101 × × × × × × ×
S14 1110 × × × × × × ×
S15 1111 × × × × × × ×
16
Inputs Outputs
7-Segment display work example
𝑆𝑆𝑆𝑆𝐺𝐺𝐴𝐴 = 𝑋𝑋. 𝑍𝑍 + 𝑌𝑌 + 𝑊𝑊 + 𝑋𝑋. 𝑍𝑍 W
A
X
𝑆𝑆𝑆𝑆𝐺𝐺𝐵𝐵 = 𝑌𝑌. 𝑍𝑍 + 𝑋𝑋 + 𝑌𝑌. 𝑍𝑍 Y
Z B
SEGC = Y + Z + X
C
SEGD = X .Z + W
+ Y .Z + X .Y .Z + X .Y D
SEGE = X .Z + Y .Z
E
SEGF = W + Y .Z
F
+ X .Z + X .Y
SEGG = W + X .Y G
+ X .Z + X .Y
17
Landing gear door warning example
𝐴𝐴11 = 𝐴𝐴7
19
Arithmetic circuits: Ripple adder
+ 0000 0001 Step 2: You start adding the next Full adder
three bits (you notice is 3-bit as A1…7
1000 0000 you need to consider any carry- S1…7
in), two bits are (A1 and B1) as well
B1…7
as any carry in from the previous C1…7 C1…7
bit. This will produce another sum
output bit and a carry-out bit. You
also noted all subsequent bits are
added in the same manner. 20
Arithmetic circuits: Ripple adder
• What are the steps involved to design a combinational circuit (e.g. adder)?
Step 1: Truth table Step 2: Optimised Step 3: Circuit implementations
Boolean equations
Half adder
Ai Bi Si Co Ai Si
0 0 0 0 Si = Ai ⊕ Bi
0 1 1 0
1 0 1 0 Co = Ai .Bi
Co
1 1 0 1 Bi
Full adder
Ai Bi Ci Si Ci+1
0 0 0 0 0
0 0 1 1 0 Si = Ai ⊕ Bi ⊕ Ci
0 1 0 1 0
0 1 1 0 1 Ci +1 = Ai .Bi + ( Ai ⊕ Bi )Ci
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1 21
Arithmetic circuits: Ripple adder
• Multiple full adders can be chained together to add N-bit numbers.
• Each full adder has its inputs Cin connected to the Cout of previous adder.
• This kind of adder is a ripple carry adder.
– Each carry bit "ripples" to the next full adder.
• Ripple carry adders are slow for adding input with many bits.
– Since the carry may need to be propagated along the longest path from the LSB to
the MSB, the delay is proportional to the bit length to be added.
1 0 0 1 1 0 0 1
A3 A2 A1 A0 A3 B3 A2 B2 A1 B1 A0 B0
+ B3B2B1B0
S3 S2 S1 S0 A B CI A B CI A B CI A B CI
+0101
1111
22
Arithmetic circuits: 4-bit ripple adder
B3 A3 B2 A2 B1 A1 Cin=0 B0 A0
8 6 4 2
7 5 3
Cout S3 S2 S1 S0
• Longest path has 8 gates delay 23
Multiplexer
• A multiplexer (or MUX) is a device
that selects one of several analog or
digital input signals and forwards the
selected input into a single output line.
• A demultiplexer (or DEMUX) is a
0
device taking a single input signal and
selecting one of many data-output- 1
A B sel Z
0 × 0 0
1 × 0 1 𝑍𝑍 = 𝐴𝐴. 𝑠𝑠𝑠𝑠𝑠𝑠 + 𝐵𝐵. 𝑠𝑠𝑠𝑠𝑠𝑠
× 0 1 0
× 1 1 1
24
Multiplexer
25
Decoder and Encoder
26
Decoder and Encoder
• Priority encoders can be used to reduce the number of wires needed in a
particular circuits or application that have multiple inputs
• Some applications include keyboard encoder and positional encoder.
27
Buffer and Tri-state logics
• Buffer: Buffers do not affect the logical state of a digital signal (i.e. a logic 1 input results in
a logic 1 output, whereas a logic 0 input results in a logic 0 output). Buffers are normally
used to provide extra current drive at the output but can also be used to regularise the logic
levels present at an interface.
A Z
A Z 0 0
1 1
Tri-state: Tri-state logic devices operate in a similar manner to conventional logic gates
but has a third, high impedance output state. This high-impedance state (Hi-Z) permits
the output of several tri-state devices to be connected directly together.
A EN Z
A Z 0 0 Hi-Z
1 0 Hi-Z
0 1 1
EN 1 1 0
28
Logical shifter
• A logical shifter is a bitwise operation that shifts all the bits of its operand.
• The two base variants are the logical left shift and the logical right shift.
• This is further modulated by the number of bit positions a given value shall be
shifted, such as shift left by n-bit or shift right by n-bit.
̶ Shift left by 1-bit will multiply the number by 2 (binary numbers are base-2 numbers)
̶ Shift right by 1-bit will divide the number by 2.
• Unlike an arithmetic shift, a logical shift does not preserve a number's sign bit;
every bit in the operand is simply moved a given number of bit positions, and the
vacant bit-positions are filled, usually with zeros.
https://en.wikipedia.org/wiki/Logical_shift 29
Logical shifter
• Consider an input A3-0 = 0110 and Sh=0,
the output is X3-0 still 0110, this implies no shift occurs.
• An N-bit shifter would require log2N number of levels
X3 to implement.
• The number of multiplexers required for an N-bit word
is Nlog2N
X2 • Given a 4-bit input A3-0 and a 1-stage output X3-0, the
control input Sh will determine if a 1-bit shift-left
happens.
A X = A.B A< B
Y = A⊕ B A= B
B Z = A.B A> B
31
Electronic Realization of Logic Circuits
34
Hardware Description Languages (HDL)
0 1
R 𝑄𝑄� R 𝑄𝑄�
0/1 0/1
• The technical terms when referring to memory
̶ Current/present state (existing content known as Q or Q0) or
̶ Next/future state (new content known as Q+ or Qn+1) 38
SR-latch
• The SR (Set-Reset) latch can be constructed from NOR gates or NAND gates.
• Using NOR gates, SR latch reacts to active-HIGH (‘1’) inputs.
̶ i.e. its content (output) does not change when both inputs are low
• Using NAND gates, SR latch reacts to active-LOW (‘0’) inputs.
̶ i.e. its content (output) does not change when both inputs are high
R S
Q Q
S 𝑄𝑄
R 𝑄𝑄�
Q Q
S R
39
SR-latch
S R Output Q Comments Current state Next state
0 0 Q0 No change 0 S 𝑄𝑄 0 S 𝑄𝑄
1 0 1 SET 0/1 0/1
0 1 0 RESET 0 R 𝑄𝑄� 0 R 𝑄𝑄�
D 𝑄𝑄
EN 𝑄𝑄�
41
D flip-flop
• A flip-flop differs from a latch in the manner it changes states, i.e. latch
is level-sensitive whereas a flip-flop is edge-sensitive.
• The flip-flop is a synchronous device (as it synchronise with the clock) unlike a latch which
is asynchronous.
• In the logic symbol, the flip-flop has a triangle at the C input to indicates it is edge
sensitive. Moreover, a circle with the triangle indicates it is falling edge sensitive, while
the triangle without circle indicates it is rising edge sensitive.
̶ A flip-flop is a clocked device, i.e. only the clock edge determines when a new bit is stored into the flip-flop.
̶ Positive-edge triggered (PGT) D flip-flop => output follows D input only on the rising edge of the clock.
̶ Negative-edge triggered (NGT) D flip-flop => output follows D input only on the falling edge of the clock.
Clock input
D 𝑄𝑄 indicator D 𝑄𝑄
CLK 𝑄𝑄� 43
D latch versus D flip-flop
• With D latch, engineer discovered this type of memory device is
not optimal since any noise at the input of the latch will be coupled to the
output as it is sensitive to the input (DL) for the entire period with EN=1 (i.e.
level sensitive)
• However, for the D flip-flop, as the content of the f/f is updated by sampling
the input (DFF) only at the rising edge of the clock (i.e. edge sensitive), any
noise that occur at the input will be ignored.
DL 𝑄𝑄 L
DL/DFF
EN 𝑄𝑄𝐿𝐿
EN/CLK
DFF 𝑄𝑄FF QL
44
JK flip-flop
J K CLK Qn+1
0 0 ↑ 𝑄𝑄𝑛𝑛 , No change
1 0 ↑ 1
0 1 ↑ 0
1 1 ↑ 𝑄𝑄𝑛𝑛 , Toggle
45
Monostable (one-shot)
Monostable or one-shot devices provide a means of generating precise
time delays.
Such delays become important in many sequential logic applications where
logic states are not constant but subject to change of time.
The action of a monostable is the output is initially 0 until a change of state
occurs at its trigger input.
46
Propagation delay
a a
b b
c c
tPLH tPHL
48
Flip-flop timing characteristics
• Setup time and hold time are times required before and after
the clock transition that data D must be present to be reliably
clocked into the flip-flop.
the clock.
Set-up time, ts
D
• Hold time is the minimum
time for the data to CLK
QA
51
Flip-flop applications: 3. Control Unit/FSM
• Flip-flop are also used with combinatorial circuits to build
control unit or finite state machine (FSM)
̶ FSM is the backbone of the control unit (CU) inside a CPU.
̶ Other examples of FSM include counters. Refer to chapter 1, what are the 3
components inside a CPU?
3-bit odd/even counter example
Block diagram
Even count: A=0
53
Computer Architecture and Communication
• Figure below depict a data communication model where a source system send data to the
destination system via the transmission network.
• An example below shows a historic network relying on modem over the public telephone
network (up to 56Kbps). Current broadband using fiber optics can achieve up to 1Gbps.
54
Inter-computer system buses
• A bus refers to a system that permits interconnections and data exchange between the
computers in a complex system. System buses (data, address and control) were discussed
in chapter 1, however they are used internally within a computer for short range
communications.
• In a largest computer network over longer range, the interconnections involved more than
just physical wiring; among other things it defines the voltage levels and rules (or
protocols) that govern the transfer of data.
• Bus systems can be either unidirectional (one-way) or bidirectional (two-way).
• Within the LRU (Line replaceable units), the
dedicated digital logic and microprocessor
systems that process data locally each make
use of their own local bus system
• Modern aircraft use multiple redundant bus
systems for exchanging data between the
various avionic systems and sub-systems.
These bus systems use serial data transfer
because it minimises the size and weight of
aircraft cabling.
55
Bus Protocol and Architecture
• In computers and digital systems communication, protocols are established to
enable the efficient exchange of data between multiple devices connected to the
same bus.
• Bus architecture is a general term that refers to the overall structure of a
computer or other digital system that relies on a bus for its operation.
56
Bus Protocol and Architecture
• Different bus systems which consist of both serial and parallel buses are used to
harness the advantages based on the system architecture.
• Details of these buses and protocol such as ARINC 429 and 629 will be covered in
the later chapters
57
ISO-OSI model
• International Standard Organization (ISO) Open Systems Interconnection
(OSI) model is a product of the Open Systems Interconnection effort.
• It is a prescription of characterizing and standardizing the functions of a
communications system in terms of abstraction layers.
• Similar communication functions are grouped into logical layers.
• A layer serves the layer above it and is served by the layer below it.
• The concept of a seven-layer model was provided by the work of Charles
Bachman, Honeywell Information Services.
• Still an excellent model for
conceptualizing and understanding
protocol architectures, key points are:
̶ Modular
̶ Hierarchical
̶ Boundaries between layers =
Interfaces
58
ISO-OSI model
OSI model
Data unit Layer Function
7. Application Network process to application
Data representation, encryption and decryption,
Data 6. Presentation convert machine dependent data to machine
Host independent data
layers Inter-host communication, managing sessions
5. Session between applications
End-to-end connections, reliability and flow
Segments 4. Transport control
Packets/
Datagram
3. Network Path determination and logical addressing
Media
layers Frame 2. Data Link Point-to-point and error detection
Bit 1. Physical Media, signal and binary transmission
59
ISO-OSI model
Hello
60
ISO-OSI Environment
Dictates or handwritten
7 the message Read message Application
Manager Manager
Company’s Business
Corrects format error, Alerts manage of
6 prepares final version incoming message,
translates it
Presentation
Assistant Assistant
Provides needed
5 addresses and packs
letter
Open letter and make
copy Session
Secretary Secretary
Postal services
2
Packs letters for Unpacks packages from
individual destination various directions Data Link
Packaging Unpacking
1 Physical
Transmission medium Unloading
Loading
OSI and letter communication parallel
61
Transmission Mediums: Physical layer
Cost
Transmission
Line
62
Transmission Mediums
• Two mediums currently driving the evolution of data communications
transmission are fibre optics and wireless technologies.
5G
63
Networking
• Advances in technology have led to greatly increased capacity and the concept
of integration, allowing equipment and networks to work simultaneously.
• There are many way to categorize networks:
̶ MAN: Metropolitan Area Networks
̶ WAN: Wide Area Networks
̶ LAN: Local Area Networks
Voice Data
Image Video
64
Network Topology
Bus topology
Tree topology
Star topology
Linear topology
Ring topology
65
Wide Area Networks (WANs)
• A wide area network (WAN) is a telecommunication network
that covers a broad area (i.e., any network that links across
metropolitan, regional, or national boundaries)
• Span a large
geographical area
• Require the crossing of
public right-of-ways
• Rely in part on common
carrier circuits
• Typically consist of a
number of
interconnected switching
nodes
66
Metropolitan Area Networks (MAN)
• A metropolitan area network (MAN) is a computer network that usually
spans a city or a large campus.
• A MAN usually interconnects a number of local area networks (LANs) using
a high-capacity backbone technology, such as fiber-optical links, and
provides up-link services to wide area networks (or WAN) and the
Internet.
• Covers a geographic
area such as a town, city
or suburb
• Middle ground between
LAN and WAN
• Supports both data and
voice
• Private or public
network
67
Local Area Networks (LAN)
• A local area network (LAN) is a computer network that interconnects computers in a
limited area such as a home, school, computer laboratory, or office building using
network media.
• The defining characteristics of LANs, in contrast to wide area networks (WANs), include
their usually higher data-transfer rates, smaller geographic area, and lack of a need for
leased telecommunication lines.
• ARCNET, Token Ring and other technology standards have been used in the past, but
Ethernet over twisted pair cabling, and Wi-Fi are the two most common technologies
currently used to build LANs.
68
The Internet and TCP/IP
• The Internet is a global system of interconnected computer networks that use the
standard Internet protocol suite (often called TCP/IP (transmission control
protocol/internet protocol), although not all applications use TCP) to serve billions of
users worldwide.
• It is a network of networks that consists of millions of private, public, academic,
business, and government networks, of local to global scope, that are linked by a
broad array of electronic, wireless and optical networking technologies.
69
The Internet and TCP/IP
• The Internet carries an extensive range of information
resources and services, such as the inter-linked
hypertext documents of the World Wide Web (WWW)
and the infrastructure to support email.
• Internet evolved from ARPANET (Advanced Research
Projects Agency Network).
• ARPANET was the world's first operational packet
switching network and the core network of a set that
came to compose the global Internet.
• The packet switching of the ARPANET was based on
designs by Lawrence Roberts of the Lincoln
Laboratory.
• 2.5 EB (Exa bytes or 260) of data produced every day
• 90% of the data in the world generated over the last 2
years.
• The explosion of data give rise to areas in data science,
machine learning and artificial intelligence (AI)
70
Summary
2. A logic gate that produces a HIGH output only when all of its inputs are
HIGH is a(n)
(a) OR gate
(b) A AND B
(c) A XOR B
(d) A XNOR B
8. The circuit shown will have identical logic outputs if all gates are
changed to
(a) AND gates
(b) OR gates
10. Sketch the output signal for the AND gate G3.
A
A
G1
B B
G3
C C G2
D D
G3
76
Self-test quiz
11. For the full-adder shown, assume the input bits are as shown with A =
0, B = 0, Cin = 1. The Sum and Cout will be
(a) Sum = 0 Cout = 0
(b) A > B
(d) A = B
77
Self-test quiz
13. The decimal-to-binary encoder shown does not have a zero input. This
is because
(a) when zero is the input, all lines
should be LOW
14. If the data select lines of the MUX are S1S0 = 11, the output will be
(a) LOW
(b) HIGH
(c) equal to D0
(d) equal to D3
78
Self-test quiz
(c) D is LOW
(d) toggle 79
Self-test quiz
(b) tPLH
20. Assume the output from a leading-edge triggered J-K flip flop is
initially HIGH. With the inputs shown, indicate in the timing diagram
when will the output goes from HIGH to LOW?
81