CprE 281: Digital Logic

Similar documents
CprE 281: Digital Logic

CprE 281: Digital Logic

CprE 281: Digital Logic

CprE 281: Digital Logic

CprE 281: Digital Logic

Logic Design. Flip Flops, Registers and Counters

Asynchronous (Ripple) Counters

Counter dan Register

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

CMSC 313 Preview Slides

ECE 341. Lecture # 2

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Digital Logic Design ENEE x. Lecture 19

Unit 11. Latches and Flip-Flops

Digital Fundamentals: A Systems Approach

RS flip-flop using NOR gate

LATCHES & FLIP-FLOP. Chapter 7

Lecture 8: Sequential Logic

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Counters

LSN 12 Shift Registers

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

ASYNCHRONOUS COUNTER CIRCUITS

MC9211 Computer Organization

Experiment 8 Introduction to Latches and Flip-Flops and registers

RS flip-flop using NOR gate

6. Sequential Logic Flip-Flops

1. Convert the decimal number to binary, octal, and hexadecimal.

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Digital Circuits ECS 371

Logic Design II (17.342) Spring Lecture Outline

Digital Fundamentals: A Systems Approach

CHAPTER 4: Logic Circuits

Other Flip-Flops. Lecture 27 1

Department of Electrical and Computer Engineering Mid-Term Examination Winter 2012

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1

ELCT201: DIGITAL LOGIC DESIGN

CHAPTER 4: Logic Circuits

EKT 121/4 ELEKTRONIK DIGIT 1

PRE J. Figure 25.1a J-K flip-flop with Asynchronous Preset and Clear inputs

Universal Asynchronous Receiver- Transmitter (UART)

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

UNIT IV. Sequential circuit

Flip-flop and Registers

ELE2120 Digital Circuits and Systems. Tutorial Note 7

Dr. Shahram Shirani COE2DI4 Midterm Test #2 Nov 19, 2008

cascading flip-flops for proper operation clock skew Hardware description languages and sequential logic

Digital Fundamentals

Flip-Flops and Sequential Circuit Design

Registers and Counters

D Latch (Transparent Latch)

Sri Vidya College of Engineering And Technology. Virudhunagar Department of Electrical and Electronics Engineering

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

CHAPTER1: Digital Logic Circuits

ELCT201: DIGITAL LOGIC DESIGN

ECE 545 Digital System Design with VHDL Lecture 2. Digital Logic Refresher Part B Sequential Logic Building Blocks

Review of digital electronics. Storage units Sequential circuits Counters Shifters

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

CSE140: Components and Design Techniques for Digital Systems. More D-Flip-Flops. Tajana Simunic Rosing. Sources: TSR, Katz, Boriello & Vahid

Chapter 2. Digital Circuits

MODULE 3. Combinational & Sequential logic

DIGITAL CIRCUIT COMBINATORIAL LOGIC

EEE2135 Digital Logic Design Chapter 6. Latches/Flip-Flops and Registers/Counters 서강대학교 전자공학과

1. True/False Questions (10 x 1p each = 10p) (a) I forgot to write down my name and student ID number.

CHAPTER 11 LATCHES AND FLIP-FLOPS

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

CHAPTER 1 LATCHES & FLIP-FLOPS

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Chapter 5: Synchronous Sequential Logic

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

Computer Organization & Architecture Lecture #5

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

Introduction to Sequential Circuits

Chapter. Synchronous Sequential Circuits

Introduction to Digital Logic Missouri S&T University CPE 2210 Flip-Flops

Digital Fundamentals. Lab 5 Latches & Flip-Flops CETT Name: Date:

Sequential Logic Counters and Registers

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Design and Simulation of a Digital CMOS Synchronous 4-bit Up-Counter with Set and Reset

Engr354: Digital Logic Circuits

IT T35 Digital system desigm y - ii /s - iii

Course Administration

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

COE 202: Digital Logic Design Sequential Circuits Part 1. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

