A shift register is a type of
digital circuit
In theoretical computer science, a circuit is a model of computation in which input values proceed through a sequence of gates, each of which computes a function. Circuits of this kind provide a generalization of Boolean circuits and a mathematica ...
using a cascade of
flip-flops
Flip-flops are a type of light sandal-like shoe, typically worn as a form of casual footwear. They consist of a flat sole held loosely on the foot by a Y-shaped strap known as a toe thong that passes between the first and second toes and around ...
where the output of one flip-flop is connected to the input of the next. They share a single
clock signal
In electronics and especially synchronous digital circuits, a clock signal (historically also known as ''logic beat'') is an electronic logic signal (voltage or current) which oscillates between a high and a low state at a constant frequency and ...
, which causes the data stored in the system to shift from one location to the next. By connecting the last flip-flop back to the first, the data can cycle within the shifters for extended periods, and in this configuration they were used as
computer memory
Computer memory stores information, such as data and programs, for immediate use in the computer. The term ''memory'' is often synonymous with the terms ''RAM,'' ''main memory,'' or ''primary storage.'' Archaic synonyms for main memory include ...
, displacing
delay-line memory
Delay-line memory is a form of computer memory, mostly obsolete, that was used on some of the earliest Digital data, digital computers, and is reappearing in the form of #Optical_delay_lines, optical delay lines. Like many modern forms of electro ...
systems in the late 1960s and early 1970s.
In most cases, several parallel shift registers would be used to build a larger memory pool known as a "
bit array
A bit array (also known as bitmask, bit map, bit set, bit string, or bit vector) is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level par ...
". Data was stored into the array and read back out in parallel, often as a
computer word
A computer is a machine that can be programmed to automatically carry out sequences of arithmetic or logical operations (''computation''). Modern digital electronic computers can perform generic sets of operations known as ''programs'', wh ...
, while each bit was stored serially in the shift registers. There is an inherent trade-off in the design of bit arrays; putting more flip-flops in a row allows a single shifter to store more bits, but requires more clock cycles to push the data through all of the shifters before the data can be read back out again.
Shift registers can have both
parallel and
serial inputs and outputs. These are often configured as
"serial-in, parallel-out" (SIPO) or as
"parallel-in, serial-out" (PISO). There are also types that have both serial and parallel input and types with serial and parallel output. There are also "bidirectional" shift registers, which allow shifting in both directions: L → R or R → L. The serial input and serial output of a shift register are connected to create a circular shift register. A PIPO register (parallel in, parallel out) is simply a
D-type register
Register or registration may refer to:
Arts, entertainment, and media
Music
* Register (music), the relative "height" or range of a note, melody, part, instrument, etc.
* ''Register'', a 2017 album by Travis Miller
* Registration (organ), ...
and is ''not'' a shift register, but is very fast – an output is given within a single clock pulse. A "universal" shift register provides bidirectional serial-in and serial-out, as well as parallel-in and parallel-out.
Serial-in serial-out (SISO)
Destructive readout
These are the simplest kind of shift registers. The data string is presented at "data in" and is shifted right one stage each time "data advance" is brought
high
High may refer to:
Science and technology
* Height
* High (atmospheric), a high-pressure area
* High (computability), a quality of a Turing degree, in computability theory
* High (tectonics), in geology an area where relative tectonic uplift t ...
. 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.
The data is stored after each 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,0,1,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 right hand column corresponds to the right-most flip-flop's output pin, and so on.
So the serial output of the entire value is 00010110. It can be seen that if data were to be continued to input, it would get exactly what was put in (10110000), 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'' each datum is lost once it has been shifted out of the right-most bit.
Serial-in parallel-out (SIPO)
This configuration allows conversion from serial to parallel format. Data input is serial, as described in the SISO section above. Once the data has been clocked in, it may be either read off at each output simultaneously, or it can be shifted out.
In this configuration, each flip-flop is
edge triggered. All flip-flops operate at the given clock frequency. Each input bit makes its way down to the Nth output after N clock cycles, leading to parallel output.
In cases where the parallel outputs should not change during the serial loading process, it's desirable to use a latched or
buffered output. In a latched shift register (such as the
74595) the serial data is first loaded into an internal buffer register, then upon receipt of a load signal the state of the buffer register is copied into a set of output registers. In general, the practical application of the serial-in/parallel-out shift register is to convert data from serial format on a single wire to parallel format on multiple wires.
Parallel-in serial-out (PISO)
This configuration has the data input on lines D1 through D4 in parallel format, D1 being the most significant bit. 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 PISO 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. The animation below shows the write/shift sequence, including the internal state of the shift register.
Uses
Serial and parallel conversion
One of the most common uses of a shift register is to convert between serial and parallel interfaces.
Delay
Serial-in serial-out shift registers can be used as simple delay circuits.
Stack
Several bidirectional shift registers can also be connected in parallel for a hardware implementation of a
stack
Stack may refer to:
Places
* Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group
* Blue Stack Mountains, in Co. Donegal, Ireland
People
* Stack (surname) (including a list of people ...
.
More I/O pins
Shift registers are commonly attached to
microcontrollers
A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable input/output peripherals. Pro ...
when more
general-purpose input/output
A general-purpose input/output (GPIO) is an uncommitted digital signal pin on an integrated circuit or electronic circuit (e.g. MCUs/ MPUs) board that can be used as an input or output, or both, and is controllable by software.
GPIOs have no p ...
pins are required than are available, sometimes over a
Serial Peripheral Interface in daisy chain configuration, which allows any number of binary devices to be accessed using only two to four pins, though more slowly than parallel I/O.
For more outputs, SIPO shift registers are used. The parallel outputs of the shift register and the desired state for all those devices can be sent out of the microcontroller using a single serial connection.
For more inputs, PISO shift registers are used. Each binary input (such as a
button
A button is a fastener that joins two pieces of fabric together by slipping through a loop or by sliding through a buttonhole.
In modern clothing and fashion design, buttons are commonly made of plastic but also may be made of metal, wood, or ...
or more complicated circuitry) is attached to a parallel input of the shift register, then the data is sent back serially to the microcontroller.
Pulse extenders
Shift registers can also be used as pulse extenders. Compared to
monostable multivibrator
A multivibrator is an electronic circuit used to implement a variety of simple two-state devices such as relaxation oscillators, timers, latches and flip-flops. The first multivibrator circuit, the astable multivibrator oscillator, was invented ...
s, the timing does not depend on component values, but it requires an external clock, and the timing accuracy is limited by the granularity of this clock. An example of such a pulse extender is the
Ronja Twister
Ronja may refer to:
* '' Ronia, the Robber's Daughter'' (Ronja Rövardotter), a children's book by Astrid Lindgren
* Reasonable Optical Near Joint Access, an optical point-to-point Free Space Optics data link
* Ronja (given name), the name Ronja ...
, wherein five
74164 shift registers create the core of the timing logic this way
schematic.
Data processing
In early computers, shift registers were used to handle data processing: two numbers to be added were stored in two shift registers and clocked out into an
arithmetic and logic unit (ALU) with the result being fed back to the input of one of the shift registers (the accumulator), which was one bit longer, since binary addition can only result in an answer that has the same size or is one bit longer.
Bitshift operations
Many computer languages include
bitwise operations
In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic opera ...
to "shift right" and "shift left" the data in a register, effectively dividing by two or multiplying by two for each place shifted.
Shift register memory
Very large
serial-in serial-out shift registers (thousands of bits in size) were used in a similar manner to the earlier
delay-line memory
Delay-line memory is a form of computer memory, mostly obsolete, that was used on some of the earliest Digital data, digital computers, and is reappearing in the form of #Optical_delay_lines, optical delay lines. Like many modern forms of electro ...
in some devices built in the early 1970s. Shift registers don't need many pins or address decoding logic, so was much cheaper than
random-access memory
Random-access memory (RAM; ) is a form of Computer memory, electronic computer memory that can be read and changed in any order, typically used to store working Data (computing), data and machine code. A random-access memory device allows ...
back then. Such ''shift register memory'' was sometimes called ''circulating memory''.
Datapoint 3300
The DataPoint 3300 was the first computer terminal manufactured by Computer Terminal Corporation, later renamed Datapoint, announced in 1967 and shipping in 1969. Since this terminal was intended to replace a teleprinter such as those made by Tele ...
, for example, stored its
terminal display of 25 rows of
72 columns of 6-bit upper-case characters using 54 200-bit shift registers (arranged in 6 tracks of 9 packs), providing storage for 1800 characters. The shift register design meant that scrolling the terminal display could be accomplished by simply pausing the display output to skip one line of characters. A similar design was used for the
Apple I
The Apple Computer 1 (Apple-1), later known predominantly as the Apple I, is an 8-bit personal computer designed by Steve Wozniak and released by the Apple Computer Company (now Apple Inc.) in 1976. The company was initially formed to ...
's terminal.
History
One of the first known examples of a shift register was in the Mark 2
Colossus, a code-breaking machine built in 1944. It was a six-stage device built of
vacuum tube
A vacuum tube, electron tube, thermionic valve (British usage), or tube (North America) is a device that controls electric current flow in a high vacuum between electrodes to which an electric voltage, potential difference has been applied. It ...
s and
thyratron
A thyratron is a type of gas-filled tube used as a high-power electrical switch and controlled rectifier. Thyratrons can handle much greater currents than similar hard-vacuum tubes. Electron multiplication occurs when the gas becomes ionized, pro ...
s. A shift register was also used in the
IAS machine
The IAS machine was the first electronic computer built at the Institute for Advanced Study (IAS) in Princeton, New Jersey. It is sometimes called the von Neumann machine, since the paper describing its design was edited by John von Neumann, a ...
, built by
John von Neumann
John von Neumann ( ; ; December 28, 1903 – February 8, 1957) was a Hungarian and American mathematician, physicist, computer scientist and engineer. Von Neumann had perhaps the widest coverage of any mathematician of his time, in ...
and others at the
Institute for Advanced Study
The Institute for Advanced Study (IAS) is an independent center for theoretical research and intellectual inquiry located in Princeton, New Jersey. It has served as the academic home of internationally preeminent scholars, including Albert Ein ...
in the late 1940s. Shift registers made their way into integrated circuits in the 1960s as evidenced by early patents from
Frank Wanlass
Frank Marion Wanlass (May 17, 1933, in Thatcher, AZ – September 9, 2010, in Santa Clara, California) was an American electrical engineer. He is best known for inventing, along with Chih-Tang Sah, CMOS (complementary MOS) logic in 1963. CM ...
and Kent Smith
working at
General Instrument
General Instrument (GI) was an American electronics manufacturer based in Horsham, Pennsylvania, specializing in semiconductors and cable television equipment. They formed in New York City in 1923 as an electronics manufacturer. During the 1950s ...
.
See also
*
Delay-line memory
Delay-line memory is a form of computer memory, mostly obsolete, that was used on some of the earliest Digital data, digital computers, and is reappearing in the form of #Optical_delay_lines, optical delay lines. Like many modern forms of electro ...
*
Linear-feedback shift register
In computing, a linear-feedback shift register (LFSR) is a shift register whose input bit is a Linear#Boolean functions, linear function of its previous state.
The most commonly used linear function of single bits is exclusive-or (XOR). Thus, ...
(LFSR)
*
Ring counter
A ring counter is a type of counter composed of flip-flops connected into a shift register, with the output of the last flip-flop fed to the input of the first, making a "circular" or "ring" structure.
There are two types of ring counters:
* A ...
*
SerDes (Serializer/Deserializer)
*
Serial Peripheral Interface Bus
Serial Peripheral Interface (SPI) is a de facto standard (with many #Variations, variants) for Comparison of synchronous and asynchronous signalling, synchronous serial communication, used primarily in embedded systems for short-distance wired c ...
*
Shift register lookup table (SRL)
*
Circular buffer
In computer science, a circular buffer, circular queue, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams. The ...
References
{{Authority control
Digital registers
Computer memory