EC303 - Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

117
1 LOGIC DESIGN & COMPUTER ARCHITECTURE

description

-

Transcript of EC303 - Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Page 1: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

11

LOGIC DESIGN & COMPUTER ARCHITECTURE

LOGIC DESIGN & COMPUTER ARCHITECTURE

Page 2: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

222

LOGIC DESIGN & COMPUTER ARCHITECTURE

LOGIC DESIGN & COMPUTER ARCHITECTURE

Sub Topic 2.1: Computer Aided Design

Page 3: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Learning OutcomeAt the end of this presentation, you will be able to:

2.1.1 Define the primary approaches to IC chip designa. Mask-programmable ICsb. Standard-cell devicesc. Custom devicesd. PLD and VHDL

2.1.2 Explain Schematic logic design using CPLDa. Overview of Schematic Design Methodsb. Design Flow Summaryc. Generated Reports after compilation schematic.d. Simulation concept

3

Page 4: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

DESIGN METHODOLOGY TREE DIAGRAM

Page 5: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

STANDARD IC

Standard IC : • Integrated circuits designed and fabricated for

general purpose use.

• Standard IC is available in the market at a very low cost.

• Examples of standard ICs: 74 - SERIES TTL, 4000 - SERIES CMOS, OP-AMP, TIMER, INSTRUMENTATION AMPLIFIER, MEMORY, MICROCONTROLLER, etc.

Page 6: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

EXAMPLES OF STANDARD IC

74-series TTL

4000 series CMOS

Page 7: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Op-Amp Timer

Memory

Microcontroller

IC DESIGN METHODOLOGY

EXAMPLES OF STANDARD IC

Page 8: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

ASICs

• Progress in the fabrication of IC's has enabled the designer to create fast and powerful circuits in smaller and smaller devices.

• This also means that we can pack a lot more of functionality into the same area.

• The biggest application of this ability is found in the design of ASICs.

Page 9: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

ASICs

ASICs stands for : Application Specific Integrated Circuits

• ASICs are IC's that are created for specific purposes - each device is created to do a particular job.

• ASICs are produced for only one or a few customers or applications.

• ASICs are devices made for a specific application such as a mobile phone.

Page 10: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

EXAMPLES OF ASICs

IC DESIGN METHODOLOGY

Page 11: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYEXAMPLES OF ASICs

GRAPHIC MEDIA ACCELERATOR

GRAPHIC MEDIA ACCELERATOR

SMART CARD CHIPSSMART CARD CHIPS

Page 12: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

Page 13: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

FULL CUSTOM DESIGNAll the circuits and mask layouts are completely

designed for the requirements of a particular IC.

A microprocessor is an example of a full-custom design IC—designers spend many hours squeezing the most out of every last square micron of microprocessor chip space by hand.

Page 14: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

SEMI CUSTOM DESIGN

To make ASICs economic at lower volumes, the semi-custom concept was introduced where many applications share the same basic configuration of logic cells.

The mask layers are customized to fulfill the requirements of a particular IC.

Often used for speedy design with less effort compared to full custom design.

Page 15: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGY

SEMI CUSTOM DESIGN

There are 3 types of semi custom design:-

1. Gate array (mask-programmable ICs)

2. Standard Cell

3. Programmable Logic Device (PLD)

Page 16: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC

GATE ARRAY (mask –programmable ICs)

1. Gate arrays are integrated circuits containing large numbers of digital gates or transistor cells, which can be interconnected in different ways to implement various logic functions.

2. Gate array consists of transistors, usually arranged in two pairs of PMOS and NMOS.

3. ASIC vendors offer a selection of gate array cells, with a different total numbers of transistors on each cell, for example, gate arrays with 50k-, 75k-, and 100k-gates.

Page 17: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC

GATE ARRAY FLOOR PLAN

Page 18: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC – gate array

Gate array

Page 19: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC – gate array

Page 20: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC

STANDARD CELL

1. Standard cell design involves the use of pre-designed standard cell @ library cell that has been and stored in database.

2. Standard cell @ library cell consists of simple circuit such as inverter or logic gates (AND, OR, XOR, XNOR, flip-flop), and complex circuit such as register, adder, ROM and RAM.

