Shift register

From Wikipedia, the free encyclopedia

In digital circuits a shift register is a group of registers set up in a linear fashion which have their inputs and outputs connected together in such a way that the data is shifted down the line when the circuit is activated.

Contents

[edit] Types of Shift Register

Shift registers can have a combination of serial and parallel inputs and outputs, including serial-in, parallel-out (SIPO) and parallel-in, serial-out (PISO) types. There are also types that have both serial and parallel input and types with serial and parallel output. There are also bi-directional shift registers which allow you to vary the direction of the shift register. The serial input and outputs of a register can also be connected together to create a circular shift register. One could also create multi-dimensional shift registers, which can perform more complex computation.

[edit] Serial-In, Serial-Out

[edit] Destructive Readout

These are the simplest kind of shift register. The data string is presented at 'Data In', and is shifted right one stage each time 'Data Advance' is brought high. At each advance, the bit on the far left (i.e. 'Data In') is shifted into the first Flip-Flop's output. The bit on the far right (i.e. 'Data Out') is shifted out and lost.

4-Bit SISO Shift Register
4-Bit SISO Shift Register
0 0 0 0
1 0 0 0
1 1 0 0
0 1 1 0
1 0 1 1
0 1 0 1
0 0 1 0
0 0 0 1
0 0 0 0

The data is stored after each flip-flop on the 'Q' output, so there are four storage 'slots' available in this arrangement, hence it is a 4-Bit Register. To give an idea of the shifting pattern, imagine that the register holds 0000 (so all storage slots are empty). As 'Data In' presents 1,1,0,1,0,0,0,0 (in that order, with a pulse at 'Data Advance' each time. This is called clocking or strobing) to the register, this is the result. The left hand column corresponds to the left-most flip-flop's output pin, and so on.

So the serial output of the entire register is 00001101 (not counting the final step). As you can see if we were to continue to input data, we would get exactly what was put in, but offset by four 'Data Advance' cycles. This arrangement is the hardware equivalent of a queue. Also, at any time, the whole register can be set to zero by bringing the reset (R) pins high.

This arrangement performs destructive readout - the data is lost once it has been shifted out of the right-most bit.

[edit] Non-destructive readout

Non-destructive readout can be achieved using the configuration shown below. Another input line is added - the Read/Write Control. When this is high (i.e. write) then the shift register behaves as normal, advancing the input data one place for every clock cycle, and data can be lost from the end of the register. However, when the R/W control is set low (i.e. read), any data shifted out of the register at the right becomes the next input at the left, and is kept in the system. Therefore, as long as the R/W control is set low, no data can be lost from the system.

4-Bit SISO Shift Register with Non-Destrucive Readout
4-Bit SISO Shift Register with Non-Destrucive Readout

In this animation, the last four output bits are shown on the far right. When the R/W control is set low, the data is both output and brought back into the input of the register, but when R/W is high, the data is shifted out and lost.

[edit] Serial-In, Parallel-Out

This configuration allows conversion from serial to parallel format. Data is input serially, as described in the SISO section above. Once the data has been input, it may be either read off at each output simultaneously, or it can be shifted out and replaced.

4-Bit SIPO Shift Register
4-Bit SIPO Shift Register


[edit] Parallel-In, Serial-Out

This configuration has the data input on lines D1 through D4 in parallel format. To write the data to the register, the Write/Shift control line must be held LOW. To shift the data, the W/S control line is brought HIGH and the registers are clocked. The arrangement now acts as a SISO shift register, with D1 as the Data Input. However, as long as the number of clock cycles is not more than the length of the data-string, the Data Output, Q, will be the parallel data read off in order.

4-Bit PISO Shift Register
4-Bit PISO Shift Register

The animation below shows the write/shift sequence, including the internal state of the shift register.


[edit] Parallel-In, Parallel-Out

This kind of shift register takes the data from the parallel inputs (D0-D3) and shifts it to the corresponding output (Q0-Q3) when the registers are clocked. It can be used as a kind of 'history', retaining old information as the input in another part of the system, until ready for new information, whereupon, the registers are clocked, and the new data is 'let through'.

4-Bit PIPO Shift Register
4-Bit PIPO Shift Register


Note: The inputs D0-D3 are incorrectly marked as Q1-Q4, and are meant to be the top row.

[edit] Uses

One of the most common uses of a shift register is to convert between serial and parallel interfaces. This is useful as many circuits work on groups of bits in parallel, but serial interfaces are simpler to construct. Shift registers can be used as simple delay circuits. Several bi-directional shift registers could also be connected in parallel for a hardware implementation of a stack.

Shift registers can be used also as a pulse extenders. Compared to monostable multivibrators the timing has no dependency on component values, however requires external clock and the timing accuracy is limited by a granularity of this clock. Example - Ronja Twister, where five 74164 shift registers create the core of the timing logic this way (schematic).

[edit] History

One of the first known examples of a shift register was in the Colossus, a code-breaking machine of the 1940s. It was a five-stage device built of vacuum tubes.

[edit] External links

[edit] See also