Digital Electronics PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 135

ASIC Design Flow

Sivakumar P R
Founder and CEO

www.maven-silicon.com 1

Maven Silicon Confidential

All the videos, presentations, documents, user guides and source codes
that you are using as part of this online training course are the
proprietary work of Maven Silicon and is fully protected under
copyright and trade secret laws.

www.maven-silicon.com 2
1

2
Maven Silicon Confidential
Specification Floor Planning

Architecture Placement

Behavioral Model Clock Tree Synthesis Timing


Not OK
RTL Coding Routing
Bugs
Verification Static Timing Analysis

Synthesis Physical Layout

Gate Level Simulation Design Rule Check

DFT Insertion Layout Vs Schematic

GDSII
To foundry
www.maven-silicon.com 3

Digital Electronics

Sivakumar P R
Founder and CEO

www.maven-silicon.com 4
2

4
Course Agenda

 Introduction  Combinational Logic Circuits


 Number Systems & Codes  Design Procedure
 Conversion Techniques
 Delays in combinational circuits
 Signed Numbers
 Adders & Subtractors
 Arithmetic Operations
 Encoders & Decoders
 Codes
 Logic Circuits & Boolean Algebra  Multiplexer & Demultiplexer.
 Logic Gates  Implementation of Boolean
 Boolean Algebra functions using Multiplexers.

 NAND & NOR Circuits  Tristate Buffers.


 Logic Minimization & K-Map
 Don’t care Conditions

www.maven-silicon.com 5

Course Agenda

 Sequential Logic Circuits  Finite State Machines


 Latches  Mealy Machine
 Flipflops
 Moore Machine
 Delays in Sequential Circuits
 Glitches & Hazards
 Registers
 Definition
 Buffer & Shift Registers
 Counters  Elimination of Hazards
 Classification  Memories
 Modulus of a counter  Classification of memories.
 Counter Design Process  Basic Concepts of Memories
 Frequency division
 Composition of memories.
 Shift register Counters

www.maven-silicon.com 6
3

6
Number Systems

www.maven-silicon.com 7

Agenda

Binary, Decimal, Octal and Hexa Decimal Number


Number system Conversions
Signed Numbers
Sign Magnitude Representation
Complement Representation
Arithmetic Operations using Complement number system.
Codes

www.maven-silicon.com 8
4

8
Number Systems
What is Number System?
It can be defined as the Language of Numbers
Each Language contains different set of symbols for representation
of numbers.
The most commonly used number systems are
Decimal Number System.
Binary Number System.
Octal Number System. Radix or Base
Hexa Decimal Number System.

www.maven-silicon.com 9

Number Systems
Decimal Number System
Example : 12495 (10)

Binary Number System


Example :

Octal Number System


Example : 71245 (8)

Hexa Decimal Number System

9ABD5 (16)
www.maven-silicon.com 10
5

10
Number system conversions
Any radix to Decimal number system
No. of digits to the left of the radix point.
Value of the number

Radix of the number system

No. of digits to the right of the radix point.


www.maven-silicon.com 11

11

Binary to Decimal Conversion


d-1d-2
1010.01 (2)
d3d2d1d0

In this case,
p = No. of digits to the left of the radix point
n = No. of digits to the right of the radix point
d = Value of the number
r = Radix of the number system = 2

www.maven-silicon.com 12
6

12
Decimal to other number system
Integer part of Decimal number
Successive Division
by Required Radix number

Fractional part of Decimal number


Successive Multiplication
by Required Radix number

www.maven-silicon.com 13

13

Decimal to other number system


125 (10) = ? (2)
Successive division

www.maven-silicon.com 14
7

14
Decimal to other number system

Successive multiplication

www.maven-silicon.com 15

15

Binary to Octal

Appending ‘ 0’s ’ at
MSB position of integer
part, doesn’t change
the value of the
3 5 3 number.

www.maven-silicon.com 16
8

16
Binary to Hexa

Appending ‘ 0’s at MSB position


of integer part & Appending ‘ 0’s
at LSB position in the fraction
part of the number, doesn’t
1 D 6 change the value of the number.

www.maven-silicon.com 17

17

Octal to Binary

100 111 110 101 100 011

www.maven-silicon.com 18
9

18
Hexa to Binary

1010 1101 1110 0101 0100 1100

www.maven-silicon.com 19

19

Signed Numbers

Schemes to represent the signed numbers


Sign – Magnitude Representation
Complement Representation

www.maven-silicon.com 20
10

20
Sign – Magnitude Representation
MSB is used as sign bit & the other bits represents the magnitude.

Example:

Range of the n bit signed magnitude integer :

Shortcomings:
• Complex Circuits 00000 +0
• Two representations for 0 10000 -0

www.maven-silicon.com 21

21

Complement Representation
1’s complement - Complementing all bits
Example :

2’s complement - Add 1 to 1’s complement.


Example :
Easy Method to get 2’s Complement Start from LSB and use the
same digits until, you come
across ‘1’ and complement
the remaining bits.

www.maven-silicon.com 22
11

22
2’s Complement for Binary Arithmetic

Addition Subtraction

Key Points
For Subtraction, Take 2’s
Complement of the negative
number and add it with the other
number.
Carry 1 indicates positive number
Carry 0 indicates negative number.
2’s complement of 1101 is 0011
www.maven-silicon.com 23

23

Complement Number system

System Base Possible complement systems


Binary 2 1’s comp & 2’s comp
Decimal 10 9’s comp & 10’s comp

Octal 8 7’s comp & 8’s comp

Hexa 16 15’s comp & 16’s comp


Unknown n (n-1)’s comp & n’s comp

www.maven-silicon.com 24
12

24
Arithmetic using Complement System

‘77’ is the maximum


2 digit octal number

Additional Carry (if any) has to be


discarded.

www.maven-silicon.com 25

25

Arithmetic using Complement System

If the additional carry is not ‘FF’ is the


generated, It indicates that maximum 2 digit
the result is a negative hexa number
number.

To get the magnitude of


result, 16’s complement has
to be calculated for the
sum obtained.

www.maven-silicon.com 26
13

26
Codes
Symbolic representation
Types of codes
Weighted binary codes.
Non-weighted codes.
Alphanumeric codes.
Error detecting codes.

www.maven-silicon.com 27

27

Weighted Binary Codes


Decimal 8421 5421 2421
0 0000 0000 0000
1 0001 0001 0001
BCD Code
2 0010 0010 0010
3 0011 0011 0011
4 0100 0100 0100
5 0101 1000 1011
6 0110 1001 1100
7 0111 1010 1101
8 1000 1011 1110
9 1001 1100 1111

www.maven-silicon.com 28
14

28
Non – Weighted Codes
Non –weighted codes are not positional weighted.
Example : Decimal Binary Gray
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
Gray Code 4 0100 0110
• The no. of bit changes is only one
5 0101 0111
between two consecutive numbers
• Used in low power applications 6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
www.maven-silicon.com 29

29

Binary and Gray code Conversion


Binary to Gray code Conversion

XOR XOR XOR XOR

Gray to Binary code Conversion

www.maven-silicon.com 30
15

30
ASCII
ASCII stands for American Standard Code for Information
Interchange
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT EF CR SO SI
1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2 ! -- # $ % & . ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : : < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ / ] ^ _
6 . a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { l } ~ DEL

The code uses 7 bits to encode 128 unique characters


www.maven-silicon.com 31

31

Other codes

Parity codes - Parity bits for detection of errors.


Hamming code is for correcting the errors.
Hollerith code.
EBCDIC (Extended Binary Coded Decimal Interchange Code)
ASCII Redefined with 8 bits to represent 256 different characters.

www.maven-silicon.com 32
16

32
Logic Circuits

www.maven-silicon.com 33

33

Agenda

Logic gates
Boolean Algebra
NAND and NOR Circuits
Logic Minimisation

www.maven-silicon.com 34
17

34
Logic Gates
NOT gate (Inverter) Truth Table of NOT gate
A(I/P) Y(O/P)
A Y=A
0 1
1 0

AND gate Truth Table of AND gate


A A B Y(O/P)
Y = A.B
B 0 0 0
0 1 0
1 0 0
1 1 1
www.maven-silicon.com 35

35

Logic Gates
OR gate Truth Table of OR gate
A A B Y(O/P)
Y=A+B
B 0 0 0
0 1 1
1 0 1
1 1 1
NAND gate Truth Table of NAND gate
A B Y(O/P)
A
A.B 0 0 1
B
0 1 1
1 0 1
1 1 0
www.maven-silicon.com 36
18

