Skip to content

Shift Registers

A register is a group of flip-flops used to store and manipulate a binary word. An nn-bit register contains nn flip-flops, normally driven by a common clock. Depending on its control circuit, data can be loaded, held, shifted, or transferred in serial or parallel form.

A shift register is a register in which the stored bits move from one flip-flop to the next on successive active clock edges.

ElementStorage capacityOperation
Flip-flopbitStores one binary state
Registernn bitsStores and transfers one binary word
Shift registernn bitsStores a word and shifts it between stages

Common register controls are:

  • Clock: causes synchronous state changes.

  • Enable or hold: permits a state change or retains the present word.

  • Parallel load: loads all input bits on one active edge.

  • Clear or reset: forces the register to a known state; it may be synchronous or asynchronous.

Let Q3Q_3 be the most-significant stage and Q0Q_0 the least-significant stage. A right shift moves data in the direction

Q3→Q2→Q1→Q0.Q_3\rightarrow Q_2\rightarrow Q_1\rightarrow Q_0.

For a four-stage D flip-flop register,

Q3+=Din,Q2+=Q3,Q1+=Q2,Q0+=Q1.\boxed{ Q_3^+=D_{\mathrm{in}},\quad Q_2^+=Q_3,\quad Q_1^+=Q_2,\quad Q_0^+=Q_1 }.

Four-stage D flip-flop shift register with serial path, parallel taps, and common clock

Four-stage D flip-flop shift register with serial path, parallel taps, and common clock

All four flip-flops sample simultaneously. Each next state is determined by the value present at the corresponding D input immediately before the active clock edge.

For an initial state Q3Q2Q1Q0=0000Q_3Q_2Q_1Q_0=0000 and serial input sequence 1,0,1,11,0,1,1:

Active edgeDinD_{\mathrm{in}}Q3Q2Q1Q0Q_3Q_2Q_1Q_0 after the edge
Initial-0000
111000
200100
311010
411101

Timing diagram for loading serial sequence 1011 into a four-bit right-shift register

Timing diagram for loading serial sequence 1011 into a four-bit right-shift register

Serial and parallel input-output modes of registers

Serial and parallel input-output modes of registers

TypeInputOutputOperationTypical use
SISOSerialSerialOne bit enters and one bit leaves per clockSerial delay and serial transfer
SIPOSerialParallelA serial word is shifted in and read simultaneously from all stagesSerial-to-parallel conversion
PISOParallelSerialA word is loaded together and shifted out one bit at a timeParallel-to-serial conversion
PIPOParallelParallelA complete word is loaded and read togetherTemporary word storage

In a SISO register, the input stream enters the first stage and passes through every stage. An nn-stage register requires nn active edges to fill from an empty state. Once full, one bit enters and one bit leaves on every active edge.

A SIPO register uses the same cascaded structure but exposes all outputs Qn−1,…,Q0Q_{n-1},\ldots,Q_0. After nn serial bits have been clocked in, the complete word is available in parallel.

A PISO register places a 2:12{:}1 multiplexer before each D flip-flop. Let L=1L=1 select parallel load and L=0L=0 select right shift:

D3=LP3+L‾Din,D2=LP2+L‾Q3,D1=LP1+L‾Q2,D0=LP0+L‾Q1.\begin{aligned} D_3 & =LP_3+\overline L D_{\mathrm{in}}, \\ D_2 & =LP_2+\overline L Q_3, \\ D_1 & =LP_1+\overline L Q_2, \\ D_0 & =LP_0+\overline L Q_1. \end{aligned}

Four-bit PISO register with parallel-load multiplexers and a common clock

Four-bit PISO register with parallel-load multiplexers and a common clock

One load edge stores P3P2P1P0P_3P_2P_1P_0. The loaded Q0Q_0 is the first serial bit; successive shift edges expose the remaining bits at Q0Q_0.

A PIPO register loads all nn input bits on one active edge and presents all nn output bits together. With load disabled, feedback from QiQ_i to DiD_i holds the stored word.

A bidirectional shift register shifts either right or left. With serial inputs SRSR and SLSL,