Page 21: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

IC DESIGN METHODOLOGYSEMI CUSTOM IC

STANDARD CELL

3. Design is carried out by simply using the pre-designed cells from the library and then connect the cells so that certain functions can be implemented.

4. To facilitate placement and routing, the standard cells are designed to have equal height but variable widths, so that the final IC layout will have a regular pattern with rows of cells

and interconnect routing running between the rows.

3. Design is carried out by simply using the pre-designed cells from the library and then connect the cells so that certain functions can be implemented.

4. To facilitate placement and routing, the standard cells are designed to have equal height but variable widths, so that the final IC layout will have a regular pattern with rows of cells

and interconnect routing running between the rows.

Page 22: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

STANDARD CELL FLOOR PLAN

IC DESIGN METHODOLOGYSEMI CUSTOM IC

I/O Pads

LOGIC BLOCK

BLOCK

Standard Cell

Routing

Standard Cell

Routing

Standard Cell

Routing

Standard Cell

Routing

Page 23: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

PROGRAMMABLE LOGIC DEVICE (PLD)

PLD is an array of logic gates that can be programmed by the user which contains functions of a small number of logic circuits in a single chip.

IC DESIGN METHODOLOGYSEMI CUSTOM IC

Page 24: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

PROGRAMMABLE LOGIC DEVICE (PLD)

Page 25: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

PLD MANUFACTURERS

PROGRAMMABLE LOGIC DEVICE (PLD)

Page 26: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

PROGRAMMABLE LOGIC DEVICE (PLD)

GENERAL CHARACTERISTICS OF PLD IC

1. PLD does not require a common mask layout in design.

2. The design time is shorter.

3. It consists of a large block of internal connections that can be a programmed.

4. Programming can be done at different stages: i) at the earliest, it is programmed by the

semiconductor vendor (standard cell, gate array).

ii) by the designer prior to assembly or field deployment.

iii) by the user in circuit.

Page 27: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Programmable logic device as a black box.

Logic gates and

programmableswitches

Inputs

(logic variables) Outputs

(logic functions)

IC DESIGN METHODOLOGYPROGRAMMABLE LOGIC DEVICE

Page 28: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

DESIGN METHODOLOGY DIFFERENCES

Design method

Design cost Chip sizeOperation

speedPower

dissipationNo. of mask

Design time

Full custom

The most expensive

The smallest

Highest speed

5x Smaller

Numerous

Time-consumi

ng

Standard cell

Average Small High-speed3x

smallerMany Average

Gate array

Cheaper Large Slow2x

Smaller1@2 piece

Fast

PLDThe

CheapestLargest Slowest

1x Smaller

NoneThe

fastest

IC DESIGN METHODOLOGY

Page 29: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

PLD programming

• Schematic Entry• Text-Based Entry

Page 30: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

VHDL

• VHDL is the VHSIC Hardware Description Language.

• VHSIC is an abbreviation for Very High Speed Integrated Circuit

• a language to describe the structure and behaviour of digital electronic hardware designs, such as ASICs and FPGAs as well as conventional digital circuits.

Page 31: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

D Flip-flop Model

Bit values are enclosed in single quotes

Page 32: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Design Entry Techniques

• Schematic – Designer draws the equivalent design using gates and other logic circuits (can include IC’s such as JK FF or 74xxx parts)

• Waveform – Design draws the desired input and output waveforms for the device

• Text Design Files – Design specifies the design using a design language such as Altera Hardware Design Language (AHDL)

Page 33: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Example of Schematic Design

Page 34: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Example of Waveform Design

Page 35: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Learning OutcomeAt the end of this presentation, you will be able to:

2.2 Realize element logic in computer logic

2.2.1 Define clocking in terms of a digital computer. 2.2.2 Explain function clocks (wave form) in digital computer. 2.2.3 Explain gated flip-flop: a. SR flip-flop b. D flip-flop c. Master-slave flip-flop d. JK flip-flop 2.2.4 Use schematic CPLD to simulate digital output for above flip-flop. 

