Page 1 Registers and Counters. Page 2 What is a Register?  A Register is a collection of n flip-flops with some common function or characteristic  Control.

Slides:



Advertisements
Similar presentations
COUNTERS Counters with Inputs Kinds of Counters Asynchronous vs
Advertisements

ECE C03 Lecture 81 Lecture 8 Memory Elements and Clocking Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Digital Logic Chapter 5 Presented by Prof Tim Johnson
EE2420 – Digital Logic Summer II 2013
1 Sequential Circuits Dr. Pang. 2 Outline Introduction to sequential circuits Basic latch Gated SR latch and gated D latch D flip-flop, T flip-flop, JK.
Dr. ClincyLecture1 Appendix A – Part 2: Logic Circuits Current State or output of the device is affected by the previous states Circuit Flip Flops New.
Sequential Logic Case Studies
Homework Reading Machine Projects Labs Tokheim Chapter 9.1 – 9.6
Contemporary Logic Design Sequential Case Studies © R.H. Katz Transparency No Chapter #7: Sequential Logic Case Studies 7.1, 7.2 Counters.
Contemporary Logic Design Sequential Case Studies © R.H. Katz Transparency No Chapter #7: Sequential Logic Case Studies 7.4 Counters.
11/16/2004EE 42 fall 2004 lecture 331 Lecture #33: Some example circuits Last lecture: –Edge triggers –Registers This lecture: –Example circuits –shift.
Logic and Computer Design Fundamentals Registers and Counters
11/15/2004EE 42 fall 2004 lecture 321 Lecture #32 Registers, counters etc. Last lecture: –Digital circuits with feedback –Clocks –Flip-Flops This Lecture:
ECE C03 Lecture 101 Lecture 10 Registers, Counters and Shifters Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
ECE C03 Lecture 91 Lecture 9 Registers, Counters and Shifters Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Introduction Flip-flops are synchronous bistable devices. The term synchronous means the output changes state only when the clock input is triggered. That.
A.Abhari CPS2131 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers:
Sequential Circuit  It is a type of logic circuit whose output depends not only on the present value of its input signals but on the past history of its.
Counters and Registers
Lecture 21 Overview Counters Sequential logic design.
EKT 124 / 3 DIGITAL ELEKTRONIC 1
A State Element “Zoo”.
Chapter 1_4 Part II Counters
1 Sequential Circuits Registers and Counters. 2 Master Slave Flip Flops.
1 Flip Flops, Registers Today: Latches, Flip FlipsFirst Hour: Types of Latches, Flip Flips –Section of Katz’s Textbook –In-class Activity #1.
EE345: Introduction to Microcontrollers Register and Counters Prof. Ahmad Abu-El-Haija.
Registers and Counters
EE24C Digital Electronics Projects
10-1 Introduction Chapter #7: Sequential Logic Case Studies.
Registers & Counters M. Önder Efe
1 Registers and Counters A register consists of a group of flip-flops and gates that affect their transition. An n-bit register consists of n-bit flip-flops.
Rabie A. Ramadan Lecture 3
No. 7-1 Chapter #7: Sequential Logic Case Studies.
Chap 4. Sequential Circuits
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines (FSM) Sequential circuits  primitive sequential.
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
2017/4/24 CHAPTER 6 Counters Chapter 5 (Sections )
Princess Sumaya Univ. Computer Engineering Dept. Chapter 6:
7-6 단일 레지스터에서 Microoperation Multiplexer-Based Transfer  Register 가 서로 다른 시간에 둘 이상의 source 에서 data 를 받을 경우 If (K1=1) then (R0 ←R1) else if (K2=1) then.
1 Registers & Counters Logic and Digital System Design - CS 303 Erkay Savaş Sabancı University.
ENG241 Digital Design Week #8 Registers and Counters.
Registers and Counters Chapter 6. Digital Circuits 2 Clocked sequential circuits a group of flip-flops and combinational gates connected to form a feedback.
Chap 5. Registers and Counters. Chap Definition of Register and Counter l a clocked sequential circuit o consist of a group of flip-flops & combinational.
Asynchronous vs. Synchronous Counters Ripple Counters Deceptively attractive alternative to synchronous design style State transitions are not sharp! Can.
Topic: Sequential Circuit Course: Logic Design Slide no. 1 Chapter #6: Sequential Logic Design.
Registers Page 1. Page 2 What is a Register?  A Register is a collection of flip-flops with some common function or characteristic  Control signals.
Sequential logic circuits
EKT 124 / 3 DIGITAL ELEKTRONIC 1
Registers and Counters
EE121 John Wakerly Lecture #9
Learning to Design Counters
Flip Flops, Registers Today: First Hour: Types of Latches, Flip Flips
Chap 5. Registers and Counters
REGISTER TRANSFER LANGUAGE (RTL) INTRODUCTION TO REGISTER Registers1.
1 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers: parallel and.
1 Homework Reading –Tokheim Chapter 9.1 – 9.6 Machine Projects –Continue on mp3 Labs –Continue in labs with your assigned section.
Sequential logic circuits First Class 1Dr. AMMAR ABDUL-HAMED KHADER.
Sequential Logic Design
Digital Design: Sequential Logic Blocks
Dr. Clincy Professor of CS
Homework Reading Machine Projects Labs Tokheim Chapter 9.1 – 9.6
Chapter #6: Sequential Logic Design
Registers and Counters
Prof. Hsien-Hsin Sean Lee
ECE Digital logic Lecture 16: Synchronous Sequential Logic
Registers and Counters Register : A Group of Flip-Flops. N-Bit Register has N flip-flops. Each flip-flop stores 1-Bit Information. So N-Bit Register Stores.
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
Registers and Counters
CSE 370 – Winter Sequential Logic-2 - 1
Registers and Counters
Presentation transcript:

Page 1 Registers and Counters

Page 2 What is a Register?  A Register is a collection of n flip-flops with some common function or characteristic  Control signals - common clock, clear, load, etc.  Function - part of multi-bit storage, counter, or shift register  At a minimum, we must be able to:  Observe the stored binary value  Change the stored binary value

Page 3 What is a Register?

Page 4 What is a Register? n bit output n bit input Clear Clock A Load Load input controls the transfer of data(input) to A. Load is controlled either by the clock or FF inputs.

Page 5 Parallel Load Register with clock gating Load is controlled by clock input-may cause ‘clock skew’: Clock arrives at different times to different FF’s C=Load’+Clock

Page 6 Kinds of Registers Storage Register Group of storage elements read/written as a unit 4-bit register constructed from 4 D FFs Shared clock and clear lines TTL Quad D-type FF with Clear (Small numbers represent pin #s on package) Schematic Shape V+ D3 D2 D1 D0 CLR CLK Q3 Q3F Q2 Q2F Q1 Q1F Q0 Q0F D Q C Q D Q C Q D Q C Q D Q C Q

Page 7 Kinds of Registers and Counters Input/Output Variations Selective Load Capability Tri-state or Open Collector Outputs True and Complementary Outputs Octal D-type FFs with input enable Octal D-type FFs with output enable EN enabled low and lo-to-hi clock transition to load new data into register OE asserted low presents FF state to output pins; otherwise high impedence D3 D6 Q5 Q2 377 Q1 Q0 Q3 EN CLK Q6 Q4 Q7 D5 D2 D1 D0 D4 D

Page 8 FF input controlled load:This Register will not cause a clock skew

Page 9 Register Files  A Register File is a collection of m registers, like a very small memory.  All CPU’s have register files of varying sizes  A typical one is: 32 registers of 32 bits each  Consider a small, 4 register file  Each register is specified by a 2 bit code.  An input might be loaded to a register with a given code(select)  An output might be picked up from a register with a given code

Page 10 Register Files  a 4-register file: 2x4 decoder Register Select Load R1 R2 R3 R4 n-bit input n-bit output Read/Write EN

Page 11 Kinds of Registers Register Files Two dimensional array of flip-flops Address used as index to a particular word Word contents read or written x4 Register File with Tri-state Outputs Separate Read and Write Enables Separate Read and Write Address Data Input, Q Outputs Contains 16 D-ffs, organized as four rows (words) of four elements (bits)

Page 12 Microoperations  Registers and transfers may be represented by standard symbols  A microoperation: an operation on registers or in other parts of a computer performed in one clock cycle.  Transfer, Arithmetic-Logic, Shift microoperations

Page 13 Data Transfer  Information is moved from register to register by:  Parallel data transfer  Serial data transfer  For example:  Older printers use parallel data transfer  USB devices use serial data transfer

Page 14 Parallel Data Transfer Parallel data transfer moves data from one register to another at one time clock Reg. AReg. B When clock occurs, all bits of A are copied to B

Page 15 Register Transfer Microperations  R1 R2 means: Transfer the contents of Register R2 to register R1 at the edge of the clock in parallel.  We might also have: K1: R1 R2 which means: The transfer occurs only when the control condition T1 is 1.

Page 16 Register Transfer Microperations Register transfer- one to one

Page 17 Register Transfer- 2 to one: K1: R0 R1 K1’K2: R0 R2 Assume K1 and K2 never becomes 1 at the same time We maY extend the idea to many to one

Page 18

Page 19 Arithmetic Microoperations

Page 20 Implementation of add-subtract Microoperations: X’.K1: R1 R1+ R2 X.K1: R1 R1+R2’ +1

Page 21 Logic Microoperations

Page 22 Logic Microoperations Uses of Logic microoperations  Usually used to change the desired bits of a register  Use a ‘mask’ as the contents of the second operand for the logic operation  AND: masks and clears, OR: sets, XOR: complements desired bits(remember 1 EXOR X=X’, 0 EXOR X= X

Page 23 Logic Microoperations Examples:  R1: R2: (mask register) R1 AND R2 : (clears left bits)  R1 OR R2: (sets right bits)  R1 EXOR R2: (left bits complemented)

Page 24 Shift Microoperations

Page 25 Shift Registers Storage + ability to circulate data among storage elements Shift from left storage element to right neighbor on every lo-to-hi transition on shift signal Wrap around from rightmost element to leftmost element Q1Q1 Q2Q2 Q3Q3 Q4Q4 Q Q Q Q Shift

Page 26 Serial Data Transfer Serial transfer moves data bits from A to B one bit per clock Rx and Tx have single wire between the two. For ‘n’ bit registers, it takes ‘n’ clocks for data move Reg. R2 1 bit signal Usual implementation is with a shift register. Reg. R1 clock

Page 27 Serial Data Transfer  Typical serial transfer is a multi-step process  Load transmit shift register with data to send  Shift data bit by bit from transmit to receive SR  Transfer received data to other registers  The transmit SR must have parallel load  AKA parallel to serial shift register  The receive SR must have parallel outputs  AKA serial to parallel shift register  Other control/timing signals usually needed

Page 28 Serial Data Transfer Reg. A (P to S) 1 bit signal (serial data) Reg. B (S to P) clock Parallel Transmit Data Parallel Receive Data ‘n’ bits load

Page 29 Serial Data Transfer  Serial data transfer used where data rate is relatively slow and/or parallel bit transfer channels are expensive  PC serial port and USB interfaces  wireless/fiber optic data transmissions  Cell phones  Wireless networks  Satellite telephone/TV  Mars rover/orbiter communications

Page 30 Typical Multi-Function Shift Register Shift Register I/O Serial vs. Parallel Inputs Serial vs. Parallel Outputs Shift Direction: Left vs. Right bit Universal Shift Register Serial Inputs: LSI, RSI Parallel Inputs: D, C, B, A Parallel Outputs: QD, QC, QB, QA Clear Signal Positive Edge Triggered Devices S1,S0 determine the shift function S1 = 1, S0 = 1: Load on rising clk edge synchronous load S1 = 1, S0 = 0: shift left on rising clk edge LSI replaces element D S1 = 0, S0 = 1: shift right on rising clk edge RSI replaces element A S1 = 0, S0 = 0: hold state Multiplexing logic on input to each FF! Shifters well suited for serial-to-parallel conversions, such as terminal to computer communications S1 S0 LSI A B C D RSI CLK CLR QA QB QC QD

Page 31 Shift Register with Parallel Load Right shift only

Page 32 Shift Register with Parallel Load

Page 33 Serial Transfer with Shift Registers Shift Register Application: Parallel to Serial Conversion Parallel Inputs Serial transmission Parallel Outputs

Page 34 Counters Proceed through a well-defined sequence of states in response to the count signal. 3 Bit Up-counter: 000, 001, 010, 011, 100, 101, 110, 111, 000,... 3 Bit Down-counter: 111, 110, 101, 100, 011, 010, 001, 000, 111,... The count sequence can be Binary or BCD or Gray Code or any other sequence you want. Usually there will be a set of control inputs (enable, load, reset) in addition to the clock. The basic counter is a sequential circuit where the state (the count value) is the output. The basic counter is a sequential circuit where the state (the count value) is the output. The counter circuit may have no other input other than the clock. This is known as an autonomous sequential circuit.

Page 35 Counters A common 4-bit counter Synchronous 4-Bit Upcounter Synchronous Load and Clear Inputs Positive Edge Triggered FFs Parallel Load Data from D, C, B, A P, T Enable Inputs: both must be asserted to enable counting RCO: asserted when counter enters its highest state 1111, used for cascading counters "Ripple Carry Output" 74161: similar in function, asynchronous load and reset

Page 36 Counters Ring Counter V+ J CLK K S R Q Q +V 0 1 Shift Q 1 Q 2 Q 3 Q 4 \Reset J K S R Q Q J K S R Q Q J K S R Q Q CLK Shift Q1 Q2 Q3 Q End-Around 4 possible states, single bit change per state, useful for avoiding glitches Must be initialized

Page 37 Counters Twisted Ring (Johnson, Mobius) Counter Inverted End-Around 8 possible states, single bit change per state, useful for avoiding glitches +V

Page 38 Counter Design : Synchronous Counters Introduction The process is a special case of the general sequential circuit design procedure. no decisions on state assignment or transitions current state is the output Example:3-bit Binary Upcounter Decide to implement with Toggle Flipflops What inputs must be presented to the T FFs to get them to change to the desired state bit? We need to use the T FF excitation table to translate the present/next state values to FF inputs Present state Next state

Page 39 Self-Starting Counters Start-Up States At power-up, counter may be in any possible state Designer must guarantee that it (eventually) enters a valid state Especially a problem for counters that validly use a subset of states Self-Starting Solution: Design counter so that even the invalid states eventually transition to valid state Two Self-Starting State Transition Diagrams S0S4 S3S1 S2 S6 S5S7 S0S4 S3S1 S2 S5 S6S7

Page 40 Implementation with Different Kinds of FFs  D FFs are easiest to use for implementation; no translation is needed from state transitions to FF inputs  FF next state value IS the FF input value  T, SR, JK FFs need an extra step in the design procedure  We start with the transition; pairs of present state, next state values  What we need to find is what FF input values are needed that result in the defined transitions  This information is the FF EXCITATION TABLE  Derived from the FF characteristic table  Defines inputs needed for all four possible PS/NS combinations

Page 41 Implementation with Different Kinds of FFs Derivation of JK Excitation Table J J K K Q(t) Q(t+) Q(t) 0 1 Q(t+) JK Characteristic Table Excitation Table Look for rows in the characteristic table that have the same Q(t), Q(t+) values; observe what the J,K inputs are for those cases

Page 42 Implementation with Different Kinds of FFs J J K K Q(t) Q(t+) Q(t) 0 1 Q(t+) JK Characteristic Table Excitation Table For the two 0,0 cases, J is constant 0, K is 0 in one case, 1 in the other. Therefore for the 0,0 transition, J must be 0, K is a don’t care. Derivation of JK Excitation Table

Page 43 Implementation with Different Kinds of FFs J J K K Q(t) Q(t+) Q(t) 0 1 Q(t+) J0J0 KXKX Characteristic Table Excitation Table Derivation of JK Excitation Table The necessary J,K values are then entered in the excitation table

Page 44 Implementation with Different Kinds of FFs Derivation of JK Excitation Table J J K K Q(t) Q(t+) Q(t) 0 1 Q(t+) J01XXJ01XX KXX10KXX10 Characteristic Table Excitation Table

Page 45 Implementation with Different Kinds of FFs Exication tables for D, T, SR, JK flip-flops Q(t) 0 1 Q(t+) D0101D0101 T0110T0110 Excitation Tables J01XXJ01XX KXX10KXX10 S010XS010X RX010RX010

Page 46 Implementation with Different Kinds of FFs Translation from State Transition to FF Inputs The determination of the FF input values now becomes: 1. For each present state/next state transition value pair 2. Look up the FF inputs needed in the excitation table 3. Enter the values in the FF input true table Qa 0 1 Qb Qc Qa Qb Qc We’ll use a T FF for Qa, an SR FF for Qb, and a JK FF for QC Ta 0 1 Sb 0 1 Jc 0 1 Kc 0 1 Rb 0 1

Page 47 Implementation with Different Kinds of FFs Q(t) 0 1 Q(t+) D0101D0101 T0110T0110 J01XXJ01XX KXX10KXX10 S010XS010X RX010RX010 Qa 0 1 Qb Qc Qa Qb Qc Ta Sb 0 1 X 0 1 X 0 Jc 1 X 1 X 1 X 1 X Kc X 1 X 1 X 1 X 1 Rb X 0 1 X 0 1 FF Inputs for T, SR, JK FFs 3 bit binary counter

Page 48 Implementation with Different FF Types Comparison T FFs well suited for straightforward binary counters But yielded worst gate and literal count for this example! No reason to choose R-S over J-K FFs: it is a proper subset of J-K R-S FFs don't really exist anyway J-K FFs yielded lowest gate count Tend to yield best choice for packaged logic where gate count is key D FFs yield simplest design procedure Best literal count D storage devices very transistor efficient in VLSI Best choice where area/literal count is the key

Page 49 4 bit syncronous binary counter

Page 50 Up-down counter with parallel load

Page 51 Asynchronous vs. Synchronous Counters Ripple Counters: Asynchronous Deceptively attractive alternative to synchronous design style Count signal ripples from left to right State transitions are not sharp! Can lead to "spiked outputs" from combinational logic decoding the counter's state Can lead to "spiked outputs" from combinational logic decoding the counter's state

Page 52 Ripple Counters (Up or Down)  Three characteristics determine if a ripple counter counts up or down  FF clock input polarity  FF output to clock polarity  Counter output polarity  A ripple counter with negative clock polarity, Q to next FF clock, and Q counter outputs counts UP  Change an odd number of characteristics and the counter counts DOWN

Page 53 Cascaded Counters Cascaded Synchronous Counters with Ripple Carry Outputs First stage RCO enables second stage for counting RCO asserted soon after stage enters state 1111 also a function of the T Enable Downstream stages lag in their 1111 to 0000 transitions Affects Count period and decoding logic

Page 54 Other Counter Sequences The Power of Synchronous Clear and Load Starting Offset Counters: e.g., 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 0110,... Use RCO signal to trigger Load of a new state Since Load is synchronous, state changes only on the next rising clock edge 0110 is the state to be loaded D C B A L O A D C L R C L K R C O PT Q A Q B Q C Q D Load D C B A 01 ++

Page 55 Other Counter Sequences Offset Counters Continued Ending Offset Counter: e.g., 0000, 0001, 0010,..., 1100, 1101, 0000 Decode state to determine when to reset to 0000 Clear signal takes effect on the rising count edge Replace '163 with '161, Counter with Async Clear Clear takes effect immediately!