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

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

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

Sequential Circuits Sequential circuits combinational circuits state gate delay

Counters. We ll look at different kinds of counters and discuss how to build them

ECE 341. Lecture # 3

ELCT201: DIGITAL LOGIC DESIGN

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

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

ELCT201: DIGITAL LOGIC DESIGN

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Chapter 5 Synchronous Sequential Logic

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Philadelphia University Student Name: Student Number:

Sample Test Paper - I

Fundamentals of Digital Design

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Philadelphia University Student Name: Student Number:

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Chapter 7. Sequential Circuits Registers, Counters, RAM

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

CHW 261: Logic Design

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

PGT104 Digital Electronics. PGT104 Digital Electronics

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

Design of Sequential Circuits

Digital Circuits ECS 371

S.Y. Diploma : Sem. III [DE/ED/EI/EJ/EN/ET/EV/EX/IC/IE/IS/IU/MU] Principles of Digital Techniques

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Sequential Logic Circuits

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

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

PAST EXAM PAPER & MEMO N3 ABOUT THE QUESTION PAPERS:

課程名稱 : 數位邏輯設計 P-1/ /6/11

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Latches. October 13, 2003 Latches 1

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec 09 Counters Outline.

Synchronous Sequential Logic Part I. BME208 Logic Circuits Yalçın İŞLER

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec09 Counters Outline.

Lecture 10: Synchronous Sequential Circuits Design

Chapter 4. Sequential Logic Circuits

DIGITAL LOGIC CIRCUITS

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

Digital Electronics II Mike Brookes Please pick up: Notes from the front desk

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

課程名稱 : 數位邏輯設計 P-1/ /6/11

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Synchronous Sequential Logic

Digital Fundamentals

Synchronous Sequential Logic Part I

EECS150 - Digital Design Lecture 16 Counters. Announcements

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

EECS150 - Digital Design Lecture 23 - FSMs & Counters

Decoding A Counter. svbitec.wordpress.com 1

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

I. Motivation & Examples

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Stop Watch (System Controller Approach)

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

Sequential Logic Worksheet

Digital Logic Design - Chapter 4

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Design at the Register Transfer Level

Models for representing sequential circuits

CS221: Digital Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

EET 310 Flip-Flops 11/17/2011 1

Sequential vs. Combinational

Digital Fundamentals

WORKBOOK. Try Yourself Questions. Electrical Engineering Digital Electronics. Detailed Explanations of

Digital Electronics Final Examination. Part A

DE58/DC58 LOGIC DESIGN DEC 2014

Digital Electronic Meters

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6201 DIGITAL PRINCIPLES AND SYSTEM DESIGN

BER KELEY D AV IS IR VINE LOS AN GELES RIVERS IDE SAN D IEGO S AN FRANCISCO

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Gates and Flip-Flops

Logic Design II (17.342) Spring Lecture Outline

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

6 Synchronous State Machine Design

Chapter 7 Sequential Logic

Lecture 7: Logic design. Combinational logic circuits

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

Chapter 14 Sequential logic, Latches and Flip-Flops

Fundamentals of Boolean Algebra

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Menu. Excitation Tables (Bonus Slide) EEL3701 EEL3701. Registers, RALU, Asynch, Synch

Digital Electronics Circuits 2017

Transcription:

COE 202: Digital Logic Design Sequential Circuits Part 4 Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: 22-324

Objectives Registers Counters

Registers 0 1 n-1 A register is a group of flip-flops. An n-bit register is made of n flip-flips and can store n bits A register may have additional combinational gates to perform certain operations

4-Bit Register A simple 4-bit register can be made with 4 D-FF Data is loaded in parallel Common Clock At each positive-edge, 4 bits are loaded in parallel Previous data is overwritten Entering data is called loading Common Clear Asynchronous active-low clear When Clear = 0, all FFs are cleared; i.e. 0 is stored.

4-Bit Register (cont.) Question: How to modify this register to enable/disable loading new data (overwriting previous)?

4-Bit Register (cont.) Question: How to modify this register to enable/disable loading new data (overwriting previous)? Answer: When Load=0, the clock input to the FFs will never take a transition (0 to 1, 1 to 0), no new data will be loaded. When Load=1, normal data loading takes place This is called clock gating

4-Bit Register (cont.) Clock Skew Problem: It results from clock gating.

4-Bit Register (cont.) Better Solution: Register with Parallel Load Use a 2x1 MUX as shown: Q: Why a D- FF output is feedback?

4-Bit Register (cont.) A 4-bit Parallel Load Register When Load = 0, the data is not changed (no loading) When Load = 1, the data is loaded in parallel at the rising edge (+ve) load clock

Shift Registers 0 1 n-1 A shift register is a register which shifts its content (right, left, or both) Made of flip-flops with common clock Useful to load data serially