35

Page 36: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Element Logic in Computer Logic

Page 37: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

37

Introduction

• Latch is a type of temporary storage device that has two stable states (bistable).

• Latches and Flip-flops are used in sequential circuits.• Differences between sequential circuits and

combinational circuits.

Page 38: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

38

Introduction

• Latch is normally placed in a category separate from that flip – flops.

• The main difference between latch and FF is in the method used for changing their state.

• Term synchronous means that the output changes state only at a specified point on the triggering input called the clock (CLK).

Page 39: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Logic circuits are classified into two groups:

Combinational logic circuits

Sequential logic circuits

Basic buildingblocks include:

Basic building blocksinclude FLIP-FLOPS:

Element Logic in Computer Logic

Logic gates make decisions

Flip Flops have memory

Page 40: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

FLIP-FLOPS• Flip-flops are memory elements that change state on clock signals.

• Memory elements capable of storing one bit

• Flip Flops are wired to form counters, shift registers, and various memory devices.

command Memory element stored value

Q

clock

Page 41: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

41

Edge – Triggered Flip - Flops

• Change state either at the positive edge (rising edge) or at the negative edge (falling edge) of the clock pulse.

• Sensitive to its inputs only at this transition of the clock.

• Three types of edge triggered FF1. SR 2. D3. T4. JK

Page 42: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

42

Edge – Triggered Flip – FlopsLogic Symbols

Page 43: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

43

Positive edges Negative edges

Positive pulses

CLOCK SIGNAL The clock signal is generally a rectangular pulse train or square wave, as shown below :

• Circuits in computers are “clocked”• At each clock rising (or falling) edge, some specified actions are done,

usually within the next rising (or falling) edge

Page 44: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

TRIGGERING OF FLIP-FLOPS

• Level-triggering is the transfer of data from input to output of a flip-flop anytime the clock pulse is proper voltage level.

Page 45: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

45

SR FFLogic Symbols

Page 46: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

46

SR FFTruth Table

Inputs OutputsComments

S R CLK Q Q

0 0 X Qo Qo No change

0 1 0 1 RESET

1 0 1 0 SET

1 1 ? ? Invalid condition

= clock transition LOW to HIGH

X = Irrelevant (“don’t care”)

Qo = output level prior to clock transition

Page 47: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

47

SR FFExample

Page 48: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

48

D FF

• D flip – flop is useful when a single data bit (1 or 0) is to be stored.

• The addition of an inverter to an S – R flip flop creates a basic D flip – flop.

Page 49: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

49

D FFTruth Table

Inputs OutputsComments

S CLK Q Q

1 1 0 SET (stores a 1)

0 0 1 RESET (stores a 0)

= clock transition LOW to HIGH

Page 50: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

50

D FFExample

Page 51: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

51

• Versatile and is widely used type flip – flop.• The difference between J – K and S – R is that J – K flip – flop

has no invalid state as does S – R flip – flop.

JK FF

Page 52: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

52

• Transitions illustrating the toggle operation when J = 1 and K = 1.

JK FF

Page 53: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

53

JK FFTruth Table

Inputs OutputsComments

J K CLK Q Q

0 0 Qo Qo No change

0 1 0 1 RESET

1 0 1 0 SET

1 1 Qo Qo Toggle

= clock transition LOW to HIGH

Qo = output level prior to clock transition

Page 54: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

54

JK FFExample

Page 55: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

55

Asynchronous Preset and Clear Inputs

• Independent of the clock.• Active level on the preset input will set the flip – flop.• Active level on the clear input will reset it.

Note : for synchronous operation, both preset and clear inputs must

both kept HIGH.

Page 56: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

56

Asynchronous Preset and Clear InputsLogic Diagram

Page 57: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

57

Asynchronous Preset and Clear InputsExample

Page 58: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

58

Master – Slave Flip – Flops

• Data are entered into the flip flop at the leading edge of the clock pulses, but the output does not reflect the input state until the trailing edge.

• Pulse – triggered master – slave flip – flop does not allow data to change while the clock pulse is active.

Page 59: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

59

Pulse – Triggered Master – Slave Flip – Flops