Eng. Mohammed Samara. Fall The Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

Chapter 5 Synchronous Sequential Logic

A clock is a free-running signal with a cycle time. A clock may be either high or low, and alternates between the two states.

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Principles of Computer Architecture. Appendix A: Digital Logic

ECE 545 Digital System Design with VHDL Lecture 1B. Digital Logic Refresher Part B Sequential Logic Building Blocks

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science SOLUTIONS

Transcription:

CprE 28: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/

Registers and Counters CprE 28: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev

Administrative Stuff The second midterm is this Friday. Homework 8 is due today. Homework 9 is out. It is due on Mon Nov 6. No HW due next Monday

Midterm Exam #2 Administrative Stuff When: Friday October 27 @ 4pm. Where: This classroom What: Chapters, 2, 3, 4 and 5.-5.8 The exam will be open book and open notes (you can bring up to 3 pages of handwritten notes).

Registers

Register (Definition) An n-bit structure consisting of flip-flops

Parallel-Access Register

-Bit Parallel-Access Register Load In D Out

-Bit Parallel-Access Register Load In D Out The 2-to- multiplexer is used to select whether to load a new value into the D flip-flop or to retain the old value. The output of this circuit is the output of the flip-flop.

-Bit Parallel-Access Register Load In D Out If Load =, then retain the old value. If Load =, then load the new value from In.

2-Bit Parallel-Access Register Out_ Out_ Load D D In_ In_

2-Bit Parallel-Access Register Parallel Output Out_ Out_ Load D D In_ In_ Parallel Input

3-Bit Parallel-Access Register Out_2 Out_ Out_ Load D D D In_2 In_ In_ Notice that all flip-flops are on the same clock cycle.

3-Bit Parallel-Access Register Parallel Output Out_2 Out_ Out_ Load D D D In_2 In_ In_ Parallel Input

4-Bit Parallel-Access Register Out_3 Out_2 Out_ Out_ Load D D D D In_3 In_2 In_ In_

4-Bit Parallel-Access Register Parallel Output Out_3 Out_2 Out_ Out_ Load D D D D In_3 In_2 In_ In_ Parallel Input

Shift Register

A simple shift register In D 2 3 4 D D D Out [ Figure 5.7a from the textbook ]

A simple shift register In D 2 3 4 D D D Out Positive-edge-triggered D Flip-Flop

A simple shift register In D 2 3 4 D D D Out Master Slave D D m D s Clk Clk

A simple shift register In D 2 3 4 D D D Out D Flip-Flop Master Slave D D m D s Clk Clk Gated D-Latch Gated D-Latch

A simple shift register In D 2 3 4 D D D Out

A simple shift register In D 2 3 4 D D D Out In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In D 2 3 4 D D D Out In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In D 2 3 4 D D D Out In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In D 2 3 4 D D D Out In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In D 2 3 4 D D D Out In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk Master D Clk Slave D Clk

A simple shift register In D 2 3 4 D D D Out (a) Circuit t In 2 3 4 = Out t t 2 t 3 t 4 t 5 t 6 t 7 (b) A sample sequence [ Figure 5.7 from the textbook ]

Parallel-Access Shift Register

Parallel-access shift register [ Figure 5.8 from the textbook ]

Parallel-access shift register When Load=, this behaves like a shift register. [ Figure 5.8 from the textbook ]

Parallel-access shift register When Load=, this behaves like a parallel-access register. [ Figure 5.8 from the textbook ]

Shift Register With Parallel Load and Enable