4-bit Shift Register A simple 4-bit shift register can be made with 4 D-FF Common Clock At each positive-edge, 1 bit is shifted in Rightmost bit is discarded Which direction this register is shifting?

Using Shift Register (Examples) Serial Addition

Shift Register with Parallel Load Two control inputs (shift, load) Each stage consists of D-FF OR gate Three AND gates AND to enable shift AND to enable load AND for no change Idea: Use a MUX to implement more functions (see next slides) Q i Qi D 0 D 1 D 2 D 3 Serial Input Q 0 Q i-1 Q i ; i=1,,3

Universal Shift Register Question: Design a Universal Shift Register with the following capabilities: A clear control to clear the register to 0 A clock to synchronize the operations A shift-right control (associated with serial in/out) A shift-left control (associated with serial in/out) A parallel-load control (to parallel load n bits) n-parallel output lines A control signal to leave register unchanged

Universal Shift Register (cont.)

Universal Shift Register (cont.) How does it work? 4 D-FF and 4 MUXs with selection S 0,S 1 S 0 S 1 =00, FF output is feedback to its input S 0 S 1 =01, FF input comes from left FF or serial-in (shift-right) S 0 S 1 =10, FF input comes from right FF or serial-in (shift-left) S 0 S 1 =11, parallel data transferred in Applications: Parallel Serial conversions Arithmetic multiplication/division Delaying input sequence

Counters Counter: A register (sequential circuit) that goes through a predetermined sequence of states upon the application of input (clock or other source) pulses Binary Counter: The sequence of the states follows the binary number sequence (e.g. 000 001 010 011 etc.) n-bit binary counter requires n flip-flops counts from 0 to 2 n -1 Sequences can be binary, BCD, random, etc. Counting can be up, down A modulo-n counter goes through values 0,1,2,, (n-1) e.g. modulo-10 up counter counts: 0,1, 9 Two Types of Counters: Ripple counter (asynchronous): Flip-flop output transition serves as source for triggering the other flip-flops Synchronous counter: common clock for all flip-flops (same design procedure)

Ripple Counters Instead of having a common clock signal to all Flip Flops, in a Ripple counter the output of one stage (Flip Flop) is connected to the clock input of the next stage T or JK flip flops are used for this construction because of their capability to flip their stored bits (J=K=T=1) Clock is connected to the least significant bit Flip flops are negative edge-triggered (clock is bubbled) are active when the clock signal is falling (high to low) Flip flops invert their stored bits, when the input clock signal goes from high (1) to low (0) clock pulses J K J K J K J C R C R C R C Q Q Q Q Q Q Q Q 0 Q 1 Q 2 Q 3 Logic 1 clear K R Q

Ripple Counters (cont.) Q 3 Q 2 Q 1 Q 0 0 0 0 0 clock pulses J K C R Q Q Q 0 0 0 0 1 0 0 1 0 0 0 1 1........ J K J C R C Q Q Q Q 1 Q 2 Q1: How to make it count down? Q2: What if we use positive-edge FF? Q3: What if we use Q instead of Q? Q4: Is this counter asynchronous? Why? Logic 1 clear K J K R C R Q Q Q Q 3

Ripple Counters with T-FF/D-FF Alternative implementation of a 4-bit ripple counter using T-FF and D-FF For a D-FF, connecting Q to D makes it to toggle at each clock! Src: Mano s Textbook

Ripple Counters Advantages: Simple hardware Disadvantages: Asynchronous delay dependent Good for low power circuits

Synchronous Counters Common clock to all FFs Design following the same design procedure for synchronous sequential circuits (see slides 4_3) Important: Study the examples in slides 4_3 Counters have a regular pattern Alternatively, counters can be designed without following the procedure (algorithmically, hierarchically)

4-bit Synchronous Binary Counter When EN = 0 No change When EN = 1 Least significant bit (A 0 ) toggles at every clock Other FFs toggle when all lower FFs are equal to 1 (e.g. 0011 0100) Question: What will happen if we use a negative edge triggered FF? Building Bigger Counter Clock En A 0 A 1 A 2 A 3 CO En A 0 A 1 A 2 A 3 CO CO

4-bit Synchronous Binary Counter with D-FF When En = 0, feed back same value When En = 1, increment the saved value at each clock Incrementer +1 A3 Y3 D3 Q3 A2 Y2 D2 Q2 A1 A0 Y1 Y0 D1 Q1 D0 Q0 symbol XORs act like an adder EN = 1 Q 3 Q 2 Q 1 Q 0 + 0001 EN = 0 Q 3 Q 2 Q 1 Q 0 + 0000 Tip: XOR + D-FF = T-FF