Master Slave JK Flip-flop

Page 60: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

60

• Composed of two sections, the master section and the slave section.

• A master section is basically a gated latch.• The slave section is the same except that it is clocked on the

inverted clock pulse and is controlled by the outputs of the master section rather than by the external J – K inputs.

Pulse – Triggered Master – Slave Flip – Flops

Page 61: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

61

Pulse – Triggered Master – Slave Flip – Flops – Truth Table

Inputs OutputsComments

J K CLK Q Q

0 0 Qo Qo No change

0 1 0 1 RESET

1 0 1 0 SET

0 1 Qo Qo Toggle

= clock transition LOW to HIGH

Qo = output level prior to clock transition

Page 62: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

62

Pulse – Triggered Master – Slave Flip – Flops – Logic Symbol

Page 63: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

Learning OutcomeAt the end of this presentation, you will be able to:

2.3 Realize flip-flop application

2.3.1 Explain Shift Register operation. 2.3.2 Design Shift Register using flip-flop JK. 2.3.3 Determine kinds of binary counter 2.3.4 Explain binary counter operation using: a. Flip-flop SR b. Flip-flop JK 2.3.5 Design a sequence counter (3 bit) 2.3.6 Design sequential magnitude comparator 2.3.7 Design BCD to seven segment decoder

63

Page 64: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

64

Flip-Flop Applications• Applications of Flip-Flop:-

– Counters• Asynchronous Counter

• Synchronous Counter

– Register

Page 65: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

65

Shift Register Shift registers are constructed using several flip-

flop, connected in such a way to STORE and TRANSFER digital data.

Basically, D flip-flop is used. The input data (either ‘0’ or ‘1’) is applied to the D terminal and the data will be stored at Q during positive/negative-edge transition of the clock pulse.

D Q

Q

1 1

positive edge transition of CLK

Page 66: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

66

One D FF is used to store 1-bit of data. Thus, the number of flip-flops used is the same with the number of bit stored.

Shift register mean that the data in each FF can be transferred/move to other FF upon edge triggering of the clock signal.

Four types of data movement in shift register are:-

Parallel in / parallel out (PIPO)

Serial in / serial out (SISO)

Parallel in / serial out (PISO)

Serial in / parallel out (SIPO)

Shift Register

Page 67: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

67

Serial Data VS Parallel Data movement

Serial Parallel

•Movement of N-bit data require N number of CLK pulses. Thus, the operation is slow.

•Only one FF is required to be connected at the output terminal, thus only one wire is required.

•Require only one CLK pulse to transfer all N-bit of data. Thus, operation is faster than serial.

•Required N number of connection to the output terminal, which is proportional to the number of bit. Thus, too many connection is required.

Shift Register

Page 68: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

68

Parallel in / parallel out (PIPO) Flip-flop configuration for PIPO register.

D Q2

CP

D Q1

CP

D Q3

CP

D Q0

CP

CLK

D3 D2 D1 D0

Q3 Q2 Q1 Q0

Page 69: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

69

PIPO data movement.

Q3

Q2

CLK

Q1

Q0

1 0 1 1 1

0

0

0

0

1 0 10 0

0

0

1 1 1 1

0 0 1 0

D3

D2

D1

D0

1

0

1

0

0

1

1

0

Parallel in / parallel out (PIPO)

Page 70: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

70

Serial in / serial out (SISO) Flip-flop connection for SISO.

D Q1

FF1

CP

D Q2

FF2

CP

D Q0

FF0

CP

D Q3

FF3

CPCLK

DIN

1st CLK 2nd CLK 3rd CLK 4th CLK

Page 71: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

71

SISO data movement. Binary data 10111 is transferred!

DATA-IN

Q0

Q1

1st

CLK

2nd 3rd 4th 5th

Q2

Q3

Serial in / serial out (SISO)

1 0 1 1 1

Page 72: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

72

Flip-flop connection for SIPO.

D Q1

FF1

CP

D Q2

FF2

CP

D Q0

FF0

CP

D Q3

FF3

CPCLK

DIN

1st CLK 2nd CLK 3rd CLK 4th CLK

