Worked examples — Registers and shift registers
Before we start, one picture fixes the vocabulary we will use in every single example.

The scenario matrix
Every problem this topic can hand you is one of these cells. The examples below are tagged with the cell they cover, and together they hit all of them.
| # | Case class | What's tricky about it | Example |
|---|---|---|---|
| A | Left shift, unsigned, no overflow | plain ×2 | Ex 1 |
| B | Left shift with overflow (bit falls off MSB) | ×2 breaks | Ex 2 |
| C | Right shift, unsigned | floor ÷2, LSB lost | Ex 3 |
| D | Right shift, signed (arithmetic) | sign bit must be copied | Ex 4 |
| E | Serial In vs | entering bit is external | Ex 5 |
| F | SIPO — serial → parallel assembly | LSB-first ordering | Ex 6 |
| G | PISO — parallel → serial transmission | which bit leaves first | Ex 7 |
| H | Degenerate: all-zeros / all-ones input | limiting behaviour | Ex 8 |
| I | Traversal timing (n edges) | counting the delay | Ex 9 |
| J | Real-world + exam twist (ring counter) | feedback wraps the end | Ex 10 |
Every numeric answer below is machine-checked in the verify block.
Ex 1 — Left shift, unsigned, no overflow (cell A)
- Edge 1. Apply , with . So . Why this step? Left shift = every bit slides one place toward the MSB; the vacated LSB is filled by Serial In.
- Edge 2. Again: . Why this step? Same rule, applied once more.
Verify: , . Doubling . ✔ No bit ever fell off the MSB (the leading bit was each time), so ×2 held exactly.
Ex 2 — Left shift with overflow (cell B)
- Apply the rule. . The old MSB (a , worth ) slid off the left edge and is gone. Why this step? The register has no fifth flip-flop; whatever leaves is discarded.
- Read the result. , not . Why this step? The lost bit was worth ; doubling gives , and is exactly the discarded place, leaving .
Verify: . ✔ Left shift is ×2 only modulo — when the MSB is , the answer wraps.
Ex 3 — Right shift, unsigned (cell C)
- Edge 1. , MSB gets Serial In : . The old LSB fell off the right. Why this step? Right shift slides toward the LSB; the vacated MSB is filled by Serial In.
- Edge 2. . Another dropped. Why this step? Same rule again.
Verify: , . Sequence . Floor division: , . ✔ Right shift is floor ÷2 because the discarded LSB (the remainder) is thrown away.
Ex 4 — Right shift, signed (arithmetic) (cell D)
- Identify the sign bit. MSB means negative. In two's complement the value of is . Why this step? We must know the sign to preserve it.
- Arithmetic shift = copy the sign into the vacated MSB. So Serial In old MSB : . Why this step? A logical shift would inject and flip a negative into a large positive. Copying the sign keeps the number negative.
- Decode the result. . Why this step? Confirms the division worked in the signed world.
Verify: ✔, and as signed 4-bit ✔. Logical shift would have given ✔ (the wrong answer we avoided).
Ex 5 — Serial In = 1 vs 0 (cell E)
- Edge 1: (a enters ). Why? Serial In lands in the vacated LSB.
- Edge 2: . Why? Old bit slides up, new enters.
- Edge 3: . Why? Same march.
- Edge 4: . Why? Register now saturated with ones.
Verify: After 4 edges with Serial In : . With Serial In the register would stay forever (nothing new but zeros enter). ✔ The entering bit is an external line, not part of the chain — leave it undefined and you shift in garbage.
Ex 6 — SIPO: serial stream → parallel word (cell F)
The figure tracks the word building up clock by clock.

- Clock 1, Serial In : . Why? First (LSB) bit lands in .
- Clock 2, Serial In : . Why? Earlier bit slides up to ; new enters .
- Clock 3, Serial In : . Why? Keep marching.
- Clock 4, Serial In : . Why? The last (MSB) bit fills ; word complete.
Verify: Final parallel word . The first bit received () sat down at (the LSB) and the last () at — exactly LSB-first packing. ✔
Ex 7 — PISO: parallel word → serial stream (cell G)
- Before edge 1: is sent. Then right shift: . Why this step? We output the LSB, then slide everyone toward the LSB.
- Before edge 2: sent. Shift: . Why this step? Same rule — read the current LSB, then shift once toward the LSB with Serial In .
- Before edge 3: sent. Shift: . Why this step? The new LSB is now ; we output it, then shift again by the identical rule.
- Before edge 4: sent. Shift: . Why this step? Last remaining bit is at ; output it, and the final shift empties the register.
Verify: Transmitted sequence (LSB first). This is the same LSB-first order the Ex 6 SIPO receiver expects, so feeding it back rebuilds ✔ — PISO and SIPO are inverses, which is the whole point of serial links.
Ex 8 — Degenerate inputs: all-zeros and all-ones (cell H)
- Case (a), starts : every shift is . Why? Zeros slide into zeros; nothing to move. Fixed point.
- Case (b), starts : . Why? Each edge pushes one off the MSB and pulls a in at the LSB; after 4 edges (register width) all ones are flushed.
Verify: (a) stays ✔. (b) reaches after exactly edges ✔ — a full-width flush, matching the "n edges to traverse" rule of Ex 9.
Ex 9 — Traversal timing (cell I)
- Count the stages. SISO chains flip-flops; a bit advances exactly one stage per edge. Why? Each D flip-flop samples its input only at the active edge.
- Add them up. Entering at edge #1, the bit reaches the last flip-flop's output after edges — visible at Serial Out on edge #8 (relative to entry it is edges of delay).
Verify: Delay edges ✔. This is why a SISO register is literally a "programmable delay" measured in clock ticks.
Ex 10 — Real-world + exam twist: ring counter (cell J)
- Edge 1: left shift, but Serial In old MSB : . Why? The MSB that "falls off" is fed back to the LSB; here the departing bit was .
- Edge 2: . Why? The lone keeps walking up.
- Edge 3: . Why? now at the MSB.
- Edge 4: MSB falls off and is fed back to the LSB: . Why? Feedback closes the ring — we are back to the start.
Verify: States — period . ✔ A ring counter with one hot bit cycles through exactly states, a cheap one-hot sequencer built from a shift register plus feedback.
Active Recall
Recall Which cells break the "shift = ×2 / ÷2" shortcut, and why?
Cell B (left shift with a leaving the MSB → wraps mod ) and cell D (signed right shift needs the sign bit copied, not a ). Both fail because a bit crossing the end of a finite register carries real place value.
Left shift once (4-bit unsigned) gives?
Arithmetic right shift of signed gives?
PISO loaded with transmits which bit first?
An 8-bit SISO delays a bit by how many edges?
A one-hot 4-bit ring counter has what period?
Connections
- D flip-flop — the one-edge delay behind every example's timing.
- Multiplexers — selects shift-direction / load in a real chip.
- Counters — Ex 10's ring counter is a shift register with feedback.
- Serial communication (UART, SPI) — Ex 6 (SIPO receive) & Ex 7 (PISO transmit).
- Binary multiplication and division — cells A–D are the shift steps of shift-and-add / shift-and-subtract.
- Clocking and setup/hold time — Ex 9's delay is measured in valid clock edges.
Concept Map
The figure below shows how the single shift rule branches into every scenario worked on this page.