36
Logic Gates
NOR gate Truth Table of NOR gate
A B Y(O/P)
A
A + B 0 0 1
B
0 1 0
1 0 0
1 1 0
XOR gate Truth Table of XOR gate
A B Y(O/P)
A
A + B 0 0 0
B
=AB+AB 0 1 1
1 0 1
1 1 0
www.maven-silicon.com 37

37

Properties of XOR Gate

A B EXOR

Vcc
A A A B
B B
Inverter
Buffer

www.maven-silicon.com 38
19

38
Properties of XOR Gate

A B EXOR

Since, the total no. of 1’s in inputs and output is even. So, we can consider it as Even
Parity Generator.
Since, No. of 1’s in inputs, is odd. Output has become 1. So, we can consider it as odd
parity detector.

www.maven-silicon.com 39

39

Logic Gates
EXNOR gate Truth Table of EXNOR gate
A A B Y(O/P)
A + B
B 0 0 1
=AB+AB 0 1 0

Can be called
1 0 0
as Equality 1 1 1
Gate

Output is complement of EXOR gate.

www.maven-silicon.com 40
20

40
Boolean Algebra
(T1) X+0=X (T1') X . 1 = X
(T2) X+1=1 (T2') X . 0 = 0
(T3) X+X=X (T3') X . X = X
(T4) (X') ' = X
(T5) X + X' = 1 (T5') X . X' = 0

(T6) X + Y = Y +X (T6') X . Y = Y .X;


(T7) X + (Y + Z) = (X + Y) + Z (T7') X . (Y . Z) = (X . Y) . Z
(T8) X . Y + X . Z = X . (Y +Z) (T8') (X + Y) . (X + Z) = X + (Y . Z)
(T9) X + X . Y = X (T9') X . (X + Y) = X
(T10) X . Y + X . Y' = X (T10') (X + Y) . (X + Y') = X

(T11) X . Y + Y . Z + X'. Z = X . Y +X' . Z


(T11') (X + Y) . (Y + Z) . (X'+ Z) = (X + Y) . (X' + Z)
www.maven-silicon.com 41

41

Boolean Algebra
Expression Dual of the Expression

Famous De Morgan Rules Dual of the Expression

Consensus Theorem Dual of the Expression

www.maven-silicon.com 42
21

42
Proof for Consensus Theorem

www.maven-silicon.com 43

43

Gate Equivalents
De Morgan’s rules.
A A A+B A.B
A.B
B B

A A A.B A+B
A + B
B B

A A A+B A.B
A.B
B B

A A A.B A+B
A+B
B B

www.maven-silicon.com 44
22

44
Complement
The complement of a function F is denoted by F' or F
DeMorgan's theorems to compute the complement of a function.

Another way of finding Complement function

www.maven-silicon.com 45

45

Logic Circuit from function


Implement the function using Logic Gates.

A
A AB

D CD
D

www.maven-silicon.com 46
23

46
Function from circuit
Determine the output function from the given circuit.

A
A A + B = A.B

B
AB .CD
C = AB+CD

D = A+B+C+D
CD
D

www.maven-silicon.com 47

47

SOP & POS


Any Boolean function can be expressed in two different standard
forms.
 Sum Of Products (SOP),

 Product Of Sums (POS).

www.maven-silicon.com 48
24

48
SOP
A B C Y(O/P)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
To get Complement, Write
1 1 0 1 only the leftout Terms
1 1 1 0

www.maven-silicon.com 49

49

POS
A B C Y(O/P)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1 To get Complement,
1 1 0 0 Write only the left out
Terms
1 1 1 1

www.maven-silicon.com 50
25

50
Positive Logic Vs Negative Logic
Positive Logic Negative Logic

Voltage Logical Voltage Logical


Level Value Level Value
LOW 0 LOW 1
HIGH 1 HIGH 0

A B Y A B Y
0 0 0 1 1 1
0 1 0 1 0 1
1 0 0 0 1 1
1 1 1 0 0 0

www.maven-silicon.com 51

51

SOP Vs POS

Truth Table
SOP
+ ve Logic NAND Circuit

Truth Table
POS
- ve Logic NOR Circuit

www.maven-silicon.com 52
26

52
Universal Logic Elements

NAND & NOR Gate - Universal Logic Elements


Any Boolean Expression can be realized using these gates alone .

NAND Gate NOR Gate


A A
A.B A + B
B B

www.maven-silicon.com 53

53

NAND Vs NOR
NAND NOR

NAND - Faster and Smaller


www.maven-silicon.com 54
27

54
SOP - NAND Gates

Step 1: Implement the Logic Step 2: Replace the intermediate


Circuit Normally. connecting wires with a pair of inverters
connected in cascade.

A`
B A`
B B
C B
A` C
C A`
C

www.maven-silicon.com 55

55

SOP - NAND Gates

Notice the fact that a pair of inverters in cascade doesn’t alter the functionality

Step 3: Replace bubbled OR gate


with NAND Gate.

A`
B
B
C
Now, the logic circuit
A` consists of NAND gates only
C

www.maven-silicon.com 56
28

56
SOP - NOR Gates

Step 1: Implement the Logic Step 2: Replace the Input & Output
Circuit Normally. wires with a pair of inverters connected
in cascaded.

Notice the fact that inputs are also


toggled to retain the functionality.
www.maven-silicon.com 57

57

SOP - NOR Gates

Step 3: replace the bubbled AND Gates at the inputs with NOR
Gate& replace the Inverter with 2 i/p NOR Gate with both the
i/p’s shorted.

A
B`
B`
C`
Now, the logic circuit
A consists of NOR gates only
C`

www.maven-silicon.com 58
29

58
POS - NOR Gates

Step 1: Implement the Logic Step 2: Replace the intermediate


Circuit Normally. connecting wires with a pair of inverters
connected in cascade.

www.maven-silicon.com 59

59

POS - NOR Gates

Notice the fact that a pair of inverters in cascade doesn’t alter the functionality

Step 3: Replace bubbled AND gate


with NOR Gate.

A`
B
B
C
A` Now, the logic circuit
consists of NOR gates only
C

www.maven-silicon.com 60
30

60
POS - NAND Gates

Step 1: Implement the Logic Step 2: Replace the Input & Output
Circuit Normally. wires with a pair of inverters connected
in cascaded.

www.maven-silicon.com 61

61

POS - NAND Gates

Step 3: replace the bubbled OR Gates at the inputs with NAND


Gate& replace the Inverter with 2 i/p NAND Gate with both the
i/p’s shorted.

Now, the logic circuit


consists of NAND gates only

www.maven-silicon.com 62
31

62
Implement the function

X + X’Y = X + Y
www.maven-silicon.com 63

63

Logic Minimization
Advantages of Logic Minimization
Less no. of gates for implementation.
Size of the circuit will be less.
Less amount of power consumption.
More speed of operation of the Logic Circuuit.

A major step in digital design

www.maven-silicon.com 64
32

64
Logic Minimization
Minimize the following expression

C
Y=C

www.maven-silicon.com 65

65

Logic Minimization
Minimize the following expression

www.maven-silicon.com 66
33

66
Karnaugh Map

CD
AB 00 01 11 10 These cells marked with a
specific numbers to
00 0000 0001 0011 0010 represent the corresponding
minterm or maxterm
0 1 3 2

01 0100 0101 0111 0110


4 5 7 6 Two adjacent cells are differed
by only one digit
11 1100 1101 1111 1110
12 13 15 14
because of the usage of gray
code

10 1000 1001 1011 1010


8 9 11 10

www.maven-silicon.com 67

67

Karnaugh Map

2 Variable 3 Variable 4 Variable


K- Map K- Map K- Map

0 1 0 0
0 0 0 1 1 0 0 1 0 0
0 1 0 1 1 1 1 1 1 1
0 1 0 0

www.maven-silicon.com 68
34

68
Karnaugh Map

1 1 0 0
1 0 1 1

Depending on the grouping,


multiple solutions are possible.

1 1 0 0
1 0 1 1
www.maven-silicon.com 69

69

Karnaugh Map

1 1 0 0 1 1 0 0
0 0 1 0 0 0 1 0
0 1 1 1 0 1 1 1
1 1 0 0 1 1 0 0

www.maven-silicon.com 70
35

70
Karnaugh Map - POS

1 0 0 1
0 1 1 0
0 1 1 1
1 1 0 1

www.maven-silicon.com 71

71

Karnaugh Map

1 0 0 1 1 0 0 1
0 1 1 0 0 1 1 0
0 1 1 1 0 1 1 1
1 1 0 1 1 1 0 1

www.maven-silicon.com 72
36

72
Don’t Care Conditions

An input-output conditions that never occurs during normal


operation.
It is indicated by ' X ' in the truth table.
It can be either 0 or 1 , whichever produces simpler logic circuit.

www.maven-silicon.com 73

73

Don’t Care Conditions

0 0 1 1
1 0 0 1
1 X 0 X
0 0 1 X

www.maven-silicon.com 74
37

74
K Map Example
Design a circuit for the following output waveforms.
Inputs Outputs
A Time
A B C Fa Fb
B t0 0 0 0 0 0
t1 0 0 1 1 1
C
t2 0 1 0 1 0
t3 0 1 1 0 1
fa (A, B, C)
t4 1 0 0 0 0
t5 1 0 1 0 1
fb (A, B, C)
t6 1 1 0 1 1
t0 t1 t2 t3 t4 t5 t6 t7
t7 1 1 1 1 0

www.maven-silicon.com 75

75

K Map Example

0 1 0 1 0 1 1 0
0 0 1 1 0 1 0 1

www.maven-silicon.com 76
38

76
Combinational Circuits - I

www.maven-silicon.com 77

77

Agenda

Design of combinational circuits


Delays in Combinational Circuits
Adders & Subtractors

www.maven-silicon.com 78
39

78
Digital Logic Circuits
Classification of Logic Circuits

Logic Circuits whose output is completely dependent on the combination


of inputs.

Logic Circuits whose output is dependent on the combination of inputs


and past state of the circuit.
discussed in the later chapters.

www.maven-silicon.com 79

79

Combinational Logic Circuits


Block Diagram of Combinational Circuits

Steps to Design
Understand Problem description and Draw the Block Diagram with
I/P & O/P lines.
Define the truth table based on the functionality.
Get the simplified expression.
Implement the Logic circuit.
www.maven-silicon.com 80
40

80
Combinational Logic Design
Design a combinational circuit with the
specifications given below.
A switching circuit has two control inputs (C1,C2),two data inputs
(X1,X2) and one output (Z). The circuit performs one of the logic
operations on the two data inputs. The function performed depends on
the control inputs as shown below

C1
C1 C2 Operation
C2 0 0 OR
Combinational Z
0 1 EXOR
Logic Circuit
X1 1 0 AND
X2 1 1 EQU
www.maven-silicon.com 81

81

Truth Table
C1 C2 X1 X2 Output (Z)
0 0 0 0 0
0 0 0 1 1
0 0 1 0
OR
C1 C2 Operation 1
0 0 1 1 1
0 0 OR
0 1 0 0 0
0 1 EXOR
0 1 0 1 1
1 0 AND
0 1 1 0 1
EXOR
1 1 EQU
0 1 1 1 0

1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
AND
With 4 input lines, 16 1 0 1 1 1

combinations of i/p’s are 1 1 0 0 1

possible. 1 1 0 1 0
EXNOR
1 1 1 0 0
1 1 1 1 1

www.maven-silicon.com 82
41

82
Minimization

0 1 1 1
0 1 0 1
1 0 1 0
Possible groupings:
Z = C1'X1'X2 + C1'X1X2' + C1X1X2 + C1'C2' X2 + C1C2X1'X2'
0 0 1 0
Z = C1'X1'X2 + C1'X1X2' + C1C2X1'X2' + C1X1X2 + C1'C2'X1

Z = C1'X1'X2 + C1'X1X2' + C1C2X1'X2' + C1X1X2 + C2'X1X2

www.maven-silicon.com 83

83

Implementation

Implementation with
NAND Gates only.

www.maven-silicon.com 84
42

84
RTL Design

Clock Period T = Thold + Tpd + T setup

Frequency = 1 / T

www.maven-silicon.com 85

85

Delays in Combinational Circuits


Contamination Delay ( Tcd ) Propagation Delay ( Tpd )
The amount of time needed for The amount of time needed for
a change in a logic input to a change in a logic input to
result in an initial change at an result in a permanent change
output. at an output.

I/P O/P

www.maven-silicon.com 86
43

86
Delays in Combinational Circuits
Using the following table of timing specifications for each component, what
is the TPD value for the circuit shown below?

30
Gate Tcd Tpd
30
30 INV 3ps 15ps
15
50 ND2 5ps 30ps
AN2 12ps 50ps
50 NR2 5ps 30ps
OR2 12ps 50ps

Tpd 90 105 110 80


NR2, INV, AN2, OR2, 110ps is the maximum delay. So,
NR2, NR2, NR2, ND2 the Tpd of this circuit is 110ps.
ND2 NR2, ND2
ND2 www.maven-silicon.com 87

87

RTL Design

Com Com
Inte

IP 1 IP 2

Comb
IP 3

Clock Period T = Thold + Tpd + T setup

Frequency = 1 / T
www.maven-silicon.com 88
44

88
Adders & Subtractors

www.maven-silicon.com 89

89

Adders – Half Adders


Specifications of Half Adder
Adds 2 bits - A,B & produces Sum & Carry as Outputs

Block Diagram, Truth Table, Boolean Expressions


A B Carry Sum
A Sum 0 0 0 0
Half Adder 0 1 0 1

B Carry 1 0 0 1
1 1 1 0

www.maven-silicon.com 90
45

90
Adders – Half Adders
Specifications of Half Adder
Adds 2 bits - A,B & produces Sum & Carry as Outputs

Circuit Digram
A
B Sum

Carry

www.maven-silicon.com 91

91

Adders – Full Adders


Specifications of Full Adder
Adds 3 bits - A,B & Carry-in and produces Sum & Carry-out as
Outputs
Block Diagram, Truth Table, Boolean Expressions
A B Cin Cout Sum
0 0 0 0 0
A Sum
0 0 1 0 1
B Full Adder 0 1 0 0 1
Cout 0 1 1 1 0
Cin
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1

www.maven-silicon.com 92
46

92
Implementation of Full Adder
Boolean Expressions

0 1 0 1 0 0 1 0
1 0 1 0 0 1 1 1

Sum = AB’C’ + A’B’C + ABC + A’BC’ Cout = AB + BC + AC

www.maven-silicon.com 93

93

Implementation of Full Adder


Logic Circuit

www.maven-silicon.com 94
47

94
Another Version

Cout = A.B + B.C + A.C


= AB + A’BC + ABC + AB’C + ABC
= AB (1+ C + C) + C (A’B + AB’)
= AB + C(A ^ B)
A
B
HA Sum
HA

C
Implementation of full adder using Carry
Two half adders & OR Gate. www.maven-silicon.com 95

95

4-bit Adder

1 1 0 C2 C1 C0
10 1 0 1 0 A A3 A2 A1 A0
+7 + 0 1 1 1 +B + B3 B2 B1 B0
17 1 0 0 0 1 Cout S3 S2 S1 S0

www.maven-silicon.com 96
48

96
Delays in a 4-bit Adder

• Carry is propagated as a ripple from one stage to other stage. So,


this adder is called as “ripple carry adder”
• In this adder, the addition process in each stage is waiting for the
carry to be arrived from the previous stage of addition.
• So, the propagation delay of this adder is 4 times the Tpd of each
adder. Hence, this adder is slow.
www.maven-silicon.com 97

97

Delays in a 4-bit Adder

• To make the addition process much faster, we need to make the


process of addition independent on the previous stage addition.
• Carry Look Ahead Adder is an adder in which, addition process
in each stage is carried out without having a dependency on the
previous stage.

www.maven-silicon.com 98
49

98
4-bit Carry Look Ahead Adder
Truth Table of Full Adder
A B Cin C-out Sum
0 0 0 0 0
0 0 1 0 1
A + B generates carry, if and only if
0 1 0 0 1
both A and B are 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0 A + B propagates carry, if either
1 1 0 1 0 one of A or B is 1
1 1 1 1 1

www.maven-silicon.com 99

99

4-bit Carry Look Ahead Adder

www.maven-silicon.com 100
50

100
4-bit Carry Look Ahead Adder

All sum & carry expressions are So, these expressions can be used to
independent of any carry from the realize the hardware of the adder to
previous stage. improve the speed.
www.maven-silicon.com 101

101

4-bit Carry Look Ahead Adder

Carry Look Ahead Logic


www.maven-silicon.com 102
51

102
Subtractors – Half Subtractor
Specifications of Half Subtractor
Subtracts B from A & produces Difference & Borrow as Outputs

Block Diagram, Truth Table, Boolean Expressions


A B Borrow Diff
A Diff 0 0 0 0
Half 0 1 1 1
Subtractor
B Borrow 1 0 0 1
1 1 0 0

www.maven-silicon.com 103

103

Subtractors – Half Subtractor


Specifications of Half Subtractor
Subtracts B from A & produces Difference & Borrow as Outputs

Circuit Diagram

www.maven-silicon.com 104
52

104
Adders – Full Subtractor
Specifications of Full Subtractor
Subtracts B and Borrow-in from A

Block Diagram, Truth Table, Boolean Expressions


B-in
A B Borrow Diff
(C)
A Diff
0 0 0 0 0
Full 0 0 1 1 1
B
Subtractor Borrow 0 1 0 1 1
Bin 0 1 1 1 0
1 0 0 0 1
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

www.maven-silicon.com 105

105

Another Version

Borrow = A’.B + A’.C + B.C


= A’B + A’BC + A’B’C +A’BC + ABC
= A’B (1+ C + C) + C (A’B’ + AB)
= A’B + C(A ^ B)’
A
B
HS Diff
HS

C
Implementation of full Subtractor
using Borrow
Two half subtractors & OR Gate. www.maven-silicon.com 106
53

106
Adder Subtractor Circuit
A+B A+B A+ B +0
A- B A + 2’s Comp(B) A + 1’s Comp(B) + 1

www.maven-silicon.com 107

107

Adder Subtractor Circuit


A+B A+B A+ B +0
A- B A + 2’s Comp(B) A + 1’s Comp(B) + 1

www.maven-silicon.com 108
54

108
Combinational Circuits - II

www.maven-silicon.com 109

109

Agenda

Encoder & Decoder


Mux & DeMux
Tristate Buffer

www.maven-silicon.com 110
55

110
Encoders
Encoders
Converts Human understandable into machine understandable
codes
Assigns a binary code to an active input line.
One hot to binary converter,
Produces n no. of outputs when there is 2^n no. of inputs,
At most only one of the inputs will ever be high, the binary code
of this 'hot' line is produced

www.maven-silicon.com 111

111

4:2 Encoder

D0 Y0 D3 D2 D1 D0 Y1 Y0
D1 0 0 0 1 0 0
4: 2 Encoder 0 0 1 0 0 1
D2
0 1 0 0 1 0
D3 Y1 1 0 0 0 1 1

Outputs the binary value


of the active input

www.maven-silicon.com 112
56

112
Decimal to Binary Encoder
Specifications
Take 10 keys as Decimal inputs & produce 4 bit Binary
Output based on the input key What if more than one input is active?
What if no inputs are active?
Block Diagram, Truth Table
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 Y3 Y2 Y1 Y0

0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 1
1
0 0 0 0 0 0 0 1 0 0 0 0 1 0
0 0 0 0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 0 0 0 0 1 0 1
1 0 0 0 1 0 0 0 0 0 0 0 1 1 0
0 0 1 0 0 0 0 0 0 0 0 1 1 1

0 0 1 0 0 0 0 0 0 0 0 1 0 0 0
1 0 0 0 0 0 0 0 0 0 1 0 0 1
Remaining Combinations X X X X
www.maven-silicon.com 113

113

Priority Encoder
Priority Encoders
Assign priorities to the inputs when more than one input are
asserted simultaneously,
Highest priority input is taken into account to produce the
binary output.
At least any one of the input line should be active, to make the
encoder valid. A ‘valid’ indicator, is included to indicate the
same.

www.maven-silicon.com 114
57

114
8:3 Priority Encoder
Priority to higher order inputs.

D7 D7 D6 D5 D4 D3 D2 D1 D0 Y2 Y1 Y0 Valid

D6 Y2 0 0 0 0 0 0 0 0 X X X 0
D5 0 0 0 0 0 0 0 1 0 0 0 1
Y1
D4 0 0 0 0 0 0 1 X 0 0 1 1
8:3 Priority Y0
0 0 0 0 0 1 X X 0 1 0 1
D3 Encoder
0 0 0 0 1 X X X 0 1 1 1
D2
0 0 0 1 X X X X 1 0 0 1
D1
V 0 0 1 X X X X X 1 0 1 1
D0
0 1 X X X X X X 1 1 0 1

1 X X X X X X X 1 1 1 1

www.maven-silicon.com 115

115

ASCII Encoder
ASCII stands for American Standard Code for Information
Interchange
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT EF CR SO SI
1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2 ! -- # $ % & . ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : : < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ / ] ^ _
6 . a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { l } ~ DEL

The code uses 7 bits to encode 128 unique characters


www.maven-silicon.com 116
58

116
Decoders
Covert Machine understandable into Human understandable codes
Convert binary information from n input signals to 2n unique
output signals
used in a wide variety of applications, including data
demultiplexing, seven segment displays, and memory address
decoding.

www.maven-silicon.com 117

117

2:4 Decoder

D1 D0 Y3 Y2 Y1 Y0
0 0 0 0 0 1
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 0 0 0

Possible minterms
of D1 and D0

With N to 2N Decoder,
N Variable function can
be implemented
www.maven-silicon.com 118 59

118
Decoders with Active High & Low O/P with Enable inputs.

Decoder with Active HIGH Output & active HIGH Enable


En D1 D0 Y3 Y2 Y1 Y0
0 X X X X X X
1 0 0 0 0 0 1
Generates all
possible
1 0 1 0 0 1 0
minterms
1 1 0 0 1 0 0
1 1 1 1 0 0 0

Decoder with Active LOW Output & Active LOW Enable


En D1 D0 Y3 Y2 Y1 Y0
1 X X X X X X
Generates all
0 0 0 1 1 1 0
Possible
0 0 1 1 1 0 1 maxterms
0 1 0 1 0 1 1
0 1 1 0 1 1 1
www.maven-silicon.com 119

119

BCD-to-Seven Segment Decoder

1
1
0
BCD to
7-segment Display 1
Decoder 1
0
1

www.maven-silicon.com 120
60

120
Circuit Design using Decoders

Any combinational circuit with n inputs and m outputs can be


implemented with an n-to-2n decoder with m OR gates because
decoder with active HIGH output produces all possible minterms.

Similarly, Any combinational circuit with n inputs and m outputs


can be implemented with an n-to-2n decoder with m AND gates
because decoder with active LOW output produces all possible
maxterms.

www.maven-silicon.com 121

121

Fulladder using Decoders


Realize a full adder using a 3 to 8 decoder using Active
HIGH output decoder.

m0
A MSB m1
m2
Sum
m3
B 3:8 Decoder m
4
m5
Cin LSB m6
m7
Carry

www.maven-silicon.com 122
61

122
Boolean Functions using Decoders

Implement the following function using an active LOW


output decoder.
For implementing any function using active low
output decoder, the function should be in canonical
POS form

m0
A MSB m1
Y
m2
m3
B 3:8 Decoder m
4
m5
C LSB m6
m7
www.maven-silicon.com 123

123

MUX & DeMUX

www.maven-silicon.com 124
62

124
Multiplexer (MUX)
Logic Symbol & Functionality
Single output line
I0
One of the data input is routed to
I1 o/p
‘2n’ no. of the output based on the select
MUX
inputs signals.
I2n-1

‘n’ no. of
Select lines

www.maven-silicon.com 125

125

2:1 MUX
Truth Table
I0 S0 I1 I0 O/P
o/p 0 0 0 0
0 0 1 1 O/P same
I1 0 1 0 0 as I0
0 1 1 1
S0 1 0 0 0
1 0 1 0 O/P same
Functional Table 1 1 0 1 as I1
1 1 1 1
S0 O/P
0 I0
1 I1

www.maven-silicon.com 126
63

126
4:1 MUX

Functional Table
I0
S1 S0 O/P
o/p
I1 0 0 I0
I2 0 1 I1

I3
1 0 I2
1 1 I3
S1 S0

Expression for output

www.maven-silicon.com 127

127

MUX – Universal Logic


Similar to NAND & NOR, MUX can also be used to realize any
Boolean Function.
MUX – Universal Logic Block

Functions are in Canonical Form - Use truth tables


Not in Canonical Form – Use Shannon’s Expression.

www.maven-silicon.com 128
64

128
MUX – Universal Logic

www.maven-silicon.com 129

129

Implementing Logic Gates using MUX


MUX as NOT gate
If input is A, then output should be complement of A.

A O/P (Y) 1

0 1 I0 A’
0
1 0 I1 A

Outputs as
Input Signal as
Data Inputs
Select Signal

www.maven-silicon.com 130
65

130
Implementing Logic Gates using MUX
MUX as AND gate
0
II00

0 o/p
II11
0
II22
A B O/P (Y)
1
0 0 0 II33 S0
I0 = 0 S1
0 1 0
1 0 0 A B
I1 = B
1 1 1 0

AB
B
A
www.maven-silicon.com 131

131

Implementing Logic Gates using MUX

NOT gate AND gate

OR gate

www.maven-silicon.com 132
66

132
Implementing Logic Gates using MUX

NAND gate NOR gate

EXOR gate EXNOR gate

www.maven-silicon.com 133

133

Circuit Design Using MUX

Implement the following function using 16:1 MUX


A B C D Y
0 0 0 0 0
0 0 0 1 1 Since, the no. of literals in the
0 0 1 0 1
0 0 1 1 1
expression & the no. of select lines is 4,
0
0
1
1
0
0
0
1
0
0
all the input literals can be used as
0 1 1 0 1 select lines.
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0

www.maven-silicon.com 134
67

134
Function Implementation Using MUX

A B C D Y
0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0

www.maven-silicon.com 135

135

Implement using 8:1 MUX

A B C D Y
0 0 0 0 0
0 0 0 1 1
I0 = D
0 0 1 0 1
0 0 1 1 1
I1 = 1
0 1 0 0 0
0 1 0 1 0
I2 = 0
0 1 1 0 1
0 1 1 1 1
I3 = 1
1 0 0 0 0
1 0 0 1 1
I4 = D
1 0 1 0 0
1 0 1 1 0
I5 = 0
1 1 0 0 0
1 1 0 1 1
I6 = D
1 1 1 0 1
1 1 1 1 0
I7 = D’
www.maven-silicon.com 136
68

136
Implement Using 4: 1 MUX

A B C D Y
0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
I0 = C +D
0 0 1 1 1
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
I1 = C
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
I2 = C’D
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
I3 = C ^D
1 1 1 1 0

www.maven-silicon.com 137

137

MUX - Shannon’s Expression


2: 1 MUX Expression for the output

Known as Shannon’s
Expression for 2:1 MUX

1. Bring this expression into the form of


Shannon’s Expression.
2. Then draw using 2:1 MUX
3. You can learn this in detail during
Advance Digital course

www.maven-silicon.com 138
69

138
Hierarchical Design
Several issues arise when designing large multiplexers(as 2-level circuits).
• Number of logic gates gets prohibitively large
• Number of inputs to each logic gate (i.e. fan-in) gets prohibitively large

Instead, design hierarchically


• Use smaller elements as building blocks
• Interconnect building blocks in a multi-tier structure

www.maven-silicon.com 139

139

4:1 MUX using 2:1 MUX


Truth Table
S1 S0 O/P
0 0 I0
Y0
0 1 I1
1 0 I2
Y1
1 1 I3

S1 O/P 1. I0 or I1 can be selected by using a 2:1 MUX using S0


as the select line signal.
0 Y0 2. I2 or I3 can be selected by using another 2:1 MUX
using S0 as the select line signal.
3. Y0 or Y1 can be selected by using another 2:1 MUX
1 Y1 using S1 as the select line signal
www.maven-silicon.com 140
70

140
8:1 MUX using 4:1 & 2:1 MUX
Truth Table I0 0

S2 S1 S0 O/P
I1 1 Y0
I2 2
0 0 0 I0
0 0 1 I1 I3 3 0
Y0 1 0
0 1 0 I2 Y
S1 S0
0 1 1 I3
1 1
1 0 0 I4 I4 0 0

1 0 1 I5 S2
Y1 I5 1 Y1
1 1 0 I6
I6 2
1 1 1 I7
I7 3

www.maven-silicon.com 141

141

Demultiplexer (DeMUX)
Logic Symbol & Functionality
It's operation is just opposite to
that of a Multiplexer.
Depending on the data on the
select lines, the input will be
redirected to any one specific
output line.

www.maven-silicon.com 142
71

142
1:4 DeMUX

Expression for output


Y0

i/p Y1

Y2

Y3

S1 S0

www.maven-silicon.com 143

143

Tristate Buffer

www.maven-silicon.com 144
72

144
Tri State Buffers
Tristate Buffer with Active HIGH Control
Data I/P C X Carry
(X) O/P 0 0 Z
(Z) 0 1 Z
1 0 0
Control I/P (C)
1 1 1

Tristate Buffer with Active LOW Control


Data I/P C X Carry
(X) O/P 0 0 0
(Z) 0 1 1
1 0 Z
Control I/P (C)
1 1 Z

www.maven-silicon.com 145

145

Memory Circuit

WE Mode
0 Switches
1 Counter

WE Mode
0 Write
1 Read

www.maven-silicon.com 146
73

146
Sequential Logic Circuits - I

www.maven-silicon.com 147

147

Agenda

Sequential Logic circuits


Latches
Flipflops
Delays in Sequential Circuits

www.maven-silicon.com 148
74

148
Sequential Logic Circuits

‘m’ no. of
inputs Combinational ‘n’ no. of
Logic Circuit outputs

Memory

The output depends on the input & past state of the circuit.
Memory Units

www.maven-silicon.com 149

149

Memory units

The above circuit is capable of restoring the data which is


available at instant of power ON condition.
Qn Qn+1
1 1
This indicates that cascaded combination of 2 inverters
0 0 with a feedback connection is capable of storing 1 bit
information.

www.maven-silicon.com 150
75

150
Logic Circuits as memory units

The cascade connection of 2 inverters with a feedback retains the


past information
And hence it can be considered as a 1-bit memory element or 1-
bit memory cell.
But, there is no input port and hence we don’t have the control over
the data that has to be stored.
Let’s try to modify this circuit and provide i/p ports by which we
can customize the data that is going to be stored in the memory cell.

www.maven-silicon.com 151

151

1-bit memory cell


A B Y
0 0 1
0 1 0
1 0 0
1 1 0

If A = 0, then Y = B’.
This states that if one of the input to NOR gate is grounded, then
that NOR gate will act as a NOT gate.

www.maven-silicon.com 152
76

152
1-bit memory cell

In this memory cell, these two inverters can be replaced with a pair
of NOR gates with one input connected to ground.
In this circuit, the feedback is in such a way that, output of first
inverter is input to the second inverter & output of second inverter
is the input to the first inverter.

www.maven-silicon.com 153

153

1-bit memory cell

But, even with modification, there is no


input port and hence we don’t have the
control over the data to be stored.

www.maven-silicon.com 154
77

154
1-bit memory cell

This is how, RS Latch has been evolved.


Latch is nothing but a one bit memory cell which is capable of retaining
the past state output.
Since, latch is evolved from a cascaded combination of a pair of inverters,
the two outputs of a latch should be always complement to each other.
www.maven-silicon.com 155

155

Behaviour of a NOR gate


A B Y
0 0 1
A Y
0 1 0
B
1 0 0
1 1 0

This states that if one of the input to NOR gate is 0, then the output of the
NOR gate will be complement to the remaining input.
This indicates that, if one of the input is 0, then we cannot predict the output
of the NOR gate without having the knowledge of the remaining input.
www.maven-silicon.com 156
78

156
Behaviour of a NOR gate
A B Y
0 0 1
A Y
0 1 0
B 0
1 0
1 1 0

This states that if one of the input to NOR gate is 1, then the output of the
NOR gate will be always 0 irrespective of the remaining input.
This indicates that, if one of the input is 1, then we can easily predict the
output of the NOR gate without having the knowledge of the remaining input.
www.maven-silicon.com 157

157

RS Latch
0 1 R S Q Q’ State
0 1 1 0 Set

0
1

Recollect the fact that, if one of the input The outputs for this input
to NOR is 1, then output will be ‘0’. combination is 1 & 0.

www.maven-silicon.com 158
79

158
RS Latch
0 1 R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change

0
0

Even though, there is some change


In this case also, the outputs for this
input, the output is same as the
input combination is 1 & 0.
output in the past state

www.maven-silicon.com 159

159

RS Latch
1 0 R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change
1 0 0 1 Reset
1
0

Recollect the fact that, if one of the The outputs for this input
input to NOR is 1, then output will be ‘0’. combination is 0 & 1.

www.maven-silicon.com 160
80

160
RS Latch
0 0 R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change
1 0 0 1 Reset
1 0 0 0 1 No Change

Even though, there is some change


In this case also, the outputs for this
in the input, the output is same as
input combination is 0 & 1.
the output in the past state

www.maven-silicon.com 161

161

RS Latch
1 0 R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change
1 0 0 1 Reset
0 0 0 1 No Change
1
0 1 1 0 0 Invalid

Observe what happens if invalid Both the outputs of a latch should be


combination of i/p is followed by no complement to each other. But, in
change combination of input. this case, both the outputs are same.

www.maven-silicon.com 162
81

162
RS Latch
0 X R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change
1 0 0 1 Reset
X 0 0 0 1 No Change
1 1 0 0 Invalid
0
0 0 X X RACE
1. At the o/p terminals, both 1 & 0 will be
Q 1 0 1 0 1 racing with each other even though
there is no change in the i/p .
2. If invalid combination of i/p is
Q’ 1 0 1 0 1 followed by no change combination of
i/p, race around condition occurs.
www.maven-silicon.com 163

163

RS Latch
R S Q Q’ State
0 1 1 0 Set
0 0 1 0 No Change
1 0 0 1 Reset
0 0 0 1 No Change
1 1 0 0 Invalid
0 0 - - RACE

1. Since, the Set input is HIGH, output is SET.


2. Since, the Reset input is HIGH, output is RESET.
3. That’s why, RS Latch with NOR Gates is said to be Active HIGH Latch.

www.maven-silicon.com 164
82

164
RS Latch – NAND Gates
S’ R’ Q Q’ State
0 1 1 0 Set
1 1 1 0 No change
1 0 0 1 Reset
1 1 0 1 No change
0 0 1 1 Invalid
1 1 - - RACE

The only difference is RS Latch with NOR gates is active HIGH Latch
where as RS Latch with NAND gates is active LOW Latch.
In this case, (0 & 0) input combination is an invalid combination of input
and (1 & 1) input combination doesn’t bring any change in the output.
www.maven-silicon.com 165

165

Gated RS Latch
1
C S R S’ R’ Q Q’ State
0 X X 1 1 No Change
0
1 0 0 1 1 No Change
1 0 1 1 0 0 1 Reset
1 1 1 0 0 1 1 0 Set
1 1 1 0 0 - - Invalid

www.maven-silicon.com 166
83

166
Gated D Latch
C S R S’ R’ Q Q’ State
0 X X 1 1 No Change
1 0 0 1 1 No Change
1 0 1 1 0 0 1 Reset
1 1 0 0 1 1 0 Set
1 1 1 0 0 - - Invalid

C D Q Q’ State
0 X No Change
1 0 0 1 Reset
1 1 1 0 Set

www.maven-silicon.com 167

167

Gated D Latch

In Controlled RS Latch, RACE Condition will occur if both inputs


are 1.
In controlled RS Latch, if both the inputs are complement to each
other, the output follows the S input.
So, to avoid RACE conditions, both the inputs must be complement
to each other.
This is how D Latch is constructed.
Output Q follows the input D, said to be transparent Latch.

www.maven-silicon.com 168
84

168
Master Slave Configuration

www.maven-silicon.com 169

169

Master Slave Configuration

www.maven-silicon.com 170
85

170
Master Slave Configuration

The output at the final stage will be depending on the input


available at the instant of negative edge.
Master Slave configuration of two latches is treated as a flip flop.

www.maven-silicon.com 171

171

Construction of Flipflops
Negative Edge Sensitive flipflop is constructed by using HIGH
level latch as master and LOW level latch as slave.

Positive Edge Sensitive flipflop is constructed by using LOW level


latch as master and HIGH level latch as slave.

www.maven-silicon.com 172
86

172
SR Flip-flop
Truth Table
Clk S R Q+ State
X X Q No Change
0 0 Q No Change
0 1 0 Reset
1 0 1 Set
1 1 - Invalid

Wave forms Excitation Table


Q Q+ S R
0 0 0 X
0 1 1 0
1 0 0 1
1 1 X 0
www.maven-silicon.com 173

173

D Flip-flop
Truth Table
Clk D Q+ State
X Q No Change
0 0 Reset
1 1 Set

Wave forms Excitation Table


Q Q+ D
0 0 0
0 1 1
1 0 0
1 1 1
www.maven-silicon.com 174
87

174
JK Flip-flop
Truth Table
Clk J K Q+ State
X X Q No Change
0 0 Q No Change
0 1 0 Reset
1 0 1 Set
1 1 Q’ Toggle

Wave forms Excitation Table


Q Q+ J K
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
www.maven-silicon.com 175

175

T Flip-flop
Truth Table
Clk T Q+ State
X X No Change
0 Q No Change
1 Q` Toggle

Wave forms Excitation Table


Q Q+ T
0 0 0
0 1 1
1 0 1
1 1 0

www.maven-silicon.com 176
88

176
Symbols of flipflops
Positive Edge D flipflop Positive Edge RS flipflop

Negative Edge D flipflop Negative Edge RS flipflop

www.maven-silicon.com 177

177

Symbols of flipflops
Positive Edge JK flipflop Positive Edge T flipflop

Negative Edge JK flipflop Negative Edge T flipflop

www.maven-silicon.com 178
89

178
Timing Waveform
Draw the timing waveform for the below components, which receives same
Clk and D input signals.

CLK

QL

Qp

Qn

www.maven-silicon.com 179

179

Flipflops with Asynchronous inputs.


The inputs of the flipflops like R, S, D, J, K & T are called
synchronous inputs because, these inputs can bring a change in the
outputs of the flipflops only at the instant of posedge or negedge of
the clock.
So, we need to wait till the instant of posedge or negedge of the
clock to set or reset the flipflop.
Hence, flipflops are provided with a pair of asynchronous inputs
(preset & clear) to make the flipflop set or reset at any instant of
time without waiting for the active edge of the clock signal.

www.maven-silicon.com 180
90

180
Flipflops with Asynchronous inputs.
Flipflop with active HIGH Asynchronous Inputs.

Flipflop with active LOW Asynchronous Inputs.

www.maven-silicon.com 181

181

Active HIGH Asynchronous inputs.


When preset is HIGH, the flipflop will be driven into set state
without waiting for the posedge of the flipflop.
When clear is HIGH, the flipflop will be driven into reset state
without waiting for the posedge of the flipflop.
For normal operation both the asynchronous inputs must be
connected to ‘0’

www.maven-silicon.com 182
91

182
Synchronous Clear

www.maven-silicon.com 183

183

Delays in Sequential Circuits

www.maven-silicon.com 184
92

184
Delays in Sequential Circuits
D2Q Delay : change in input D alone cannot bring a change in the
output . So, D2Q delay is not valid.
Clk2Q Delay : Time taken by the flipflop to provide a stable output
after a clock edge occurs.
R2Q Delay : Time taken by flipflop to come to RESET state after
the application of asynchronous CLEAR input.
S2Q Delay : Time taken by flipflop to come to SET state after the
application of asynchronous PRESET input.

www.maven-silicon.com 185

185

Setup & Hold Times


Setup Time : is the minimum time interval for which the input signal
must be stable (unchanging) prior to the sampling event of the clock
for the input signal to be recognized correctly.
Hold Time : is the minimum time interval for which the input signal
must be stable (unchanging) following the sampling event of the
clock for the input signal to be recognized correctly.

www.maven-silicon.com 186
93

186
Setup & Hold Times
A hold time violation is when a input signal change too quickly, after
the clock's active transition
A setup time violation is when a signal arrives too late, and misses
the time when it should advance.
If the setup or hold time parameters are violated, the output would be
either logic0, logic1 or metastable state (output oscillates between 0
& 1).

Learn this in detail during


advanced course

www.maven-silicon.com 187

187

FF Conversions

Learn this during advanced


course

www.maven-silicon.com 188
94

188
Sequential Logic Circuits - II

www.maven-silicon.com 189

189

Agenda

Registers
Counters

www.maven-silicon.com 190
95

190
Registers

Group of many flipflops to store multiple bits of information is


called as “Register”.
Registers can be used to perform the following two different
functions.
Data storing
Data shifting

www.maven-silicon.com 191

191

Classification of Registers

Registers can be classified as follows.

Registers

Buffer Registers Shift Registers

Shift Registers are capable


Buffer Registers are capable
of storing the data & Shifting
of storing the data. In these
the data either in LEFT or
registers, the output will be
RIGHT directions.
same as the input at active
edges

www.maven-silicon.com 192
96

192
Functionality of a D flipflop

0 0 1 1

www.maven-silicon.com 193

193

Buffer Register

holds the 4-bit data

www.maven-silicon.com 194
97

194
Serial Shift Registers

Serial In Serial Out ( Right Shift ) Serial In Serial Out ( Left Shift )

Rotate Right Rotate Left

www.maven-silicon.com 195

195

Parallel Shift Registers

Serial In Parallel Out Parallel In Serial Out

Parallel In Parallel Out

www.maven-silicon.com 196
98

196
SISO Shift Registers

www.maven-silicon.com 197

197

SIPO Shift Registers

www.maven-silicon.com 198
99

198
PISO Shift Register

0 1 1
1

www.maven-silicon.com 199

199

PISO Shift Register

1 0 1

www.maven-silicon.com 200
100

200
PIPO Shift Register

www.maven-silicon.com 201

201

Bidirectional Shift Registers

www.maven-silicon.com 202
101

202
Bidirectional Shift Registers

www.maven-silicon.com 203

203

Counters
What is a counter ?
As the name suggests, it counts the no. of clock pulses.
This counting can be done in a
Sequential manner to count the no. of clock pulses.
Random manner to generate a specific sequence.

www.maven-silicon.com 204
102

204
Classification of Counters
Counters can be classified based on
Clock : Synchronous or Asynchronous
Clock Trigger : Posedge trigger or Negedge trigger.
Counts : Binary, Decade
Count Direction : UP, DOWN, UP-DOWN, RANDOM
Flipflops Used : JK or T or D.

www.maven-silicon.com 205

205

Concept of Frequency Division


The output of a +ve edge triggered T-flipflop
toggles at every +ve edge in the clock signal.
And remains constant during the period other
than the instant of +ve edge of the clock.

www.maven-silicon.com 206
103

206
Asynchronous counter
3 Bit Asyn Down Counter using +ve edge triggered FF

www.maven-silicon.com 207

207

Asynchronous counter
3-bit Asyn. up counter using Posedge triggered T-Flip Flop

www.maven-silicon.com 208
104

208
UP/DOWN Counter

www.maven-silicon.com 209

209

UP/DOWN Counter

www.maven-silicon.com 210
105

210
Asynchronous counter
3-bit Asyn. up counter using Negedge triggered T-Flip Flop

www.maven-silicon.com 211

211

Asynchronous counter
3-bit Asyn. down counter using Negedge triggered T-Flip Flop

www.maven-silicon.com 212
106

212
Synchronous UP Counter
UP Counting Sequence
Q2 Q1 Q0
Q0 toogles for every cycle.
0 0 0
0 0 1 And Q1 toggles only when Q0
0 1 0 is ‘1’
0 1 1
Q2 toggles only if (Q1 & Q0)
1 0 0
are ‘1’.
1 0 1
1 1 0 Important Point : T FF toggles
1 1 1 only when the T input is ‘1’
0 0 0
www.maven-silicon.com 213

213

Synchronous UP Counter
Q0 toggles for every cycle. So, T0 should be supplied with ‘1’.

Q1 toggles when Q0 is ‘1’ T1 should be supplied with Q0.

Q2 toggles only if (Q1 & Q0) ‘1’


T2 should be supplied with Q0 & Q1

www.maven-silicon.com 214
107

214
Synchronous UP Counter

www.maven-silicon.com 215

215

Synchronous DOWN Counter

www.maven-silicon.com 216
108

216
Modulus of a Counter

The number of unique states that a counter may have before the
sequence repeats itself is the modulus of the counter.
An UP counter with 3 flipflops counts from 0 to 7 and again repeats
from 0 after 7. So, the no. of states is 8 (i.e., 0 to 7).
So, a counter with ‘n’ no. of flipflops counts from 0 to 2n-1. So, the
Modulus of this counter is 2n.
The output frequency of the last FF of any counter will be the clock
frequency divided by the MOD of the counter.
A T flipflop with T input tied to Vcc acts as divide by 2 counter.

www.maven-silicon.com 217

217

Mod-16 Counter

www.maven-silicon.com 218
109

218
Frequency Division using Counters

Q0 Q1 Q2 Q3

Clk
Q0
Q1
Q2
Q3

www.maven-silicon.com 219

219

Advantages of Syn. Counters over Asyn. Counters.

The outputs of all the flipflops will change simultaneously.


A synchronous counter can operate at much higher frequency, but
the circuitry are more complex than that of the asynchronous
counter.

www.maven-silicon.com 220
110

220
Counter Design

Step 1: Derive the State Transition Diagram


Step 2: Draw State Transition Table
Step 3: Choose flip-flop type for implementation
Use Excitation Table to remap Next State Functions
Step 4: Obtain the expressions for input variables of the flipflops in
terms of the present state values.
You will learn during
Step 5: Minimize them using K-maps the advanced course

Step 6: Implement Resulting Logic with the minimised expressions.

www.maven-silicon.com 221

221

Counter Design
Design a counter that generates the sequence.
0,2,3,5,6,0,---.
Counter using different 000
ffs are shown here

110 010

101 011

www.maven-silicon.com 222
111

222
Comparison

T FFs well suited for straightforward binary counters


But yielded worst gate and literal count for this example

www.maven-silicon.com 223

223

Comparison

JK FFs yielded lowest gate count


Tend to yield best choice for packaged logic where gate
count is key

www.maven-silicon.com 224
112

224
Comparison

D FFs yield simplest design procedure


Best literal count
D storage devices very much transistor efficient in VLSI
Best choice where area/literal count is the key

www.maven-silicon.com 225

225

Shift Register Counter

We are aware of the fact that counters are used for producing a
special sequence of numbers.
Similarly, a shift register with the serial output connected back to
the serial input to produce special sequence.
Two of most common type of shift register counters are :
Ring counter
Johnson counter [ Shift Counter / twisted ring counters].

www.maven-silicon.com 226
113

226
Ring Counter

www.maven-silicon.com 227

227

Ring Counter

Cycle
Q0 Q1 Q2 Q3
Number Modulus of a ‘N’ bit ring
0 1 0 0 0 counter is ‘N’.
1 0 1 0 0
4 Cycles
2 0 0 1 0
3 0 0 0 1
4 1 0 0 0
5 0 1 0 0
4 Cycles
6 0 0 1 0
7 0 0 0 1 For every 4 clock cycles, this
counter goes into the same set
of states. So, modulus of a 4 bit
ring counter is 4.
www.maven-silicon.com 228
114

228
Twisted Ring Counter

www.maven-silicon.com 229

229

Twisted Ring Counter

Cycle
Q0 Q1 Q2 Q3 Q3‘
Number
0 1 0 0 0 1
1 1 1 0 0 1
For every 8 clock cycles, this
2 1 1 1 0 1 counter goes into the same
3 1 1 1 1 0 set of states. So, modulus of
4 0 1 1 1 0 a 4 bit Jhonson counter is 8.

5 0 0 1 1 0
6 0 0 0 1 0
7 0 0 0 0 1 So, modulus of a ‘N’ bit
8 1 0 0 0 1 Jhonson counter is ‘2N’.

www.maven-silicon.com 230
115

230
Finite State Machines

www.maven-silicon.com 231

231

Agenda

Finite State Machine


Mealy Machine
Moore Machine
Design Examples
Glitches and Hazards

www.maven-silicon.com 232
116

232
Finite State Machines

Systematic way of specifying any sequential logic


Ideally suited for complex sequential logic.
To specify the sequential circuits which are :
complex in their transition sequence &
depend on several control inputs
Different models in FSM are :
Mealy Model
Moore Model

www.maven-silicon.com 233

233

Mealy Machines

I/P

next
state
Comb. Logic Seq. Logic for Comb. Logic O/P
for next determining the for the
state I/P Clk state. Output

www.maven-silicon.com 234
117

234
Moore Machines

I/P

next
state
Comb. Logic Seq. Logic for Comb. Logic O/P
for next determining the for the
state I/P Clk state. Output

www.maven-silicon.com 235

235

Mealy Vs Moore
Mealy Moore
Output depends on both input & current Output depends only on current state of
state of the circuit. the circuit.

Next state is dependent on both input & Next state is dependent on both input &
current state. current state.

Outputs are Asynchronous. So, glitches Outputs are Synchronous. So, glitches can
can occur. never occur.

Less no. of states. Obviously, less no. of More no. of states. Obviously, more no. of
flipflops are sufficient for implementation. flipflops are required for implementation.

Not safe to use. Safe to use.

Area efficient. Not area efficient.

www.maven-silicon.com 236
118

236
Mealy FSM

Glitch free Outputs

May be having some


glitches

www.maven-silicon.com 237

237

Sequence Detector - FSM Example


Specification
Design a sequence detector that receives binary data stream at its
input, X and signals when a combination '110' arrives at the input by
making its output ,Z high which otherwise remains low.
Consider the first received bit is LSB

www.maven-silicon.com 238
119

238
Sequence Detector - Moore
State Meaning
S0 Initial state
S1 0
S2 10
S3 110

S0 S1 S2 S3

www.maven-silicon.com

239

Sequence Detector - Mealy

State Meaning
S0 Initial state
S1 0
S2 10

S0 S1 S2

www.maven-silicon.com
120

240
Sequence Detectors

Example
Lets consider a sequence recognizer which is capable of detecting
1001 Sequence.

Cycle Number 1 2 3 4 5 6 7 8 9 10 11 12

Input Sequence 0 1 0 0 1 0 0 1 1 0 0 1
O/P for overlapping
Seq. Detector
0 0 0 0 1 0 0 1 0 0 0 1
O/P of non overlapping
Seq. Detector
0 0 0 0 1 0 0 0 0 0 0 1

www.maven-silicon.com 241

241

Sequence Detector for 1001 Sequence


Overlapping Moore FSM

S0/0 S1/0 S2/0 S3/0 S4/1

State Meaning
S0 Initial state

S1 1

S2 01

S3 001

Non Overlapping Moore FSM S4 1001

S0/0 S1/0 S2/0 S3/0 S4/1

www.maven-silicon.com 242
121

242
Vending Machine - FSM Design
Specification
Design a vending machine which delivers a product when it
receives Rs.3/- and also it has to return the change if receives
Rs.4/- . The machine can take only two types of coins of
denomination 1 and 2 in any order.

Rst

P
Coin Vending
R
Machine

Clk www.maven-silicon.com 243

243

Vending Machine
State Meaning
S0 Initial state

S1 Re.1

S2 Rs.2

S3 Rs.3

S4 Rs.4
S0
P = 0, R=0

S1 S2 S4
P = 0, R=0 P = 0, R=0 P = 1, R=1

S3
P = 1, R=0
www.maven-silicon.com 244
122

244
Odd Parity Detector-FSM Design
Specification
Assert output whenever input bit stream has odd number of 1's.

EVEN
Z=0
Present Next State
I/P (X) O/P (Z)
State (Q) (Q+)
Even 0 Even 0
Even 1 Odd 0
ODD Odd
Odd 0 1
Z=1 Odd Even
1 1
www.maven-silicon.com 245

245

Odd Parity Detector-FSM Design


Specification
Assert output whenever input bit stream has odd number of 1's.
Present Next State
I/P (X) O/P (Z)
State (Q) (Q+)
Even 0 Even 0
Even 1 Odd 0
Odd 0 Odd 1
Odd 1 Even 1
State Encoding

Design a circuit from


FSM will be discussed in
advanced course

www.maven-silicon.com 246
123

246
Glitches & Hazards

www.maven-silicon.com 247

247

Glitches & Hazards

When the input to a combinational circuit changes, unwanted


switching transients (Glitches) may appear in the output.
These transients occur when different paths from input to output
have different propagation delays.
A hazard is said to exist when a circuit has the possibility of
producing such a glitch.

www.maven-silicon.com 248
124

248
Types of Hazards
Static 1 - Hazard
Possibility of a circuit's output producing a 0 glitch
when we would expect the output to remain at a
steady 1.
Static 0 - Hazard
Possibility of a circuit's output producing a 1 glitch
when we would expect the output to remain at a
steady 0.
Dynamic Hazard
Possibility of the output of a circuit changing more
number of times when it should change from (0 to
1) or (1 to 0).
www.maven-silicon.com 249

249

Elimination of Hazards
Technique 1
Adding delay to balance the delays in the parallel paths can
eliminate hazards since, unequal delays is the main cause of
these glitches.

www.maven-silicon.com 250
125

250
Elimination of Hazards
Technique 2
Adding the redundant gates can eliminate the hazards.

0 0 1 0
1 1 1 0
f = AB’ + BC + AC

www.maven-silicon.com 251

251

Elimination of Hazards
Technique 3
Adding the pipelining registers at the outputs the combinational
circuits.

www.maven-silicon.com 252
126

252
Memories

www.maven-silicon.com 253

253

Agenda

Classification of Memories
Basics of Memories
Composition of Memories

www.maven-silicon.com 254
127

254
Classification of Memories

www.maven-silicon.com 255

255

Classification of Memories
Optical memories like CD, DVD and magnetic memories like floppy, HDD
will come under other forms of memories.
Let’s concentrate more on semiconductor memories.
Sequential Access Memories : In these memories, data cannot be accessed
from random address locations. It can be accessed in a serial manner.
Random Access Memories : In these memories, data can be accessed from
random address locations.
FIFO & LIFO comes under sequential access memories.
Volatile Memories : In these memories, stored data will be lost, if there is a
loss in power supply.

www.maven-silicon.com 256
128

256
Classification of Memories
Non - Volatile Memories : In these memories, stored data will not be lost,
even if there is a loss in power supply.
SRAM & DRAM will come under volatile random access memories.
Synchronous DRAM : In these memories, the basic read & write will be
done in synchronism with a clock signal.
Asynchronous DRAM : In these memories, the basic read & write will not
be done in synchronism with a clock signal.
Single Data Rate: 1 Byte of data for each clock cycle, either at posedge or
negedge.
Double Data Rate : 2 Bytes of data for each clock cycle. One data at posedge
& second data at negedge.

www.maven-silicon.com 257

257

Classification of Memories
Double Data Rate – 2nd Gen : 4 Bytes of data for each clock cycle. two
bytes at posedge & two more bytes at negedge.
Double Data Rate – 3rd Gen : 8 Bytes of data for each clock cycle. four
bytes at posedge & four more bytes at negedge.
Double Data Rate – 4th Gen : 16 Bytes of data for each clock cycle. eight
bytes at posedge & eight more bytes at negedge.
In these days, DDR4 is the commonly used memory in LAPTOP’s & Servers.
ROM: Data stored in these memories is fixed at the time of fabricating the
memories and cannot be changed again.
No further write operation is possible. Only READ operation is possible.
Programmable ROM: These memory chips can be programmed only once.

www.maven-silicon.com 258
129

258
Classification of Memories
Erasable Programmable ROM : These memory chips can be programmed
for any no. of times & data will be erased by the application of UV light rays.
Data stored in these memories can be programmed by the user based on his
requirement. Both read & write are possible in these memories.
Electrically Erasable Programmable ROM. These memory chips can be
programmed for any no. of times & data will be erased by the application of
electrical signals.
Erasable Alterable Programmable ROM. These memories are special type
of EEPROMs and data can be written at the block level instead of byte level.
Can be programmed while in the circuit. USB drives, Memory cards & SSD’s
will come under this category.

www.maven-silicon.com 259

259

SRAM vs DRAM
Static RAM Dynamic RAM
Static RAM uses static devices like Dynamic RAM uses dynamic devices like
transistors & MOSFET’s to store the data. capacitors to store the data.

At least, 6 no. of transistors are required for One transistor & one capacitor are sufficient
implementing one bit memory cell. for implementing one bit memory.
Not area efficient. Occupies more area. Area efficient. Occupies less area.
No periodic refresh required. Periodic refresh required.
Less access time b/c of static devices. High access time b/c of usage of capacitors.
Standard IC fabrication process is sufficient Special IC fabrication process is required for
for fabricating these memories. fabricating these memories.

www.maven-silicon.com 260
130

260
Basic Concepts of Memories
8 bit information in each location
(word_size is 8 bits)
clk
rst 0 7 6 5 4 3 2 1 0

0
1
wr_enb 2

wr_addr 3
4 data_out
16
wr_data 8
8 12
13
rd_enb
14
15
rd_addr
4
16 * 8 Memory

www.maven-silicon.com 261

261

Composition of Memories
It is the process of creating large memory module using smaller
memory module.
The following are the different requirements.
We may need to construct a large memory with larger word
size (more bits per word) or
We may need to construct large memory with Wider
addressing space (more words) or
Both

www.maven-silicon.com 262
131

262
Memory with larger word size

Construct 256*24 RAM using 256*8 RAM


modules
24 bit wr_data

MSB LSB

24 bit data_out
www.maven-silicon.com 263

263

Memory with more words

Construct 256*8 RAM using 64*8 RAM modules

For constructing 256 * 8 Memory using 64 * 8 Memories, we


need 4 modules of 64 * 8 memories since 256/64 = 4.
The available 64 * 8 Memory will have 6 address lines.
But, the required memory should have 8 address lines.
The extra 2 lines can be used for selecting any of the 4 smaller
memory modules by using a decoder logic.
Recall the fact that, only one of the output line of a decoder will be
at HIGH level depending on the input available.

www.maven-silicon.com 264
132

264
Memory with more words

O to 63

64 to 127

O to 255
128 to 191

192 to 255
data_out
www.maven-silicon.com 265

265

FIFO
Used to pass data between two asynchronous clock domains.
Used to pass data between two systems working with same clock
but with different throughput.

www.maven-silicon.com 266
133

266
Cache Memory
Speed

HDD RAM CPU

Data Storage Capacity

HDD RAM CPU

www.maven-silicon.com 267

267

Cache Memory

CPU Contains Registers and Cache Memory So, that it can access
frequently accessed data at a faster speed instead of accessing from
slower memories like RAM & HDD.
CPU has only few MB of Cache. But, CPU makes a tremendous use of
this small memory because the speed of data access in cache is high
because it need not do periodic refresh unlike DRAM.
Cache uses SRAM Technology. So, Many no. of memory cells cannot
be fabricated in a small processor. So, cache memories will be in the
order of MB unlike DRAM which will be in the order of GB.
For a better performance, Use a processor with more Cache Memory.

www.maven-silicon.com 268
134

268
VLSI Design
Thank You [email protected]
+91 74067 30555

www.maven-silicon.com

269

135

You might also like