Serial in / parallel out (SIPO)

Q0 Q1 Q2 Q3

Page 73: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

73

SIPO data movement. Binary data 10111 is transferred!

DATA-IN

Q0

Q1

1st

CLK

2nd 3rd 4th 5th

Q2

Q3

Serial in / parallel out (SIPO)

1 0 1 1 1

1

1

0

1

Page 74: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

74

Flip-flop connection for PISO.

Parallel in / serial out (PISO)

D Q1

FF1

CP

D Q2

FF2

CP

D Q0

FF0

CP

D Q3

FF3

CPCLK

D0 D1 D2 D3SHIFT/LOAD

Serial data out

Page 75: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

75

PISO data movement.

SHIFT/LOAD

CLK

Q3

0

0 1 1 1

1 0 1

0

0

0

1

1 1 1 1

0 0 1 1

D0

D1

D2

D3

1 0

Parallel in / serial out (PISO)

0 1 0 1

Page 76: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

76

A shift register counter is a shift register whose output being fed back (connected back) to the serial input. This shift register would count the state in a unique sequence!

Two types of shift register counter:-

The ring counter

The Johnson counter

Shift Register Counters

Page 77: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

77

Ring Counter

Q3 Q2 Q1 Q0

Page 78: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

78

Ring Counter (continue)

0 0 0 1

1 0 0 0

0 1 0 0

0 0 1 0

Page 79: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

79

Ring Counter (continue)

Page 80: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

80

Ring Counter (continue)

Ring counters are used to construct “One-Hot” countersIt can be constructed for any

desired MOD numberA MOD-N ring counter uses N flip-flops connected in the

arrangement as shown in fig. a)In general ring-counter will

require more flip-flops than a binary counter for the same

MOD number

Page 81: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

81

Ring Counter (continue)

Page 82: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

82

Johnson Counter Or Twisted-ring counter

Johnson counter constructed exactly like a normal ring counter except that the inverted output of the last flip-flop is fed back to

first flip-flop

Page 83: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

83

Johnson Counter (Continue)

A

B

C

0 1 1 1

0 0 1 1

0 0 0 1

Page 84: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

84

Johnson Counter (Continue)

Page 85: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

85

Chips for shift registers

• 74164 is a 8-bit SIPO shift register

74164

CLK

CLR

AB

Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7

Page 86: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

86

Chips for shift registers

• 74165 is a 8-bit PISO register

74165

CLK

CLK INH

SH/LDSER

D0 D1 D2 D3 D4 D5 D6 D7

Q7

Q7

Page 87: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

87

Chips for shift registers

• 74195 can be used as a 4-bit PIPO register

74195

CLK

SH/LD

JK

Q0 Q1 Q2 Q3

CLR

D0 D1 D2 D3

Page 88: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

88

Chips for shift registers

• 74194 is a 4-bit universal bidirectional shift register

74194

CLK

SR SER

CLRS0

S1

Q0 Q1 Q2 Q3

SL SER

D0 D1 D2 D3

Page 89: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

89

Counters• A counter is a register that goes through a

predetermined sequence of states upon the application of clock pulses.– Asynchronous counters – Synchronous counters

• Async. counters (or ripple counters)– the clock signal (CLK) is only used to clock the first FF.

– Each FF (except the first FF) is clocked by the preceding FF.

• Sync. counters, – the clock signal (CLK) is applied to all FF, which means that all

FF shares the same clock signal,

– thus the output will change at the same time.

Page 90: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

90

Flip-Flop Applications• Applications of Flip-Flop:-

– Counters• Asynchronous Counter

• Synchronous Counter

Page 91: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

91

Asynchronous counters• Modulus (MOD) – the number of states it counts

in a complete cycle before it goes back to the initial state.

• Thus, the number of flip-flops used depends on the MOD of the counter (ie; MOD-4 use 2 FF (2-bit), MOD-8 use 3 FF (3-bit), etc..)

• Example: MOD-4 ripple/asynchronous up-counter.

Page 92: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

92

Asynchronous Counters (continue)

