digital design and com org
digital design and com org
COMPUTER ORGANIZATION
Introduction
Team DDCO
Department of Computer Science and
Engineering
Merged&Editedby_Aayan
Digital Design And Computer Organisation
Marks to be
Marks to be conducted for
scaled to
ISA 1 (Units 1 and 2) 40 20
ISA 2 (Units 3 and 4) 40 20
Hackathon 10 10
Laboratory (1–credit) • 10 marks(Mini Project) 20
• 5 marks Quiz conducted for 20 marks,(half
an hour) reduced to 5 marks (conducted
during 12th week)
• 5 Marks continuous evaluation of lab
programs
ESA 100 50
(Questions based on units 1–
4:total of 90 marks
Questions based on
laboratory:total of 10 marks)
Total 120*
*The total of 120 marks will further be scaled down to 100 for grading.
DIGITAL DESIGN AND COMPUTER ORGANIZATION
What is Engineering?
Engineering
From latin ingenium: innate talent/capacity/intelligence
To design and build structures and machines (with skill/art/expertise/ingenuity)
Objective of Engineering?
Optimize fundamental physical quantities of time, space and energy
In current course, increase logic circuit speed, decrease logic resources required and
decrease power consumed
Perquisites-DDCO
• unit 3 of Basic electronics- Arithmetic building blocks – Half and Full Adder, Multiplexers, Demultiplexers, RS Flip-Flop
– Basic idea, NAND Gate latch, Clocked RS and D Flip-Flops. – This is used in sequential Logic design of circuits in unit2
of DDCO
• Using this knowledge the data path and control path of ALU is designed
• Basics of C programming is desired knowledge for Lab-The Verilog language used in created of simple circuits like
adders, multiplexers decoders and design of ALU has syntax similar to the C programming language.
DIGITAL DESIGN AND COMPUTER ORGANIZATION
What is the course about?
Compile hello_world.c
From starting a program to the time it displays output What goes on inside your
computer?
device drivers
ABSTRACTION:
instructions Hiding details when they aren’t important
registers
focus of this course
datapaths
controllers
adders
memories
AND gates
NOT gates
amplifiers
filters
transistors
diodes
electrons
Why DDCO?
DIGITAL DESIGN AND COMPUTER ORGANIZATION
Computer Organization & Computer Architecture
Source: nextplatform.com
Familiarity with ARM architecture and micro-architecture for current ARM CPU cores is helpful but not required.
Software development skills and/ or experience is helpful (C/C++, Python/Perl, Shell scripting)
Experience modelling microprocessors using higher-level languages, like C/C++, is helpful but not required
Effective communication skills and the ability to collaborate with a team
DIGITAL DESIGN AND COMPUTER ORGANIZATION
Course Structure
Digital Design
Combinational logic design
Sequential logic design
Computer Organization
Architecture (microprocessor instruction set)
Microarchitecture (microprocessor operation)
THANK YOU
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Solution:
Gate-Level Minimization and Combinational logic
Boolean Functions
Gate-Level Minimization and Combinational logic
Boolean Functions
Algebraic Manipulation
Gate-Level Minimization and Combinational logic
Boolean Functions
Complement of a Function
Gate-Level Minimization and Combinational logic
Boolean Functions
Complement of a Function
Gate-Level Minimization and Combinational logic
What is a Logic Circuit?
Logic Circuit Example Logic Circuit
a b c y
Multiple logic gates a1 0u
t0 0 0 0 0
combined together, with
1y 0 0 1 0
the output of one gate 0 1 0 0
being connected to the b1 1v
c 1 0 1 1 1
input of another, form a 1 0 0 0
logic circuit Boolean function
1 0 1 1
1 1 0 1
Does a logic circuit 1 1 1 1
Truth table
represent a Boolean
function?
Gate-Level Minimization and Combinational logic
What is Boolean Algebra?
Algebra
In mathematics, an Algebra is composed of four
things: a set of elements, operations on those
elements, identity elements and laws/identities
StandardAlgebra Boolean Algebra
1 Set Real numbers 1 Set {0,1}
2 Operations Add, subtract, multiply, divide 2 Operations AND, OR, NOT
3 Identity elements 0 (for add), 1 (for multiply) 3 Identity elements 1 (for AND),
4 Laws/Identities Commutative, associative, 0 (for OR)
distributive, . .. 4 Laws/Identities Commutative,
associative, distributive, . . .
Gate-Level Minimization and Combinational logic
Boolean Identities / Laws
Name Law Dual Law
Commutative a ·b = b · a a +b = b +a
Associative (a ·b) · c = a ·(b ·c) (a + b) + c = a + (b + c)
Distributive a ·(b + c) = a ·b + a ·c a + (b ·c) = (a + b) ·(a + c)
Principle of Duality
Bool equation remains true if + and · are exchanged, and also 0 and 1 areexchanged
Gate-Level Minimization and Combinational logic
Boolean Identities / Laws
Boolean identities will be used for proving Boolean formula equivalence and logic minimization
Gate-Level Minimization and Combinational logic
From Truth Table to Boolean Formula and its Minimization
Given a combinational logic circuit or Boolean formula, we have
learnt to construct its truth table
But, given a truth table, how to construct a Boolean formula (or
combinational logic circuit) for it?
Also, as there are multiple Boolean formulas / logic circuits for each
truth table, how to pick the minimal one?
Above problem is called logic minimization
• many metrics: smallest, fastest, least power cosumption
• our metric: smallest two level Sum of Products formula
• may be more than one solution
Gate-Level Minimization and Combinational logic
Canonical and Standard Forms
SOP Example
Truth table: SOP form Boolean formula:
a b c y minterm name y = a’bc+ ab’c’+ abc’+ abc
0 0 0 0 a’b’c’ m0
y = m3 + m4 + m6 + m7
0 0 1 0 a’b’c m1
0 1 0 0 a’bc’ m2 Sigma (Σ) notation:
0 1 1 1 a’bc m3 y = Σ ( m3 , m4 , m6 , m7 )
1 0 0 1 ab’c’ m4
1 0 1 0 ab’c m5 y = Σ ( 3, 4, 6, 7)
1 1 0 1 abc’ m6 If the Boolean function is called f :
1 1 1 1 abc m7 y = f (a, b, c )
Gate-Level Minimization and Combinational logic
Canonical and Standard Forms
POS Form
Product of all maxterms corresponding to a 0 output
POS Example
Truth table: SOP form Boolean formula:
a b c y maxterm name y = (a+b +c )(a+b +c ’ ) ( a +b ’ + c ) ( a ’ + b + c ’ )
0 0 0 0 a+b+c M0
0 0 1 0 a + b+ c’ M1 y = M0 M1 M2 M5
0 1 0 0 a + b’+ c M2 Pi (Π) notation:
0 1 1 1 a +b ’+ c’ M3 y = Π(M 0 , M 1 , M 2 , M 5 )
1 0 0 1 a’ + b+ c M4
1 0 1 0 a’ +b + c’ M5 y = Π(0, 1, 2, 5)
1 1 0 1 a’+ b’+ c M6 If the Boolean function is called f :
1 1 1 1 a’ + b’ + c’ M7
y = f (a, b, c )
Gate-Level Minimization and Combinational logic
Canonical and Standard Forms
Minterms and Maxterms
Gate-Level Minimization and Combinational logic
Canonical and Standard Forms
Minterms and Maxterms
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
• The 0 and 1 marked in each row and column designate the values of
variables.
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Two-variable K-map.
(a)F(x, y) = 𝚺(3) (b)F(x, y) = 𝚺(1,2,3)
Three-variable K-map.
Three-variable K-map.
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Three-variable K-map.
Three-variable K-map.
Three-variable K-map.
Four-variable map.
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Four-variable K-map.
• The map minimization of four-variable Boolean
functions is similar to the method used to minimize
three-variable functions. Adjacent squares are defined
to be squares next to each other.
• For example, m0 and m2 form adjacent squares, as do
m3 and m11.
• The combination of adjacent squares that is useful
during the simplification process is easily determined
from inspection of the four-variable map:
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Four-variable K-map.
• One square represents one minterm, giving a term with
four literals.
• Two adjacent squares represent a term with three literals.
• Four adjacent squares represent a term with two literals.
• Eight adjacent squares represent a term with one literal.
• Sixteen adjacent squares produce a function that is
always equal to 1
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Four-variable K-map.
Map for Example F(w, x, y, z) = 𝚺(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14) = y’ + w’z’ + xz’.
Gate-Level Minimization and Combinational logic
The Map Method Four Variable K Map
Four-variable K-map.
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic.
.
Gate-Level Minimization and Combinational logic
Don’t-care conditions.
.
THANK YOU
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
The procedure for obtaining the logic diagram from a Boolean function is as follows:
Wired logic
(a) Wired-AND logic with two NAND gates
(b) Wired-OR in emitter-coupled logic (ECL) gates.
Gate-Level Minimization and Combinational logic
NAND and NOR implementation
Other Two-Level implementation
• NAND or NOR gates allow the possibility of a wire connection between the
outputs of two gates to provide a specific logic function. This type of logic is
called wired logic.
• For example, open-collector TTL NAND gates, when tied together, perform
wired-AND logic.
• The wired-AND logic performed with two NAND gates is depicted in
Figure
Gate-Level Minimization and Combinational logic
Other Two-Level Implementations
• The logic function implemented by the circuit of Fig (a) is
F = (AB)’.(CD)’ = (AB + CD)’ = (A’ + B’)(C’ + D’) and is called
an AND–OR–INVERT function.
• Similarly, the NOR outputs of ECL gates can be tied together
to perform a wired-OR function.
• The logic function implemented by the circuit of Fig. (b) is F
= (A + B)’+ (C + D)’ = [(A + B)(C + D)]’ and is called an OR–
AND–INVERT function.
Gate-Level Minimization and Combinational logic
NAND and NOR implementation
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Combinational Circuits
Analysis Procedure
Design Procedure
G4=A
G3 =A’B+AB’=A⊕B
G2=B’C+BC’=B⊕C
G1=C’D+CD’=C⊕D
Gate-Level Minimization and Combinational logic
Design Procedure
Gray to Binary code converter.
Gray Code to Binary Conversion
1.The MSB of the binary number will be equal to the MSB of the given gray
code.
2.Now if the second gray bit is 0, then the second binary bit will be the same as
the previous or the first bit. If the gray bit is 1 the second binary bit will alter. If
it was 1 it will be 0 and if it was 0 it will be 1.
3.This step is continued for all the bits to do Gray code to binary conversion.
Gate-Level Minimization and Combinational logic
Design Procedure
Gray code to Binary converter.
B4=A
B3 =A’B+AB’=A⊕B
B2=A⊕ B⊕C
B1= A⊕ B⊕ C⊕D
Gate-Level Minimization and Combinational logic
Design Procedure
8 4 -2 -1 to BCD conversion
0
4-3=1
4-2=2
4-3=1
4
8-3=5
8-2=6
8-1=7
8
12-3=9
Gate-Level Minimization and Combinational logic
Design Procedure
8 4 -2 -1 to BCD conversion
W=AB+AC’D’
X =BC’D’+B’D+B’C
Y=C’D+CD’= C⊕D
Z= D
THANK YOU
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
• The simplified Boolean functions for the two outputs can be obtained
directly from the truth table. The simplified sum-of-products
expressions are
S = x’y + xy’
C = xy
Gate-Level Minimization and Combinational logic
Adder Subtractor
Truth Table of Half Adder
Gate-Level Minimization and Combinational logic
Adder Subtractor
Implementation of half adder.
Gate-Level Minimization and Combinational logic
Adder Subtractor
Full Adder
Diff= A'B+AB'
Borrow = A'B
Gate-Level Minimization and Combinational logic
Adder Subtractor
Full Subtractor D = A’B’Bin + A’BBin’ + AB’Bin’ + ABBin
= Bin(A’B’ + AB) + Bin’(AB’ + A’B)
= Bin( A XNOR B) + Bin’(A XOR B)
= Bin (A XOR B)’ + Bin’(A XOR B)
= Bin XOR (A XOR B)
= (A XOR B) XOR Bin
• Pi=carry propagate
• Gi=Carry generate
• Carry lookahead logic-most widely used technique to reduce the carry
delay time
Gate-Level Minimization and Combinational logic
Adder Subtractor
Full adder with P and G shown.
Gate-Level Minimization and Combinational logic
Adder Subtractor
Logic diagram of carry lookahead generator
Gate-Level Minimization and Combinational logic
Adder Subtractor
Four-bit adder with carry lookahead.
Gate-Level Minimization and Combinational logic
Adder Subtractor
BCD adder
In BCD, it is obvious that the most significant bit (leftmost) is always 0,
and therefore each digit will be confined to the range 0-9.
When adding BCD numbers, if the sum of two BCD digits is greater than
9, the result is greater than 1001 in binary and hence is not valid in BCD.
A correction needs to be performed by adding 0110 (6 in BCD) to the sum
to get the correct BCD result.
Gate-Level Minimization and Combinational logic
Adder Subtractor
Derivation of BCD adder
Gate-Level Minimization and Combinational logic
Adder Subtractor
BCD adder
Note: If the sum of two numbers is less than or equal to 9, then the value of
BCD sum and binary sum will be same otherwise they will differ by 6(0110
in binary).
BCD Correction : We are adding “0110” (=6) only to the second half of the table.
The conditions are:
1.If K = 1 (Satisfies 16-19)
2.If Z8Z4 = 1 (Satisfies 12-15)
3.If Z8Z2 = 1 (Satisfies 10 and 11)
So, the logic is
K + Z8Z4 + Z8Z2 = 1
Gate-Level Minimization and Combinational logic
Adder Subtractor
Block Diagram of BCD adder
Overflow condition
When two numbers with n digits each are added and the sum is a number
occupying n + 1 digits, we say that an overflow occurred
The detection of an overflow after the addition of two binary numbers depends
on whether the numbers are considered to be signed or unsigned.
When two unsigned numbers are added, an overflow is detected from the end
carry out of the most significant position.
Signed numbers
MSB(leftmost bit)- sign
Negative numbers are represented in 2’s complement.
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
the least significant bit. Each such multiplication forms a partial product.
➢ The final product is obtained from the sum of the partial products.
Gate-Level Minimization and Combinational logic
Binary Multipliers
Binary multipliers.
A>B : AB’
A<B : A’B
A=B : A’B’ + AB
Gate-Level Minimization and Combinational logic
Magnitude Comparators
➢ When the numbers are binary, the digits are either 1 or 0, and the equality of
each pair of bits can be expressed logically with an exclusive-NOR function
as
xi = AiBi + Ai Bi for i = 0, 1, 2, 3
where xi = 1 only if the pair of bits in position i are equal (i.e., if both are 1
or both are 0).
Gate-Level Minimization and Combinational logic
Magnitude Comparators
➢ For equality to exist, all xi variables must be equal to 1, a condition that dictates an
AND operation of all variables:
(A = B)= x3x2x1x0
➢ The binary variable (A = B) is equal to 1 only if all pairs of digits of the two numbers
are equal.
➢ To determine whether A is greater or less than B , we inspect the relative magnitudes
of pairs of significant digits, starting from the most significant position.
➢ If the two digits of a pair are equal, we compare the next lower significant pair of
digits.
➢ The comparison continues until a pair of unequal digits is reached. If the
corresponding digit of A is 1 and that of B is 0, we conclude that A > B.
➢ If the corresponding digit of A is 0 and that of B is 1, we have A < B.
Gate-Level Minimization and Combinational logic
Magnitude Comparators
➢ The sequential comparison can be expressed logically by the two Boolean functions
(A > B) = A3B3’ + x3 A 2B2’ + x3x2A1B1’ + x3x2x1A0B0’
(A < B) = A3’B3 + x3A2’B2 + x3x2A1’B1 + x3x2x1A’0B0
➢ The symbols (A > B) and (A < B) are binary output variables that are equal to 1 when
A > B and A < B, respectively.
➢ The unequal outputs can use the same gates that are needed to generate the equal
output
➢ The four x outputs are generated with exclusive-NOR circuits and are applied to an
AND gate to give the output binary variable (A = B) .
➢ The other two outputs use the x variables to generate the Boolean functions listed
previously. This is a multilevel implementation and has a regular pattern.
THANK YOU
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Decoders
2n outputs
n inputs Binary
Decoder
1:2 Decoder
1:2 decoder symbol: 1:2 decoder logic circuit: 1:2 decoder truth table:
j o0 o1
oo 0 1 0
0 o0
o1 1 0 1
1 o1
j 1:2 decoder Boolean
formula:
j o0 = j
o1 = j
Inputs: j
Output: o0, o1
Gate-Level Minimization and Combinational logic
Decoders
From truth table, circuit for 2x4
decoder is:
F0
X
2-to-4 F1 Note: Each output is a 2-variable
Y Decoder F2 minterm (X'Y', X'Y, XY' or XY)
F3
F0 = X'Y'
F1 = X'Y
F2 = XY'
Truth Table:
X Y F0 F 1 F2 F3 F3 = XY
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
X Y
Gate-Level Minimization and Combinational logic
Decoders
2:4 Decoder
2:4 decoder symbol: 2:4 decoder logic circuit:
2:4 decoder
truth table: o0
00 o0
j1 j0 o0 o1 o2 o3
01 o1 o1
0 0 1 0 0 0
10 o2 0 1 0 1 0 0
11 o3 1 0 0 0 1 0 o2
1 1 0 0 0 1
o3
j0 j1
2:4 decoder Boolean formula: j0 j1
o0 = j1 j0 o1 = j1 j0
o2 = j1 j0 o = j1 j0
Gate-Level Minimization and Combinational logic
Decoders
F0
F6 = xyz'
F1
X
F2 F7 = xyz
Y
3-to-8
F3
Z
Decoder F4
F5
F6
x y z
F7
Gate-Level Minimization and Combinational logic
Decoders
Any n-variable logic function can be implemented using a single n-to-2n decoder to
generate the minterms
➢ OR gate forms the sum.
➢ The output lines of the decoder corresponding to the minterms of the
function are used as inputs to the or gate.
Any combinational circuit with n inputs and m outputs can be implemented with an
n-to-2n decoder with m OR gates.
Suitable when a circuit has many outputs, and each output function is expressed with
few minterms.
Gate-Level Minimization and Combinational logic
Decoders
x y z C S
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
Full adder
S(x, y, z) = S (1,2,4,7)
C(x, y, z) = S (3,5,6,7)
Gate-Level Minimization and Combinational logic
Decoders
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Encoders
In addition to the two outputs x and y, the circuit has a third output designated by V ; this is a
valid bit indicator that is set to 1 when one or more inputs are equal to 1
The operation of the priority encoder is such that if two or more inputs are equal to 1 at the
same time, the input having the highest priority will take precedence
Gate-Level Minimization and Combinational logic
Encoders
Inputs Outputs
I0 I1 I2 I3 I4 I5 I6 I7 y2 y1 y0 Idle
0 0 0 0 0 0 0 0 x x x 1
1 0 0 0 0 0 0 0 0 0 0 0
X 1 0 0 0 0 0 0 0 0 1 0
X X 1 0 0 0 0 0 0 1 0 0
X X X 1 0 0 0 0 0 1 1 0
X X X X 1 0 0 0 1 0 0 0
X X X X X 1 0 0 1 0 1 0
X X X X X X 1 0 1 1 0 0
X X X X X X X 1 1 1 1 0
Gate-Level Minimization and Combinational logic
Encoders
Priority Encoder (8 to 3 encoder)
Alarm Contoller
Signal Response
Machine 1
Machine 2 Machine
Code
Encoder Controller
Machine n
THANK YOU
Team DDCO
Department of Computer Science
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Gate-Level Minimization and Combinational logic
Department of Computer Science and Engineering
DIGITAL DESIGN AND
COMPUTER ORGANIZATION
Multiplexers
A multiplexer (also called a mux) multiplexes many inputs onto a single output
2:1 Mux
n
2 input lines
n selection lines.
2:1 mux truth table:
2:1 mux logic circuit: 2:1 mux symbol:
i0 i1 j y
0 0 0 0 i0
0 0 1 0 i0 0
o
0 1 0 0 i1 1
0 1 1 1 i1
1 0 0 1 j
1 0 1 0
j
1 1 0 1 Data inputs: i0, i1
1 1 1 1 Control input: j
2:1 mux Boolean formula:
o = j i0 + j i1
A multiplexer is a combinational circuit that selects binary information from one of many input
lines and directs it to a single output line. The
n
selection of a particular input line is controlled by a
set of selection lines. Normally, there are 2 input lines and n selection lines whose bit
combinations determine which input is selected
Gate-Level Minimization and Combinational logic
Multiplexers
4:1 Multiplexer
j1 j0
j0 j1
4:1 mux Boolean formula:
o = j 1 j 0 i0 + j 1 j 0 i1 + j 1 j 0 i2 + j 1 j 0 i3
Gate-Level Minimization and Combinational logic
Multiplexers
4:1 Multiplexer
5:1 Mux
A combinational logic circuit having n data inputs, [log2 n| control inputs and one
output, that connects the data input indicated by the control inputs to the output
Gate-Level Minimization and Combinational logic
Multiplexers
Think About It
F (x, y, z) = (1, 2, 6, 7)
A normal buffer typically has two states: 0 (LOW) and 1 (HIGH). These are the logic levels where the output actively drives the circuit.
A three-state buffer, however, adds a third state called the high-impedance (Z) state, where the output neither drives a HIGH nor
LOW signal. In this state, it acts like it's disconnected from the circuit.
When the control input is active, the buffer passes the input signal (either HIGH or LOW).
When the control input is inactive, the buffer enters the high-impedance (Z) state, essentially
disconnecting its output.
In the high-impedance state, the output is essentially "floating", meaning it has no influence on the bus or other components
connected to it.
Gate-Level Minimization and Combinational logic
Multiplexers
Multiplexers with three-state gates.
THANK YOU
Team DDCO
Department of Computer Science
Merged&Editedby_Aayan