Binary Counter with Parallel Load Counter with parallel load: capability for transferring an initial binary number into the counter prior to the count operation Two control inputs: Load: enables loading an initial binary number Count: enables the counting Very useful to implement different counting sequences

Binary Counter with Parallel Load Load Count Action 0 0 Hold last count (No change) 0 1 Increment current count 1 X Parallel Load D0-D3 When Load = 1, D 0 D 1 D 2 D 3 is loaded When Count = 1 (and Load = 0) Current value is incremented When Load=Count=0 Feedback current value

BCD Counter Q: How can we convert the parallel load binary counter into a BCD counter?

BCD Counter Q: How can we convert the parallel load binary counter into a BCD counter?

3-to-12 Counter Q: How can we convert the parallel load binary counter into a 3-to-12 counter?

3-to-12 Counter Q: How can we convert the parallel load binary counter into a 3-to-12 counter? 1 1 0 0

9-to-69 Counter Problem: Use two binary counters with parallel load and logic gates to build a binary counter that counts from 9 to 69. Add an additional input to the counter that initializes it synchronously to 9 when the INIT is 1 Solution: clock Converting to Binary Binary 09 0000 1001 Binary 69 0100 0101 INIT 1 1 0 0 1 CTR 4 (1) Q0 Load Q1 En Q2 D0 Q3 D1 CO D2 D3 0 0 0 0 CTR 4 (2) Q4 Load Q5 En Q6 D0 Q7 D1 CO D2 D3 1001 0101 0000 0100

9-to-69 Counter (cont.) Notes about the Solution: The key word in the problem statement is BINARY Counter should count in binary from binary 9 through binary 69 and then back to binary 9 and so on Binary 09 0000 1001 Binary 69 0100 0101 Two counters providing 8 Qs are needed Least significant counter (LSC) Q3Q2Q1Q0 Most significant counter (MSC) Q7Q6Q5Q4 The counting sequence is as shown in table MSC increments only if LSC is equal to 1111; i.e the CO signal of LSC is 1 During count, LSC counts normally from 01001 all the way to 1111 and back to 0000, 0001, etc except when binary 69 is reached 1001 is reloaded again During count, MSC counts normally from 0000 all the way to 0100 and then it restarts from 0000 again. No Binary Q 7 Q 6 Q 5 Q 4 Q 3 Q 2 Q 1 Q 0 9 0000 1001 10 0000 1010 11 0000 1011 12 0000 1100.. 15 0000 1111 16 0001 0000 17 0001 0001 18 0001 0010 19 0001 0011 20 0001 0100 21 0001 0101.. 68 0100 0100 69 0100 0101 9 0000 1001 10 0000 1010..

Counter with Clear clear Q0 Q1 Q2 Q3 clear Q0 Q1 Q2 Q3 If synchronous Clear 0000 0101 If asynchronous Clear 0000 0100

Arbitrary Count Sequence Problem: Design a counter that has a repeated sequence of 6 states, as listed in table. In this sequence, flip-flops B and C repeat the binary count 00, 01, 10, while flip-flop A alternates between 0 and 1 every three counts. Notes: Only 6 states (Module-6) 011, 111 are missing Follow the usual design procedure Present State Next State A B C A B C 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 0 0

Arbitrary Count Sequence State Table Assuming JK flip-flops Present State Next State Flip-flop Inputs A B C A B C JA KA JB KB JC KC 0 0 0 0 0 1 0 X 0 X 1 X 0 0 1 0 1 0 0 X 1 X X 1 0 1 0 1 0 0 1 X X 1 0 X 1 0 0 1 0 1 X 0 0 X 1 X 1 0 1 1 1 0 X 0 1 X X 1 1 1 0 0 0 0 X 1 x 1 0 x

Arbitrary Count Sequence Input Equations BC A 00 01 11 10 0 0 0 x 1 1 x x x x BC A 00 01 11 10 0 0 1 x x 1 0 1 x x BC A 00 01 11 10 0 1 x x 0 1 1 x x 0 JA = B JB = C JC = B BC A 00 01 11 10 0 x x x x 1 0 0 x 1 KA = B BC A 00 01 11 10 0 x x x 1 1 x x x 1 KB = 1 BC 00 01 11 10 A 0 x 1 x x 1 x 1 x x KC = 1

Arbitrary Count Sequence Unused States JA = B JB = C JC = B KA = B KB = 1 KC = 1 000 111 J A C A 001 110 K A A 010 101 J B C B 100 011 K B B Logic 1 J C C K C C C 1) What if the counter finds itself in state 111 or state 011? Will the counter be able to proceed (count) normally afterward? How? clock 2) Is this circuit safe or reliable?

Summary Registers and Counters are versatile sequential circuits Registers Parallel Load Registers Shift Registers Universal Shift Registers Counters Ripple counters Synchronous counters