A shift register is a register whose flip-flops pass bits along a chain. Each flip-flop's D input is driven by its neighbor's Q, so at every rising edge each bit moves one place.
- The first flip-flop's D is the serial input (SI): a new bit enters there each edge.
- The last flip-flop's Q is the serial output: its bit leaves at the next edge.
The course's direction convention, with contents written Q3 Q2 Q1 Q0:
- Shift right: bits move toward Q0. SI enters Q3; the old Q0 drops out. Wiring: D3 = SI, D2 = Q3, D1 = Q2, D0 = Q1.
- Shift left: bits move toward Q3. SI enters Q0; the old Q3 drops out.
Why it works: at an edge, every flip-flop samples its neighbor's value from just before the edge, then all update together. That is why edge triggered flip-flops are essential: with transparent latches a bit could race through several stages in one pulse.
What shift registers are used for:
- converting between serial and parallel data (SISO, SIPO, PISO, PIPO),
- delay lines,
- multiplying and dividing by 2 (shift left, logical shift right, arithmetic shift right),
- rotating bits, and simple counters such as the ring counter and johnson counter.