Shift registers built from D flip-flops: serial and parallel modes (SISO, SIPO, PISO, PIPO), bidirectional and universal registers, shifting as multiply or divide, ring and Johnson counters, and linear feedback shift registers.
Left and right shifts multiply and divide by 2; arithmetic shifts keep the sign.
Concept notes
1. Shift register basics and the four modes
A shift register is a chain of D flip-flops sharing one clock, with the output of each stage feeding the D input of the next. At every active clock edge each flip-flop takes the value its neighbour held just before the edge, so the stored word moves one place. Because all flip-flops sample together, a input never sees the new value of its neighbour in the same edge (edge-triggered flip-flops are essential; level-sensitive latches would let data race through).
An -bit register uses flip-flops and stores bits.
Mode
Data in
Data out
Typical use
SISO (serial in, serial out)
one bit per clock
one bit per clock
delay line
SIPO (serial in, parallel out)
one bit per clock
all bits at once
serial-to-parallel conversion (receiver)
PISO (parallel in, serial out)
all bits in one load
one bit per clock
parallel-to-serial conversion (transmitter)
PIPO (parallel in, parallel out)
all bits at once
all bits at once
storage register
Timing facts:
Loading bits serially takes clock pulses. After loading, the first bit entered is in the last stage.
In a SISO register a bit entered at the input reaches the serial output after clock pulses, so the register delays a bit stream by clock periods: .
Sending an -bit word over one wire at a clock rate takes seconds.
4-bit shift register: serial data enters FF0 and moves one stage right at each clock edge. Taking Q0 to Q3 together gives SIPO; taking only Q3 gives SISO.
2. Bidirectional and universal shift registers
A bidirectional register can shift left or right. A universal shift register (such as the 4-bit 74194 type) can also hold its data and load in parallel. Each stage has a 4:1 multiplexer in front of its D input, selected by two mode lines:
Operation
D input of stage
00
hold
its own output
01
shift right
(stage 0 takes the serial-right input)
10
shift left
(the last stage takes the serial-left input)
11
parallel load
external input
Which direction counts as "right" depends on how the stages are drawn; always follow the question's definition, then trace one clock at a time.
Shifting as arithmetic. Writing the word with the MSB on the left:
A logical left shift by one (0 entering at the LSB) multiplies an unsigned number by 2, as long as no 1 is shifted out of the MSB. Shifting places multiplies by .
A logical right shift (0 entering at the MSB) divides an unsigned number by 2, dropping the remainder.
An arithmetic right shift copies the sign bit into the MSB, so it divides a 2's complement number by 2, rounding towards . Example: () shifted right twice gives ().
Rotate (circular shift) feeds the bit that leaves one end back into the other end; no bit is lost.
Example: (22) shifted left twice is (88) .
3. Ring and Johnson counters
Feeding the output of a shift register back to its input turns it into a counter whose states are decoded easily.
Ring counter. (the last output goes straight back). It is preset to a single 1, for example , which then circulates: .
flip-flops give only states (mod-), out of possible.
Each state has exactly one 1, so no decoding gates are needed.
Each output is a pulse of width one clock period, repeating at .
It is not self-starting: if it powers up in it stays there, and other wrong patterns also circulate forever, so it needs a preset or correcting logic.
Johnson (twisted-ring, switch-tail) counter. . From (written ) a 4-bit Johnson counter goes
flip-flops give states (mod-); states are unused.
Each state is decoded by one 2-input AND gate (on two adjacent outputs).
Each output is a square wave with 50% duty cycle at .
The basic circuit is not self-starting: the unused states form a separate cycle (for 4 bits, a second cycle of 8 states such as ).
Counter
Flip-flops
States
Decoding
Output frequency
Ring
none
Johnson
2-input AND
Binary
-input AND
MSB at
4. Linear feedback shift registers and state tracing
A linear feedback shift register (LFSR) feeds the XOR of some outputs (the taps) back to the input. It generates a repeating bit pattern and is used for pseudo-random sequences, scramblers and CRC computation.
The all-zero state maps to itself (XOR of zeros is 0), so an XOR-feedback LFSR must not start at all zeros.
With flip-flops the longest possible cycle is states (every non-zero state once). Taps that achieve this give a maximal-length sequence; other taps give shorter cycles.
In a maximal-length sequence each output contains ones and zeros per period.
How to trace any feedback shift register (the common GATE question):
Write the next-state equations. For shifting right: , , and so on, plus the feedback equation for .
Evaluate the feedback using the present state only.
Tabulate state after state until a state repeats; the number of distinct states is the cycle length.
Example: 3 stages with , starting at :
Clock
0
100
1
010
2
101
3
110
4
111
5
011
6
001
7
100
All seven non-zero states appear, so this is maximal length (). The output reads and repeats.
3-bit linear feedback shift register: the XOR of Q1 and Q2 is fed back to D0, giving a repeating sequence of 7 states.
Formulas to remember
Serial loading or delayn clock periods for n bits
Ring counter
Johnson counter
Maximal-length LFSR period
Shift as arithmetic
Common mistakes
Using the new value of a neighbouring flip-flop in the same clock edge; every stage takes the value its neighbour held just before the edge.
Forgetting that after serial loading the first bit entered sits in the last stage, so the stored word appears reversed if read from the first stage.
Confusing ring and Johnson counters: a ring counter feeds back Q, has n states and needs no decoding; a Johnson counter feeds back Q-bar, has 2n states and needs 2-input AND gates.
Starting an XOR-feedback LFSR at all zeros; it never leaves that state.
Using a logical right shift to halve a negative 2's complement number; an arithmetic shift must copy the sign bit.
Assuming shift left always means towards Q0; follow the direction defined in the question.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Loading a 4-bit SIPO register
numerical
A 4-bit register shifts right () with serial input into . It starts at , and the serial input bits are 1, 0, 1, 1 (first bit first), one per clock. Find after each clock.
Step 1: Apply the first clock.
Try it on paper first.
Example 2: Johnson counter as a frequency divider
numerical
A 4-bit Johnson counter () starts at and runs from a 1 MHz clock. List its states, and find the frequency and duty cycle of .
Step 1: Trace the states (written Q0 Q1 Q2 Q3).
Try it on paper first.
Example 3: Tracing a 4-bit LFSR
numerical
A 4-bit register shifts with . Starting at , find the state after 5 clocks and the length of the cycle.
Step 1: Write the next-state rule.
Try it on paper first.
Example 4: Shifts as multiplication and division
conceptual
An 8-bit register holds . (a) Find the value after two logical left shifts. (b) The register instead holds the 2's complement number ; find the value after two arithmetic right shifts.
Step 1: Do the left shifts and read the value.
Try it on paper first.
Previous year questions
1 official GATE EC question on this topic, newest first.
9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE EC syllabus; being checked by a reviewer. Updated 2026-11-29. Spotted a mistake? Use Report an issue on any question, or contact us.