Discussion 9

 

Flip Flops and Registers

 

We’ve already seen how to build an SR flip flop, the basic one-bit memory. We can make the SR more useful by adding some logic that avoids the indeterminate 0-0 input and that is logically more useful. The D flip flop has a data input and a Clock input. When the clock is high, the data at the input appears at the output. When the clock is low, then the output remains unchanged.

 

 

This circuit will transfer D to Q as long as the clock is high. Thus, if the value of D isn’t stable, the output will mirror its changes. Additional circuitry can be used to make it only input a value from D on the transition of the clock from low to high.

 

We can represent a D flip flop with a simpler symbol:

 

 

A set of D flip flops with a common clock makes a basic register. Here’s an example with four bits:

 

 

In addition to placing register bits in parallel, we can also chain them together in series to form a shift register:

 

 

By feeding the Data Out back around to the Data In, we turn the linear shift register into a circular shift (or rotate) register. We can place an AND-OR circuit in front of the first input to selectively choose between shifting and rotating.

 

 

Other variations include having the register shift either direction (by selecting as input for a bit either the Q to the left or the Q to the right), copying the leftmost (or rightmost) bit on each shift (used for sign extension in changing between single and double precision), and providing parallel load in addition to shifting.

 

As we’ve seen, shift registers are used in multiply and divide units, and also for alignment of data (as when loading a byte from an arbitrary byte address into a word-sized register). They can also be used in pipelines, to get data and control signal to the right places at the right times. Another use for the shift register is to insert a delay into a flow of bits, for example to ensure that a result from a faster circuit doesn’t arrive too far in advance of a result from a slower circuit.

 

As we’ve mentioned, another type of flip flop is the T flip flop, with toggles its output between 0 and 1 with each clock pulse. The T flip flop may have Set and Reset inputs to give it an initial state.

 

 

Chaining a set of T flip flops together in series creates a counter. The following figure shows a three-bit counter, and the relationships between the input clock and the three outputs. As you can see, the pattern follows that of counting in binary. Also, the output signal is the same as the clock but with its frequency divided by eight. Thus, counters are also used as frequency dividers in processors, for example, to slow down the clock rate when necessary.

 

 

Now that we’ve seen arithmetic circuits, logic circuits, and registers, we have enough of the basics of digital logic to construct the arithmetic (or execution) data path of a processor.

 


© Copyright 1995, 1996, 2001 Charles C. Weems Jr. All rights reserved.


Back to Chip Weems' home page.


Back to courses index page.


Back to Computer Science Department home page.