Chapter 7 Registers & Register Transfers J. J. Shann J.J. Shann
Chapter Overview 7- Registers and Load Enable 7-2 Register Transfers 7-3 Register Transfer Operations 7-4 A Note for VHDL and Verilog Users Only 7-5 Microoperations 7-6 Microoperatrions on a Single Register 7-7 Register Cell Design 7-8 Multiplexer and Bus-Based Transfer for Multiple Registers 7-9 Serial Transfer and Microoperations 7- HDL Representation for Shift Registes and Counters VHDL 7- HDL Representation for Shift Registes and Counters Verilog 7-2 Chapter Summary J.J. Shann 7-2
Part I: Registers and Counters 7- Registers and Load Enable 7-6 Microoperatrions on a Single Register (Shift registers, Ripple counter, Synchronous binary counters, other counters) Part II: Register Transfers 7-2 Register Transfers 7-3 Register Transfer Operations 7-5 Microoperations 7-7 Register Cell Design 7-6 Microoperatrions on a Single Register (Multiplexer-Based Transfers) 7-8 Multiplexer and Bus-Based Transfer for Multiple Registers 7-9 Serial Transfer and Microoperations 7-2 Chapter Summary J.J. Shann 7-3
Part I Registers and Counters J.J. Shann
Clocked seq ckt: sync seq ckt consists of a group of flip-flops and combinational gates connected to form a feedback path. Flip-flops + Combinational gates (essential) (optional) Register: consists of a group of flip-flops capable of storing binary information and gates that determine how the information is transferred into the register. Counter: is essentially a register that goes through a predetermined sequence of states. J.J. Shann 7-5
Lecture Contents A. Simplest register ( 7-) B. Register with parallel load ( 7-) C. Shift registers ( 7-6) D. Ripple counter ( 7-6) E. Synchronous binary counters ( 7-6) F. Other counters ( 7-6) J.J. Shann 7-6
A. Simplest Register ( 7-) Simplest register: consists of only flip-flops w/o any gates. E.g.: a 4-bit register with asynchronous clear input J.J. Shann 7-7
B. Register w/ Parallel Load ( 7-) Load Approach : Load control input through the C inputs of the f-fs clock gating Approach 2: Load control input through the D inputs of the f-fs J.J. Shann 7-8
Approach : Load control input through the C inputs of the f-fs clock gating prevent the clock from reaching the clock input to the ckt if the contents of the reg are to be left unchanged C inputs = Load + Clock * Inserting gates in the clock pulse path produces different propagation delays b/t clock and the inputs of f-fs w/ and w/o clock gating. clock skew J.J. Shann 7-9
Approach 2: Load control input through the D inputs of the f-fs D i = Load I i + Load i (Load) E.g.: 4-bit register w/ parallel load J.J. Shann 7-
C. Shift Registers ( 7-6) Shift register: a register capable of shifting its binary information in one or both direction Simplest shift register: unidirectional J.J. Shann 7-
Shift Register w/ Parallel Load Shift register w/ parallel load: Functional table: D i = Shift Load i + Shift Load Ii + Shift i Clock J.J. Shann 7-2
E.g.: 4-bit shift register w/ parallel load D i = Shift Load + Shift Load + Shift i i I i J.J. Shann 7-3
Bidirectional Shift Register Bidirectional shift register direction = shl = shr direction SI of shr SO of shl CLK i + i i D i = direction A i+ + direction A i SO of shr SI of shl J.J. Shann 7-4
Bidirectional Shift Reg w/ Parallel Load Bidirectional shift register w/ parallel load: Mode control Register S S operation No change Shift down Shift up Parallel load J.J. Shann 7-5
D. Ripple Counters ( 7-6) Counter: a register that goes through a prescribed sequence of states upon the application of input pulses: Input pulses: may be clock pulses or originate from some external source Timing: may occur at regular or irregular intervals of time The sequence of states: may follow the binary number sequence ( Binary counter) or any other sequence of states J.J. Shann 7-6
Categories of counters:. Ripple counters: The flip-flop output transition serves as a source for triggering other flip-flops. The C input of some or all flip-flops are triggered not by the common clock pulses. (not synchronous) 2. Synchronous counters: (E) The C inputs of all flip-flops receive the common clock. * T or JK flip-flops J.J. Shann 7-7
Binary Ripple Counter Binary count-up counter: E.g.: 4-bit binary count-up ripple counter J.J. Shann 7-8
Observations: FF : C = Clock pulse D = FF : C = ( ) ( ) D = FF 2 : FF 3 : C 2 = ( ) ( ) D 2 = 2 C 3 = 2 ( ) 2 ( ) D 3 = 3 2 3 J.J. Shann 7-9
2 3 J.J. Shann 7-2
* Problem of ripple counter: Accumulation of propagation delay E.g.: 2-bit binary count-up ripple counter CP 2 2 3 3 J.J. Shann 7-2
Binary count-down counter: E.g.: 4-bit binary count-down ripple counter Downward Counting Sequence * Modify the figure in p.7-9: Connect the true output of each f-f to the C input of the next f-f. J.J. Shann 7-22
Summary: are asynchronous ckts Adv.: simple hardware Disadv.: become ckt w/ delay dependence and unreliable op large ripple counters can be slow ckts the length of time required for the ripple to finish J.J. Shann 7-23
E. Synchronous Counters ( 7-6) Sync counter: A common clock triggers all flip-flops simultaneously. Symbol: Design procedure: We can apply the same procedure of sync seq ckts. Sync counter is simpler than general sync seq ckts. No need to go through a sync seq logic design process. J.J. Shann 7-24
Example E.g.: 4-bit sync count-up binary counter w/ count enable line Approach : design procedure of sync seq ckt (Ch6) Present state Nest state EN = EN = Output CO D EN = + EN = EN D = ( EN) D2 = 2 ( EN) D3 = 3 ( 2 EN) CO = 3 2 CO: is used to extend the counter to more stages J.J. Shann 7-25
J.J. Shann 7-26 Approach 2: observation ) ( EN D = ) ( 2 2 EN D = ) ( 2 3 3 EN D = 2 3 CO = EN EN D = + = EN
Approach 3: an incrementer (Ch5) + D f-fs D 3 D 2 D D = 3 2 + EN Incrementer D = EN D = ( EN ) D2 = 2 ( EN) D3 = 3 ( 2 EN) CO = 3 2 J.J. Shann 7-27
Alternative Designs for Binary Counters Two alternative designs for binary counters: Serial counter: serial gating (p.7-27) Parallel counter: parallel gating lookahead * analogous to the ripple carry adder C C 2 * analogous to the carry lookahead adder ripple C 3 J.J. Shann 7-28
Binary Counter by Using JK Flip-Flops E.g.: 4-bit count-up binary counter w/ JK f-fs Binary count sequence: 3-bit A 2 A A J.J. Shann 7-29
A 2 A A J = K = EN J = K = EN A J 2 = K 2 = EN A A J 3 = K 3 = EN A 2 A A J.J. Shann 7-3
Up-Down Binary Counter Up-down binary counter: E.g.: 4-bit up-down binary counter J.J. Shann 7-3
Up-ward counting: (p.7-24) Down-ward counting: D = EN D ) D = EN = ( EN D ) = ( EN D2 = 2 ( EN) D3 = 3 ( 2 EN) D2 = 2 ( EN) D3 = 3 ( 2 EN) J.J. Shann 7-32
J.J. Shann 7-33 EN D = ) ) (( EN S S D + = ) ) (( 2 2 EN S S D + = ) ) (( 2 2 3 3 EN S S D + = S = up-counting down-counting EN D = ) ( EN D = ) ( 2 2 EN D = ) ( 2 3 3 EN D = EN D = ) ( EN D = ) ( 2 2 EN D = ) ( 2 3 3 EN D = Up-ward counting: Down-ward counting: Up-down counter:
Binary Counter w/ Parallel Load E.g.: 4-bit count-up binary counter w/ parallel load Function table: Load Count 3+ 2+ + + 3 2 3 2 + I 3 I 2 I I J.J. Shann 7-34
E.g.: 4-bit count-up binary counter w/ parallel load D = EN D = ( EN) D2 = 2 ( EN) D3 = 3 ( 2 EN) w/o parallel load J.J. Shann 7-35
E.g.: 4-bit count-up binary counter w/ parallel load D () w/o parallel load J.J. Shann 7-36
Generating Other Count Sequences Generate any count sequence: E.g.: design a BCD counter by using a counter w/ parallel load & async clear J.J. Shann 7-37
J.J. Shann 7-38
F. Other Counters ( 7-6) Counters: can be designed to generate any desired sequence of states Binary counter (D, E) BCD counter Divide-by-N counter: modulo-n counter a counter that goes through a repeated sequence of N states The sequence may follow the binary count or may be any other arbitrary sequence. J.J. Shann 7-39
BCD Counter State diagram & Count sequence: 8 4 2 J.J. Shann 7-4
補 充 資 料 : BCD ripple counter (p.7-37~7-38) 8 4 2 Observations: : 2 : 4 : 8 : C = Count J = K = C 2 = ( ) 8 =, J 2 =, K 2 = (Toggle) 8 =, J 2 =, K 2 = (Reset) J 2 = 8, K 2 = C 4 = 2 ( ) J = K = C 8 = ( ) 4 2 =, J 2 =, K 2 = (Toggle) 4 2 =, J 2 =, K 2 = (Reset) J 2 = 4 2, K 2 = J.J. Shann 7-4
Observations: : 2 : C = Count J = K = C 2 = ( ) 8 =, J 2 =, K 2 = (Toggle) 8 =, J 2 =, K 2 = (Reset) J 2 = 8, K 2 = 8 4 : 8 : C 4 = 2 ( ) J = K = C 8 = ( ) 4 2 =, J 2 =, K 2 = (Toggle) 4 2 =, J 2 =, K 2 = (Reset) J 2 = 4 2, K 2 = 2 4 J.J. Shann 7-42
Synchronous BCD Counter Synchronous BCD counter: E.g.: 4-bit sync BCD counter w/ D-type f-f D = D D 2 = 2 8 4 = 4 2 D = ( + 4) 8 8 8 2 Y = 8 J.J. Shann 7-43
E.g.: 4-bit sync BCD counter w/ T-type f-f T =, T 2 = 8, T 4 = 2, T 8 = 8 + 4 2, y = 8 J.J. Shann 7-44
Three-decade BCD counter: J.J. Shann 7-45
Counter w/ Unused States n flip-flops 2 n binary states Unused states: states that are not used in specifying the sequential ckt may be treated as don t-care conditions or may be assigned specific next states Self-correcting counter: Ensure that when a ckt enter one of its unused states, it eventually goes into one of the valid states after one or more clock pulses so it can resume normal operation. Analyze the ckt to determine the next state from an unused state after it is designed. J.J. Shann 7-46
Example: The simplified f-f input eqs: D A = A B D B = C D C = B C Two unused states: & J.J. Shann 7-47
The logic diagram & state diagram of the ckt: Analysis Unused states * Self-correcting! J.J. Shann 7-48
補 充 資 料 :Ring Counter Ring counter: a circular shift register w/ only one flip-flop being set at any particular time, all others are cleared (initial value = ) The single bit is shifted from one flip-flop to the next to produce the sequence of timing signals. E.g.: 4-bit ring counter T T T 2 T 3 J.J. Shann 7-49
Application of counters: Counters may be used to generate timing signals to control the sequence of operations in a digital system. Approaches for generation of 2 n timing signals:. a shift register (ring-counter) w/ 2 n flip-flops 2. an n-bit binary counter + an n-to-2 n -line decoder J.J. Shann 7-5
J.J. Shann 7-5
補 充 資 料 :Johnson Counter Ring counter vs. Switch-tail ring counter: Ring counter: a k-bit ring counter circulates a single bit among the flip-flops to provide k distinguishable states. Switch-tail ring counter: is a circular shift register w/ the complement output of the last flip-flop connected to the input of the first flip-flop a k-bit switch-tail ring counter will go through a sequence of 2k distinguishable states. (initial value = ) J.J. Shann 7-52
E.g.: 4-bit switch-tail ring counter C E A E AB CE T T 8 T 7 T. T 8 T 3 T 2 T 6 T 5 T 4 J.J. Shann 7-53
Johnson counter: a k-bit switch-tail ring counter + 2k 2-input decoding gates provide outputs for 2k timing signals E.g.: 4-bit Johnson counter T 8 T 7 T 6 T 5 T 4 T 3 T 2 T 8 2-input decoding gates A B C E 4-bit switch-tail ring counter The decoding follows a regular pattern: 2 inputs per decoding gate J.J. Shann 7-54
Disadv. of the switch-tail ring counter: If it finds itself in an unused state, it will persist to circulate in the invalid states and never find its way to a valid state. Not self-correcting! Unused states: 8 J.J. Shann 7-55
Analysis of the ckt: A + = D A = E B + = D B = A C + = D C = B E + = D E = C Binary-coded state table State diagram J.J. Shann 7-56
CE AB CE AB (Unused states) A + = E B + = A CE AB C + = B CE AB E + = C J.J. Shann 7-57
CE AB CE AB * Self-correcting! A + = E B + = A CE AB C + = (A + C)B CE AB E + = C J.J. Shann 7-58
Summary: Johnson counters can be constructed for any # of timing sequences: # of flip-flops = /2 (the # of timing signals) # of decoding gates = # of timing signals 2-input per gate J.J. Shann 7-59
7-2 Chapter Summary Registers Simplest register ( 7-) Register with parallel load ( 7-) Shift registers ( 7-6) Counters Ripple counter ( 7-6) Synchronous binary counters ( 7-6) Other counters ( 7-6) J.J. Shann 7-6
Homework Sections Exercises 7- ~ 2 7-6 7 ~ 22 Homework: 2, 5 Homework: 9, 4, 8, 2, 22 J.J. Shann 7-6