A shift register with parallel load and enable control inputs [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs The directions of the input and output lines are switched relative to the previous slides. [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs Parallel Input Parallel Output [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs [ Figure 5.59 from the textbook ]

A shift register with parallel load and enable control inputs [ Figure 5.59 from the textbook ]

Multiplexer Tricks (select one of two 2-bit numbers)

Select Either A=A A or B=B B s A B F A B F

Select Either A=A A or B=B B s A B F = A A B F = A

Select Either A=A A or B=B B s A B F = B A B F = B

Multiplexer Tricks (select one of four 2-bit numbers)

Select A=A A or B=B B or C=C C or D=D D s s A B C F D A B C F D

Select A=A A or B=B B or C=C C or D=D D s s A B C F D = A A B C F D = A

Select A=A A or B=B B or C=C C or D=D D s s A B C F D = B A B C F D = B

Select A=A A or B=B B or C=C C or D=D D s s A B C F D = C A B C F D = C

Select A=A A or B=B B or C=C C or D=D D s s A B C F D = D A B C F D = D

Register File

Complete the following circuit diagram to implement a register file with four 2-bit registers, one write port, one read port, and one write enable line.

Register Register Register 2 Register 3

Register A Register B Register C Register D

A A Register A B B Register B C C Register C D D Register D

In In A A Register A B B Register B C C Register C D D Register D

In In A A Register A B B Register B C C Register C D D Register D Write_address_ Write_address_ Write_enable

In In A A Register A B B Register B C C Register C D D Register D Write_address_ Write_address_ Write_enable

In In A A Register A B B Register B C C Register C D D Register D Write_address_ Write_address_ Write_enable Out Out Read_address_ Read_address_

In In A A Register A B B Register B C C Register C D D Register D Write_address_ Write_address_ Write_enable Out Out Read_address_ Read_address_

In In A A B B C C D D Write_address_ Write_address_ Write_enable Out Out Read_address_ Read_address_

Another Register File

Register File Register file is a unit containing r registers r can be 4, 8, 6, 32, etc. Each register has n bits n can be 4, 8, 6, 32, etc. n defines the data path width Output ports (DATA and DATA2) are used for reading the register file Any register can be read from any of the ports Each port needs a log 2 r bits to specify the read address (RA and RA2) Input port (LD_DATA) is used for writing data to the register file Write address is also specified by log 2 r bits (WA) Writing is enabled by a -bit signal (WR) RA LD_DATA WR Reg File RA2 WA DATA DATA2

Register File: Exercise Suppose that a register file contains 32 registers width of data path is 6 bits (i.e., each register has 6 bits) How many bits are there for each of the signals? RA 5 RA2 5 DATA 6 DATA2 6 WA 5 LD_DATA 6 WR LD_DATA RA RA2 Reg File WR WA DATA DATA2

Register file design We will design an eight-register file with 4-bit wide registers A single 4-bit register and its abstraction are shown below LD D3 D2 D D D P 3 D P 2 D P D P LD D3 D2 D D 3 2 We have to use eight such registers to make an eight register file LD D3 D2 D D LD D3 D2 D D LD D3 D2 D D Clk 3 2 Clk 3 2 Clk 3 2 How many bits are required to specify a register address?

Reading Circuit A 3-bit register address, RA, specifies which register is to be read For each output port, we need one 8-to- 4-bit multiplier Register Address LD7 D3 D2 D D LD D3 D2 D D LD D3 D2 D D Clk 3 2 Clk 3 2 Clk 3 2 7 6 5 4 3 2 RA 8-to- 4-bit multiplex DATA 7 6 5 4 3 2 8-to- 4-bit multiplex RA2 DATA2

Adding write control to register file To write to any register, we need the register's address (WA) and a write register signal (WR) A 3-bit write address is decoded if write register signal is present One of the eight registers gets a LD signal from the decoder LD_DATA 3 to 8 D e c o d e r WA WR LD7 D3 D2 D D LD7 3 2 Clk LD2 LD LD LD D3 D2 D D Clk 3 2 LD D3 D2 D D 3 2 7 6 5 4 3 2 7 6 5 4 3 2 RA 8-to- 4-bit multiplex 8-to- 4-bit multiplex RA2 DATA DATA2 Clk

Register File (More Examples)

Register File [https://jindongpu.wordpress.com/22/3/7/register-file/]

[http://fourier.eng.hmc.edu/e85_old/lectures/digital_logic/node9.html]

[http://fourier.eng.hmc.edu/e85_old/lectures/digital_logic/node9.html]

[http://www.eecg.toronto.edu/~enright/teaching/ece243s/notes/l9-implemenation-single-cycle.html]

Counters

T Flip-Flop (circuit and graphical symbol) [ Figure 5.5a,c from the textbook ]

The output of the T Flip-Flop divides the frequency of the clock by 2

The output of the T Flip-Flop divides the frequency of the clock by 2

A three-bit down-counter [ Figure 5.2 from the textbook ]

A three-bit down-counter The first flip-flop changes on the positive edge of the clock [ Figure 5.2 from the textbook ]

A three-bit down-counter The first flip-flop changes on the positive edge of the clock The second flip-flop changes on the positive edge of [ Figure 5.2 from the textbook ]

A three-bit down-counter The first flip-flop changes on the positive edge of the clock The second flip-flop changes on the positive edge of The third flip-flop changes on the positive edge of [ Figure 5.2 from the textbook ]

A three-bit down-counter T T T 2 (a) Circuit 2 Count 7 6 5 4 3 2 (b) Timing diagram [ Figure 5.2 from the textbook ]

A three-bit down-counter T T T 2 (a) Circuit least significant most significant 2 Count 7 6 5 4 3 2 (b) Timing diagram

A three-bit down-counter T T T 2 (a) Circuit toggles on the positive clock edge 2 Count 7 6 5 4 3 2 (b) Timing diagram

A three-bit down-counter T T T 2 (a) Circuit toggles on the positive edge of 2 Count 7 6 5 4 3 2 (b) Timing diagram

A three-bit down-counter T T T 2 (a) Circuit 2 2 toggles on the positive edge of Count 7 6 5 4 3 2 (b) Timing diagram

A three-bit down-counter T T T 2 (a) Circuit The propagation delays get longer 2 Count 7 6 5 4 3 2 (b) Timing diagram

A three-bit up-counter [ Figure 5.9 from the textbook ]

A three-bit up-counter The first flip-flop changes on the positive edge of the clock [ Figure 5.9 from the textbook ]

A three-bit up-counter The first flip-flop changes on the positive edge of the clock The second flip-flop changes on the positive edge of [ Figure 5.9 from the textbook ]

A three-bit up-counter The first flip-flop changes on the positive edge of the clock The second flip-flop changes on the positive edge of The third flip-flop changes on the positive edge of [ Figure 5.9 from the textbook ]

A three-bit up-counter T T T 2 (a) Circuit 2 Count 2 3 4 5 6 7 (b) Timing diagram [ Figure 5.9 from the textbook ]

A three-bit up-counter T T T 2 (a) Circuit least significant most significant 2 Count 2 3 4 5 6 7 (b) Timing diagram [ Figure 5.9 from the textbook ]

A three-bit up-counter T T T 2 (a) Circuit The count is formed by the s 2 (b) Timing diagram [ Figure 5.9 from the textbook ]

A three-bit up-counter T T T 2 (a) Circuit The toggling is done by the s 2 (b) Timing diagram

A three-bit up-counter T T T 2 (a) Circuit toggles on the positive clock edge 2 (b) Timing diagram

A three-bit up-counter T T T 2 (a) Circuit toggles on the positive Edge of 2 (b) Timing diagram

A three-bit up-counter T T T 2 (a) Circuit 2 2 toggles on the positive edge of (b) Timing diagram

A three-bit up-counter T T T 2 (a) Circuit The propagation delays get longer 2 (b) Timing diagram

A three-bit up-counter T T T 2 (a) Circuit The propagation delays get longer 2 Count 2 3 4 5 6 7 (b) Timing diagram [ Figure 5.9 from the textbook ]

Synchronous Counters

A four-bit synchronous up-counter [ Figure 5.2 from the textbook ]

A four-bit synchronous up-counter The propagation delay through all AND gates combined must not exceed the clock period minus the setup time for the flip-flops [ Figure 5.2 from the textbook ]

A four-bit synchronous up-counter T T T 2 T 3 (a) Circuit 2 3 Count 2 3 4 5 6 7 8 9 2 3 4 5 (b) Timing diagram [ Figure 5.2 from the textbook ]

Derivation of the synchronous up-counter cycle 2 3 4 5 6 7 8 2 changes 2 changes [ Table 5. from the textbook ]

Derivation of the synchronous up-counter cycle 2 3 4 5 6 7 8 2 changes 2 changes T = T = T 2 = [ Table 5. from the textbook ]

A four-bit synchronous up-counter T = T = T 2 = [ Figure 5.2 from the textbook ]

In general we have T = T = T 2 = T 3 = 2 T n = 2 n-

Synchronous v.s. Asynchronous Clear

2-Bit Synchronous Up-Counter (without clear capability) T T

2-Bit Synchronous Up-Counter (with asynchronous clear) T T Clear_n

2-Bit Synchronous Up-Counter (with asynchronous clear) D D Clear_n This is the same circuit but uses D Flip-Flops.

2-Bit Synchronous Up-Counter (with synchronous clear) D D Clear_n This counter can be cleared only on the positive clock edge.

Adding Enable Capability

A four-bit synchronous up-counter [ Figure 5.2 from the textbook ]

Inclusion of Enable and Clear Capability Enable T T T T Clear_n [ Figure 5.22 from the textbook ]

Inclusion of Enable and Clear Capability This is the new thing relative to the previous figure, plus the clear_n line Enable T T T T Clear_n [ Figure 5.22 from the textbook ]

Providing an enable input for a D flip-flop [ Figure 5.56 from the textbook ]

Synchronous Counter (with D Flip-Flops)

A four-bit counter with D flip-flops [ Figure 5.23 from the textbook ]

Counters with Parallel Load

A 4-bit up-counter with D flip-flops [ Figure 5.23 from the textbook ]

A 4-bit up-counter with D flip-flops T flip-flop T flip-flop T flip-flop T flip-flop [ Figure 5.23 from the textbook ]

Equivalent to this circuit with T flip-flops Enable T T T T

Equivalent to this circuit with T flip-flops Z Enable T T T T But has one extra output called Z, which can be used to connect two 4-bit counters to make an 8-bit counter. When Z= the counter will go on the next clock edge, i.e., the outputs of all flip-flops are currently (maximum count value).

Counters with Parallel Load

A counter with parallel-load capability [ Figure 5.24 from the textbook ]

How to load the initial count value Set the initial count on the parallel load lines (in this case 5).

How to zero a counter Set "Load" to, to open the "" line of the multiplexers.

How to zero a counter When the next positive edge of the clock arrives, the outputs of the flip-flops are updated.

Reset Synchronization

Motivation An n-bit counter counts from,,, 2 n - For example a 3-bit counter counts up as follow,, 2, 3, 4, 5, 6, 7,,, 2, What if we want it to count like this,, 2, 3, 4, 5,,, 2, 3, 4, 5,,, In other words, what is the cycle is not a power of 2?

What does this circuit do? [ Figure 5.25a from the textbook ]

A modulo-6 counter with synchronous reset Enable D D D 2 Load 2 (a) Circuit 2 Count 2 3 4 5 (b) Timing diagram [ Figure 5.25 from the textbook ]

A modulo-6 counter with asynchronous reset T T T 2 (a) Circuit 2 Count 2 3 4 5 2 (b) Timing diagram [ Figure 5.26 from the textbook ]

A modulo-6 counter with asynchronous reset T T T 2 (a) Circuit The number 5 is displayed for a very short amount of time 2 Count 2 3 4 5 2 (b) Timing diagram [ Figure 5.26 from the textbook ]

uestions?

THE END