What is Shift register?
A chain of flip-flops that moves data one bit to the next stage on each clock. It is used for serial-parallel conversion and as the scan chain in scan testing.
Japanese name: シフトレジスタ
A chain of flip-flops that moves data one bit to the next stage on each clock. It is used for serial-parallel conversion and as the scan chain in scan testing.
Japanese name: シフトレジスタ
A shift register chains D flip-flops so that each output feeds the next input, and all share one clock. On every active edge each bit moves one stage along the chain. Variants are classified by how data enter and leave: serial-in serial-out acts as a delay line, serial-in parallel-out collects incoming bits into a word, parallel-in serial-out loads a word and shifts it out, and some designs also shift in both directions. In HDL the stages must be written with nonblocking assignments, as in q1 <= d; q2 <= q1;.
Serial-parallel conversion is the classic use. High-speed serial links (SerDes, serializer/deserializer) convert wide parallel buses into a few very fast serial lanes and back, reducing wire and pin count. A simple serial-in parallel-out chip such as the 74HC595 lets a microcontroller drive many LEDs from three pins. In chip testing, scan design connects a block's flip-flops into scan chains: in test mode the flip-flops form a shift register so test patterns can be shifted in, one functional clock applied, and the captured responses shifted out.
Feeding outputs back to the input turns a shift register into a counter. A ring counter recirculates a single 1 and has n states with n flip-flops. A Johnson, or twisted-ring, counter feeds back the inverted last output and cycles through 2n states, such as 000, 100, 110, 111, 011, 001 for three stages. Only one bit changes between neighboring states, so each state can be decoded with a two-input gate with little risk of glitches, and the outputs provide evenly staggered clock phases.
A linear feedback shift register (LFSR) feeds the XOR of selected outputs, called taps, back to the input. With properly chosen taps an n-bit LFSR steps through all 2ⁿ − 1 nonzero states before repeating, a maximal-length sequence that looks random. Built only from flip-flops and XOR gates, LFSRs generate test patterns and compact responses in built-in self-test (BIST), compute cyclic redundancy checks (CRC) and scramble data on communication links. Their output is fully predictable from about 2n consecutive bits (n being the register length), so they are not suitable for cryptographic randomness.
Answer: C. Converting between serial and parallel data
A shift register can accumulate serial data arriving bit by bit on one line and output it in parallel, or do the reverse. High-speed interfaces (SerDes) perform this conversion to reduce wire count. Shift registers are also used in serial-in, parallel-out ICs that drive many LEDs from a few pins, implement delay lines, and form scan chains that link flip-flops for chip testing.
Answer: A. Generating pseudo-random patterns, such as test patterns, and computing CRCs
With properly chosen taps, an n-bit LFSR cycles through all 2ⁿ − 1 nonzero states, producing a seemingly random maximal-length sequence (m-sequence). Built only from XORs and flip-flops, it is used for built-in self-test (BIST) pattern generation and response compaction and CRC calculation in protocols such as Ethernet. It is also used in scramblers that even out the 0s and 1s in data to avoid long runs of the same value. Because the linear sequence can be predicted from a short stretch of output, an LFSR on its own is unsuitable for cryptographic randomness.
Shift registers are used for converting between serial and parallel data, building delay lines and counters, generating pseudo-random sequences as LFSRs, and forming the scan chains used to test chips.
A Johnson counter built from n flip-flops cycles through 2n states, twice as many as a ring counter with the same number of flip-flops.
With blocking assignments each stage is updated immediately, so the next stage receives the new value in the same clock and the chain collapses to a single stage; nonblocking assignments make every stage take the value from before the edge.
Shift register appears in 4 practice questions across 2 topics, including Logic circuits, HDL & Verification.
Building real circuits is a good way to check what you learned in the questions.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.