• The asynchronous counter that counts 4 number starts from 00011011 and back to 00 is called MOD-4 ripple (asynchronous) up-counter.

• Next state table and state diagram Present State Next State

Q1Q0 Q1Q0

00 01

01 10

10 11

11 00

00

01

10

11

Page 93: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

93

• MOD-4 Asynchronous up-counter

J Q

K Q

CLK

1 J Q

K Q

CLK

1

Q0 (LSB) Q1 (MSB)

CLKQ1 0 0 1 1 0 0 1 1 0

Q0 0 1 0 1 0 1 0 1 0

Binary 0 1 2 3 0 1 2 3 0

Asynchronous Counters (continue)

CLK

Page 94: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

94

• MOD-8 Asynchronous up-counter

J Q

K Q

CLK

1 J Q

K Q

CLK

1 J Q

K Q

CLK

1

C B A

A 0

B 0

C 0

CLK

Asynchronous Counters (continue)

Page 95: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

95

• Next state table and state diagramPresent

StateNext State

ABC ABC000 001001 010010 011011 100100 101101 110110 111111 000

0

1

2

3

7

6

5

4

Asynchronous Counters (continue)

Page 96: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

96

• Exercise:– Design a MOD-16 ripple up-counter

– Design a MOD-4 ripple down-counter

– Design a MOD-8 ripple down counter

– Design a MOD-16 ripple down counter

Asynchronous Counters (continue)

Page 97: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

97

• 2-bit Asynchronous down counter

J Q

K Q

CLK

1 J Q

K Q

CLK

1

B (LSB) A (MSB)

CLKB 0 1 0 1 0 1 0 1 0

A 0 1 1 0 0 1 1 0 0

Binary 0 3 2 1 0 3 2 1 0

Asynchronous Counters (continue)

CLK

Page 98: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

98

• So far, we have design the counters with MOD number equal to 2N, where N is the number of bit (N = 1,2,3,4….) (also correspond to number of FF)

• Thus, the counters are limited on for counting MOD-2, MOD4, MOD-8, MOD-16 etc..

• The question is how to design a MOD-5, MOD-6, MOD-7, MOD-9 which is not a MOD-2N (MOD 2N) ?

• MOD-6 counters will count from 010 (0002) to 510(1012) and after that will recount back to 010 (0002) continuously.

Asynchronous Counters (continue)

Page 99: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

99

Asynchronous Counters• MOD-6 ripple up-counter (MOD 2N)Present

St.Next St.

ABC ABC000 001001 010010 011011 100100 101101 000(110)

01

23

5

4

Reset the state to 0002 when 1102 is detected

Page 100: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

100

Asynchronous Counters (continue)

• Circuit diagram for MOD-6 ripple up-counter (MOD 2N)

J Q

K CLR

Q

CLK

1 1 1

C B A

J Q

K CLR

Q

CLK

J Q

K CLR

Q

CLK

Detect the output atABC=110 to activate

CLR. NAND gate is used to detect outputs that generates ‘1’!

CLK

Page 101: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

101

Chip for Asynchronous counters

• 74293 IC for Asynchronous counter with Reset (MR1 and MR2) MR1

MR2Q0Q1Q2Q3

CP0

CP174293

J Q

K

CLR Q

CLK

1 1 1

Q0 Q1 Q2

J Q

K

CLR Q

CLK

J Q

K CLR

QCLK

1 J Q

K

CLR Q

CLK

Q3

MR1MR2

CP0

CP1

Page 102: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

102

Chip for Asynchronous counters (continue)

• Using 74293 IC to design MOD 16 asynchronous up-counter!

• Exercise: – use 74293 IC to design MOD-10 ripple up-counter

MR1

MR2

Q0Q1Q2Q3

CP0

CP174293

1 0 1 0

Page 103: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

103

Chip for Asynchronous counters (continue)

• Exercise:

– Determine the MOD for each configuration shown below?

MR1

MR2

Q0Q1Q2Q3

CP0

CP174293

MR1

MR2

Q0Q1Q2Q3

CP0

CP174293

1 0 1

Page 104: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

104

Chip for Asynchronous counters (continue)