extrightshift:(Q3,Q2,Q1,Q0)+=(SR,Q3,Q2,Q1),extleftshift:(Q3,Q2,Q1,Q0)+=(Q2,Q1,Q0,SL).\begin{aligned} ext{right shift:}\quad (Q_3,Q_2,Q_1,Q_0)^+ & =(SR,Q_3,Q_2,Q_1), \\ ext{left shift:}\quad (Q_3,Q_2,Q_1,Q_0)^+ & =(Q_2,Q_1,Q_0,SL). \end{aligned}

Let M=1M=1 select right shift and M=0M=0 select left shift. A 2:12{:}1 multiplexer before each D input gives

D3=M(SR)+M‾Q2,D2=MQ3+M‾Q1,D1=MQ2+M‾Q0,D0=MQ1+M‾(SL).\begin{aligned} D_3 & =M(SR)+\overline M Q_2, \\ D_2 & =MQ_3+\overline M Q_1, \\ D_1 & =MQ_2+\overline M Q_0, \\ D_0 & =MQ_1+\overline M(SL). \end{aligned}

A universal shift register performs hold, right shift, left shift, and parallel load. Each stage uses a 4:14{:}1 multiplexer to select its next-state source.

Universal-register stage and four-bit register block

Universal-register stage and four-bit register block

S1S_1S0S_0Selected sourceOperation at the active edge
Present output QiQ_iHold
Right-shift source RiR_iShift right
Left-shift source LiL_iShift left
Parallel input PiP_iParallel load

The D input of stage ii is

Di=S‾1S‾0Qi+S‾1S0Ri+S1S‾0Li+S1S0Pi.\boxed{ D_i=\overline S_1\overline S_0Q_i +\overline S_1S_0R_i +S_1\overline S_0L_i +S_1S_0P_i }.

At the end stages, RiR_i or LiL_i is replaced by the corresponding external serial input SRSR or SLSL.

Logical right shift, arithmetic right shift, and rotate-right data paths

Logical right shift, arithmetic right shift, and rotate-right data paths

OperationNext word (Q3,Q2,Q1,Q0)+(Q_3,Q_2,Q_1,Q_0)^+Vacated position
Logical right(0,Q3,Q2,Q1)(0,Q_3,Q_2,Q_1)Zero enters Q3Q_3
Logical left(Q2,Q1,Q0,0)(Q_2,Q_1,Q_0,0)Zero enters Q0Q_0
Arithmetic right(Q3,Q3,Q2,Q1)(Q_3,Q_3,Q_2,Q_1)Sign bit Q3Q_3 is replicated
Arithmetic left(Q2,Q1,Q0,0)(Q_2,Q_1,Q_0,0)Same bit movement as logical left; signed overflow may occur
Rotate right(Q0,Q3,Q2,Q1)(Q_0,Q_3,Q_2,Q_1)Q0Q_0 returns to Q3Q_3
Rotate left(Q2,Q1,Q0,Q3)(Q_2,Q_1,Q_0,Q_3)Q3Q_3 returns to Q0Q_0

For an unsigned word, a logical left shift multiplies by 2 modulo 2n2^n, while a logical right shift gives integer division by 2. Arithmetic right shift preserves the sign of a two’s-complement number.

Setup time, hold time, and clock-to-Q delay of a register stage

Setup time, hold time, and clock-to-Q delay of a register stage

  • Setup time tsut_{su}: minimum interval for which input data must be stable before the active edge.

  • Hold time tht_h: minimum interval for which input data must remain stable after the active edge.

  • Clock-to-output delay tCQt_{CQ}: time from the active edge until the new output is valid.

For a synchronous register path,

Tclk(min⁡)≥tCQ(max⁡)+tlogic(max⁡)+tsu+tskew\boxed{T_{clk(\min)}\ge t_{CQ(\max)}+t_{logic(\max)}+t_{su}+t_{skew}}

and

fmax≤1Tclk(min⁡).\boxed{f_{max}\le \frac{1}{T_{clk(\min)}}}.

All stages use the same clock, so their clock-to-Q delays do not add as ntCQnt_{CQ} when determining fmaxf_{max}. Hold time requires a separate minimum-delay check.

For single-data-rate serial transfer, one bit is accepted per clock period:

Rb=fclk,tn-bit=nTclk=nfclk.\boxed{R_b=f_{clk}},\qquad \boxed{t_{n\text{-bit}}=nT_{clk}=\frac{n}{f_{clk}}}.

A bit captured by the first stage reaches the nnth stage after n−1n-1 further active edges. Its stage-to-stage capture latency is approximately

tlatency=(n−1)Tclk+tCQ.\boxed{t_{latency}=(n-1)T_{clk}+t_{CQ}}.

A four-bit register initially contains 10111011. Three right shifts apply serial inputs 0,1,00,1,0:

Active edgeSerial inputBit leaving Q0Q_0New state Q3Q2Q1Q0Q_3Q_2Q_1Q_0
Initial--

For an 8-bit SIPO register clocked at 2 MHz2\ \mathrm{MHz},

Tclk=12×106=0.5 μs,T_{clk}=\frac{1}{2\times10^6}=0.5\ \mu\mathrm{s}, tload=8Tclk=4 μs.\boxed{t_{load}=8T_{clk}=4\ \mu\mathrm{s}}.

For tCQ(max⁡)=12 nst_{CQ(\max)}=12\ \mathrm{ns}, tlogic(max⁡)=3 nst_{logic(\max)}=3\ \mathrm{ns}, tsu=5 nst_{su}=5\ \mathrm{ns}, and tskew=2 nst_{skew}=2\ \mathrm{ns},

Tclk(min⁡)=12+3+5+2=22 ns,T_{clk(\min)}=12+3+5+2=22\ \mathrm{ns}, fmax=122 ns≈45.5 MHz.\boxed{f_{max}=\frac{1}{22\ \mathrm{ns}}\approx45.5\ \mathrm{MHz}}.

A ring counter is a shift register whose last-stage output is fed directly to the first-stage input:

Q3+=Q0.\boxed{Q_3^+=Q_0}.

With the one-hot initial state 10001000, a four-stage ring counter has the sequence

1000→0100→0010→0001→1000.1000\rightarrow0100\rightarrow0010\rightarrow0001\rightarrow1000.

An nn-stage ring counter has nn useful states. It must be initialized with one 1; the all-zero state is locked.

A Johnson counter, or twisted-ring counter, feeds the complement of the last-stage output to the first stage:

Q3+=Q‾0.\boxed{Q_3^+=\overline Q_0}.

Starting from 00000000, a four-stage Johnson counter has the sequence

0000→1000→1100→1110→1111→0111→0011→0001→0000.\begin{aligned} 0000 & \rightarrow1000\rightarrow1100\rightarrow1110\rightarrow1111 \\ & \rightarrow0111\rightarrow0011\rightarrow0001\rightarrow0000. \end{aligned}

An nn-stage Johnson counter has 2n2n useful states.

Four-bit ring and Johnson counter circuits

Four-bit ring and Johnson counter circuits

The state-cycle diagram makes the feedback distinction explicit: an nn-stage ring counter has nn valid states, whereas a Johnson counter has 2n2n.

Four-bit ring and Johnson counter state cycles

Four-bit ring and Johnson counter state cycles

PropertyRing counterJohnson counter
FeedbackQlastQ_{last}Q‾last\overline Q_{last}
Useful states with nn flip-flopsnn2n2n
Normal initializationPreset one-hot wordClear to all zeros
State patternOne 1 circulates1s fill, then 0s fill
DecodingOne stage output per stateSimple two-output decoding
Main applicationsOne-hot timing, scanning, sequence controlMulti-phase timing, frequency division, sequence control
ICWidth and typePrincipal controls and features
-bit SIPOSerial input, parallel outputs, asynchronous clear
-bit PISOParallel load, serial shift input, serial output
-bit universal bidirectionalHold, shift right, shift left, parallel load
ApplicationRegister operation
Serial-to-parallel conversionSIPO
Parallel-to-serial conversionPISO
Temporary word storage and transferPIPO
Digital delay lineOne clock-period delay per stage
Arithmetic scalingLogical or arithmetic shift
Bit rotationCircular feedback
One-hot timing and scanningRing counter
Multi-phase timingJohnson counter
Sequence generationFeedback shift register or counter-decoder combination