7 Logic Circuits and Switching Theory
7 Logic Circuits and Switching Theory
BASE n to DECIMAL
𝟎𝟎. 𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐 ….
𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎. 𝑓𝑓𝑓𝑓ℎ𝑛𝑛 = (𝑎𝑎 × 𝑛𝑛3 ) + (𝑏𝑏 × 𝑛𝑛2 ) + (𝑐𝑐 × 𝑛𝑛1 )
+ (𝑑𝑑 × 𝑛𝑛0 ) . (𝑒𝑒 × 𝑛𝑛−1 ) + (𝑓𝑓 × 𝑛𝑛−2 ) (𝟏𝟏𝟏𝟏𝟏𝟏. 𝟏𝟏𝟏𝟏𝟏𝟏)𝟏𝟏𝟏𝟏 = (𝟕𝟕𝟕𝟕. 𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐𝟐 … . )𝟏𝟏𝟏𝟏
+ (𝑔𝑔 × 𝑛𝑛−3 )
Where: n = base
radix point (.) Binary and hexadecimal
most important bases in digital electronics
Conversion between any other bases can always be performed
via base-10. That is from base-n to base-10 and then from
DECIMAL to BASE n base-10 to base-n.
(Con�nuous Division).(Con�nuous Mul�plica�on)
Mnemonic song: What is 1001111100112 in hexadecimal?
Con�nuous Division from the botom to the top!
125 ÷ 8 𝟓𝟓 0.175 × 8 2
15 𝟏𝟏 COMPLEMENTS
8 5
15 ÷ 8 𝟕𝟕 2 1 A – B = A + (-B)
1 ×8 𝟑𝟑 where -B is the complement of B.
8 5 5
1 3 A – B = A + (complement of B)
1÷8 𝟏𝟏
×8 𝟏𝟏
8 5 5
complement of B = 𝑛𝑛𝑟𝑟 – B
3 4
×8 𝟒𝟒 where n = base
5 5 r = # of digits/bits
4 2 note: # digits of A = # digits of B
×8 𝟔𝟔
5 5
2 1 if 𝐴𝐴 ≥ 𝐵𝐵 then:
×8 𝟑𝟑
5 5 𝐴𝐴 + 𝐵𝐵 = 𝐴𝐴 + (𝑛𝑛𝑟𝑟 – B)
…. ……
if 𝐴𝐴 ≤ 𝐵𝐵 then:
𝐴𝐴 + 𝐵𝐵 = − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑜𝑜𝑜𝑜 [𝐴𝐴 + (𝑛𝑛𝑟𝑟 − 𝐵𝐵)]
𝟎𝟎. 𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏 ….
Gray code
If binary numbers are used. A change. for example. from 0111
to 100 may produce an intermediate error number 1001 if the
value of the rightmost bit takes longer to change than do the
values of the other three bits. The Gray code eliminates this
problem. Since only one bit changes its value during any
transi�on between two numbers.
Logic Circuits and Switching Theory
.ASCII Character Code. .BINARY LOGIC.
7-bitcode (27 = 128 𝑐𝑐ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎) consists of binary variables and a set of logical opera�ons.
In prac�ce, usually stored in 8-bits (1 byte), with the most variables are designated by leters of the alphabet. such as A, B,
significant bit (MSB) set to 0. This is done to make it easier to C, x, y, z. etc. with each variable having two and only two
store and transmit ASCII data, as most computers use 8-bit, dis�nct possible values: 1 and 0.
extra bit (10000000 =128 character) is some�mes used for
other purposes (Greek, italic, parity bit, etc.).
128 ASCII characters: BOOLEAN ALGEBRA
26 UPPERCASE leters (A-Z) May be defined with a set of elements and a set of operators.
26 lowercase leters (a-z) A tool for the analysis and design of digital systems\
10 numerals (0 through 9)
32 special printable characters Boolean Func�ons
34 non-prin�ng characters (control character)
described by an algebraic expression consist of binary variables,
the constants 0 and 1, and the logic opera�on symbols.
func�on can be equal to either 1 or 0.
Boolean func�on can be transformed from an algebraic
expression into a circuit diagram composed of logic gates
connected in a par�cular structure.
Algebraic Manipula�on
each term requires a gate and each variable(literal) within the
term designates an input to the gate.
Duality Principle
States that every algebraic expression deducible from the
postulates of Boolean algebra remains valid if the operators
and iden�ty elements are interchanged.
0 and 1 are swapped and (+) and (×) are swapped.
Complement of a Func�on
complement of a func�on F is not F (F').
De morgan’s Law -> is derived from Duality Principle.
Iden�ty 1𝑥𝑥 = 𝑥𝑥 0 + 𝑥𝑥 = 𝑥𝑥
Null 0𝑥𝑥 = 0 1 + 𝑥𝑥 = 1
Idempotent 𝑥𝑥𝑥𝑥 = 𝑥𝑥 𝑥𝑥 + 𝑥𝑥 = 𝑥𝑥
Ex. A = 010000012 = 6510
Inverse 𝑥𝑥𝑥𝑥′ = 0 𝑥𝑥 + 𝑥𝑥′ = 1
Error-Detec�ng Code
Commuta�ve 𝑥𝑥𝑥𝑥 = 𝑦𝑦𝑦𝑦 𝑥𝑥 + 𝑦𝑦 = 𝑦𝑦 + 𝑥𝑥
Parity bit
is an extra bit included with a message to make the total
Associa�ve (𝑥𝑥𝑥𝑥)𝑧𝑧 = 𝑥𝑥(𝑦𝑦𝑦𝑦) (𝒙𝒙 + 𝒚𝒚) + 𝒛𝒛 = 𝒙𝒙 + (𝒚𝒚 + 𝒛𝒛)
number of 1's either even or odd.
if the receiver detects a parity error. it sends back the ASCII De Morgan’s (𝑥𝑥𝑥𝑥)′ = 𝑥𝑥′ + 𝑦𝑦′ (𝑥𝑥 + 𝑦𝑦)′ = 𝑥𝑥′𝑦𝑦′
NAK (nega�ve acknowledge) consis�ng of an even-parity eight
bits 10010 101. If no error is detected. the receiver sends back
Involu�on (𝑥𝑥 ′ )′ = 𝑥𝑥
an ACK (acknowledge) 00000110. The sending end will respond
to NAK by transmi�ng the message again un�l the correct
parity is received.
Logic Circuits and Switching Theory
Truth Table .Logic Circuits.
A table of combina�ons of all possible values of the input
A circuit that provides an input – output rela�onship
variables and its corresponding output. corresponding to a Boolean Algebra logic func�on to govern a
par�cular sequence of opera�ons in each system.
M = 2n
n = # 𝑜𝑜𝑜𝑜 𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖
M = # 𝑜𝑜𝑜𝑜 𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜
Logic Gates
electronic circuit that operates on one or more input signals to
produce an output signal.
OR/NOT Equivalent
Karnaugh map
pictorial form of a truth table.
straigh�orward procedure for minimizing Boolean func�ons.
square represen�ng one minterm of the func�on.
Gray code (1 bit at a �me)
FULL ADDER
Input: 3 bits
Output: 2 bits (S = sum, C = carry)
ARITHMETIC CIRCUITS
combina�onal logic circuits that perform the different binary
arithme�c opera�ons
Logic Circuits and Switching Theory
BINARY PARALLEL ADDER Code Converters
Produces the arithme�c sum of two binary numbers. used to convert one type of binary code to another. There are
different types of binary codes like BCD code, gray code, excess-
3 code, etc. Different codes are used for different types of
digital applica�ons.
ENCODER
Decimal input, Binary equivalent output
BCD adder
4-bit binary adder that can add 4-bit numbers having a BCD
format.
DECODER
Binary input, Decimal equivalent output
Binary-to-Gray
Gray-to-Binary
Logic Circuits and Switching Theory
Mul�plexer (MUX) – shared w/ EST
Data selector 4-to-1 Channel Mul�plexer
switching circuits that just switch or route signals.
select binary informa�on from one of many inputs
line and direct it to a single output line. The selec�on
of a par�cular input line is controlled by a set of
selec�on lines. normally, there are 2𝑛𝑛 input line and
n selec�on lines whose bit combina�on determine
which input is selected.
Multiplexing is the generic term used to describe
the opera�on of sending one or more analogue or
digital signals over a common transmission line at
different �mes or speeds and as such, the device we
use to do just that is called the mul�plexer.
𝑏𝑏𝑏𝑏𝑏𝑏
𝑡𝑡𝑏𝑏𝑏𝑏𝑏𝑏 =
𝑓𝑓𝑏𝑏
𝑓𝑓𝑏𝑏(𝑡𝑡) = 𝑛𝑛𝑓𝑓𝑏𝑏 Digitally Adjustable Amplifier Gain (MUX)
1
𝑡𝑡𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 =
𝑓𝑓𝑏𝑏(𝑡𝑡)
𝑡𝑡𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 = � 𝑡𝑡𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠
Pulse Driven
which is a combina�on of the two that responds to
triggering pulses.
Logic Circuits and Switching Theory
Synchronous Sequen�al Logic RST flip-flop
Does not use a clock signal to determine the �ming of its An RS flip-flop with a third toggle that enables or disables the
opera�ons. R&S inputs.
State changes occur in response to changes in the inputs.
FLIP-FLOPS
also called a Bistable Multivibrator
A circuit that has two stable states that can remain in either state
indefinitely.
An external trigger can change the output.
D flip-flop
can be used to store state informa�on.
Output state follows the state of the D-input.
RS Flip-flop
2-input memory element with designated R and S.
Logic 1 on the S input will give Logic 1 at the output.
Logic 1 at the R input, it will Reset.
Logic 1 at R and S input will give undefined output.
JK flip-flop
Most important flip-flop
Gated SR flip-flop that prevents the illegal or invalid output
condi�on that occur when both inputs S and R are Logic 1.
Master-Slave flip-flop
Combina�on of two JK flip-flops connected in a series
configura�on.
Logic Circuits and Switching Theory
.BINARY STORAGE, REGISTERS and Register Transfer
is a basic opera�on that consist of a transfer of binary
COUNTERS. informa�on from one set of registers into another set of
registers.
Binary cell
A binary cell can be made using a flip-flop, but it is not
necessary to do so. A binary cell can also be made using other
types of logic gates, such as AND gates, OR gates, and NOT
gates.
is a device that possesses two stable states and can store one
bit (0 or I) of informa�on.
Register
register is a group of binary cells/flip-flops, each one of
which can store one bit of informa�on. An n-bit register
consists of a group of n cells/flip-flops can store n bit of
binary informa�on.
is a temporary storage loca�on for data.
It is used to hold data that is being processed by the
processor or that is wai�ng to be processed.
much faster than main memory, so they can be used to
improve the performance of a computer system.
Type Description
General- A general-purpose register can be used to store any type
purpose of data. They are the most common type of register and
register are used for a variety of purposes.
An address register is used to store the address of a
Address memory location. They are used by the processor to
register access data from memory.
A control register is used to control the operation of the
processor. They are used to set the processor's mode of
Control operation, control the flow of execution, and manage
register interrupts.
A status register stores information about the state of
Status the processor. They are used to keep track of the
register processor's flags, such as the carry flag and the zero flag.
An index register is used to store an offset value that can
Index be added to the address of a memory location. This is
register used to access data in a memory array.
A stack pointer is used to store the address of the top of
Stack the stack. The stack is a data structure that is used to
pointer store temporary data.
Program The program counter is used to store the address of the
counter next instruction to be executed.
Logic Circuits and Switching Theory
SHIFT REGISTERS COUNTER
A shi� register basically consists of several single-bit D-type data is essen�ally a register that goes through a predetermined
latches connected together in a serial type of daisy-chain sequence of binary state. The gate in the counter is connected in
arrangement so that the output from one data latch becomes such a way as to produce the prescribed sequence of state.
the input of the next latch and so on typically used to count the number of clock pulses they receive.
capable of shi�ing the binary informa�on held in each cell to its This can be used to measure �me, generate frequencies, or
neighboring cell, in a selected direc�on. count events.
typically used to store data or to convert between serial and
parallel data formats.
Synchronous Counters
counts the number of clock pulses it receives
changes to the output occurs in “synchroniza�on” with the clock
signal.
is a parallel counter because the clock input is connected in
parallel to each and every flip-flop
4 DIFFERENT MODES
Serial-in to Parallel-out (SIPO)
the register is loaded with serial data, one bit at a �me, with the
stored data being available at the output in parallel form.
Asynchronous Counters
also known as ripple counters
triggered by changes in the input signal.
Synchronous Counters:
Parallel-in to Parallel-out (PIPO) 74LS160 - Programmable synchronous BCD counter with asynchronous reset
the parallel data is loaded simultaneously into the register and 74LS161 - 4-Bit decade counter with asynchronous reset and synchronous load
74LS163 - 4-Bit binary counter with asynchronous reset and synchronous load
transferred together to their respec�ve outputs by the clock
74LS191 - 4-bit synchronous binary up/down counter with reset and load
pulse. 74LS192 - 4-Bit synchronous BCD counter with asynchronous reset and load
74LS193 - 4-Bit synchronous binary counter with asynchronous reset and load.
Power Dissipa�on:
Type of IC: the amount of power dissipated in an IC.
DTL simplest logic family.
It uses diodes to isolate the
inputs from the transistor.
HTL is a speed improvement over DTL.
It uses a higher threshold voltage for the transistors.
TTL most common logic family.
It is a good compromise between speed and power
consump�on.
RTL most power consuming.
ECL is the fastest logic family,
it uses a nega�ve power supply voltage, which allows it to Noise Margin
switch even faster than TTL. Maximum noise voltage added to the input signal of a digital
However, it is also the most power-consuming logic family. circuit that does not cause an undesirable change in the circuit
NMOS low-power logic family that uses N-channel MOSFETs. output.
CMOS lowest-power logic family.
It uses both N-channel and P-channel MOSFETs.
It is slower than NMOS, but it consumes even less power.
Figure of Merit
product of speed and power.
The speed is specified in terms of propaga�on delay �me
expressed in nano seconds.
Logic Family Transistor Speed Power
Type Consump�on
Flexibili�es Available DTL (Diode- BJT Low High
Transistor Logic)
1. Wire-logic Capability:
HTL (High BJT Medium Medium
Connec�on of gate output terminals together or using
Threshold Logic)
them directly to perform addi�onal logic func�ons
without any extra hardware. TTL (Transistor- BJT Medium Low
Transistor Logic)
2. Availability of Complement Outputs: RTL (Resistor- BJT Low High
This eliminates the need for addi�onal inverters. Transistor Logic)
ECL (Emiter- BJT High High
3. Breadth of Series: Coupled Logic)
Types of different logic func�ons available in the series. NMOS (N- MOSFET Low Medium
channel MOS)
4. Popularity of Series: CMOS MOSFET Low Low
The cost of manufacturing depends upon the number of
(Complementary-
ICs manufactured.
MOS
5. Input-Output Facili�es:
For high fan-out, the gates have low output impedance for
both 0 and 1.
Logic Circuits and Switching Theory
.Algorithmic State Machine (ASM). ASM charts
sequen�al network is used to control a digital system which represent physical hardware.
carries out a step by a step –by step procedure. equivalent to a state graph
A mathema�cal abstrac�on used to design algorithms. can be described the opera�on of both combina�onal and
It reads a set of inputs and changes to a different state based sequen�al circuits.
on those inputs. equivalently expressed as a state and output table.
Mealy and Moore Machine
Principal Component of an ASM Chart
1. State Box
Mealy Machine
Changes its output based on its present state and current input.
2. Decision box
Moore Machine
Output depends only on the current state.
It does not depend on the current input.