• Determine the MOD for each configuration shown below? MR1

MR2

Q0Q1Q2Q3

CP0

CP174293

Page 105: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

105

Asynchronous counters• Disadvantages of Asynchronous Counters:-

– Propagation delay is severe for larger MOD of counters, especially at the MSB.

– Existence of ‘glitch’ is inevitable for MOD 2N counters.

– Difficult to design random counters (i.e:- to design circuit that counts numbers in these sequence 56723156723156….)

• Solution, use SYNCHRONOUS COUNTERS.

Page 106: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

106

Synchronous counters• For synchronous counters, all the flip-flops are using the

same CLOCK signal. Thus, the output would change synchronously.

• Procedure to design synchronous counter are as follows:-STEP 1: Obtain the State Diagram. STEP 2: Obtain the Excitation Table using state

transition table for any particular FF (JK or D). Determine number of FF used.

STEP 3: Obtain and simplify the function of each FF input using K-Map.

STEP 4: Draw the circuit.

Page 107: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

107

Synchronous counters• Design a MOD-4 synchronous up-counter, using JK FF.

STEP 1: Obtain the State transition Diagram

0

1

2

3

00

01

10

11Binary

Page 108: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

108

Synchronous countersSTEP 2: Obtain the Excitation table. Two JK FF are

used.

Present State Next State

A B A B JA KA JB KB

0 0 0 1 0 X 1 X

0 1 1 0 1 X X 1

1 0 1 1 X 0 1 X

1 1 0 0 X 1 X 1

OUTPUT TRANSITIONQN QN+1

FF INPUTJ K

0 0 0 X0 1 1 X1 0 X 11 1 X 0Excitation table

Page 109: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

109

Synchronous countersSTEP 3: Obtain the simplified function using K-Map

BA 0 1

0 0 1

1 X X

JA = B

BA 0 1

0 X X

1 0 1

KA = B

BA 0 1

0 1 X

1 1 X

JB = 1

BA 0 1

0 X 1

1 X 1

KB = 1

Page 110: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

110

Synchronous countersSTEP 4: Draw the circuit diagram

JB Q

KB Q

CLK

1JA Q

KA Q

CLK

B (LSB) A (MSB)

Page 111: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

111

Synchronous counters• Exercise:-

– Design MOD-4 sync up-counter using D flip-flop.

– Design MOD-8 sync up-counter using D flip-flop.

– Design MOD-8 sync up-counter. Use T FF for MSB, D FF for second bit and JK FF for LSB.

– Design MOD-16 sync up-counter using T flip-flop.

Page 112: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

112

Synchronous counters• Design a MOD-4 synchronous down-counter, using JK

FF?

STEP 1: Obtain the State transition Diagram

0

3

2

1

00

11

10

01Binary

Page 113: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

113

Synchronous counters– Obtain the Excitation table. Two JK FF are used.

Present St.

Next St.

A B A B JA KA JB KB

0 0

0 1

1 0

1 1

OUTPUT TRANSITIONQN QN+1

FF INPUTJ K

0 0 0 X0 1 1 X1 0 X 11 1 X 0

Page 114: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

114

Synchronous counters– Obtain the simplified function using K-Map

BA 0 1

0

1

JA =

BA 0 1

0

1

KA =

BA 0 1

0

1

JB =

BA 0 1

0

1

KB =

Page 115: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

115

Synchronous counters– Draw the circuit diagram

JB Q

KB Q

CLK

JA Q

KA Q

CLK

B

A

Page 116: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

116

Synchronous counters• Exercise:-

– Design MOD-4 sync down-counter using D flip-flop.

– Design MOD-8 sync down-counter using D flip-flop.

– Design MOD-8 sync down-counter. Use T FF for MSB, D FF for second bit and JK FF for LSB.

– Design MOD-16 sync down-counter using T flip-flop.

Page 117: EC303 -  Chapter 2 LOGIC DESIGN & COMPUTER ARCHITECTUR

117

Chip for synchronous counter 74163

74163

CLR

LOADENTENPCLK

D0 D1 D2 D3

Q0 Q1 Q2 Q3

RCO