A single flip-flop stores one bit. A processor needs to hold whole numbers, so several flip-flops are placed together and share a clock. Such a group is called a register.

4-Bit Register with Parallel Load

A register is a group of flip-flops that stores a binary word. A 4-bit register uses four D flip-flops with a common clock. Parallel load means that all four bits are loaded at the same time. A control input called Load decides whether the register accepts new data. When Load = 1, the data inputs I3 to I0 are copied at the next clock edge. When Load = 0, each flip-flop keeps its present value.

Definition: Register. A group of flip-flops, sharing a clock, that stores a binary word and can load, hold or shift it according to control inputs.

Shift Registers

A shift register moves its stored bits one place at every clock pulse. In a right shift register each flip-flop copies the bit of the flip-flop on its left, and a new bit enters through the serial input. The bit at the far end is the serial output. Shifting a binary number one place to the left multiplies it by 2, and shifting it one place to the right divides it by 2.

Bidirectional Shift Register with Parallel Load

A bidirectional shift register with parallel load can hold, shift right, shift left or load. Each stage has a 4:1 multiplexer in front of its D input, driven by two mode lines S1 and S0, as in Table 2.13.

Table 2.13: Mode control of a bidirectional shift register

S1 S0 Operation
0 0 Hold, no change
0 1 Shift right
1 0 Shift left
1 1 Parallel load

Example 2.7: Operating a bidirectional shift register

Problem: A 4-bit register holds 0110. Show the result of a shift left with serial input 0, and then a shift right with serial input 1.

Solution:

  1. Shift left: every bit moves one place to the left, the leftmost bit is lost and 0 enters on the right, giving 1100.
  2. Shift right: every bit moves one place to the right, the rightmost bit is lost and 1 enters on the left, giving 1110.

Result: The register contents are 1100 and then 1110. The first shift multiplies 6 by 2 to give 12.

r = [0, 1, 1, 0]
r = r[1:] + [0]
print("left ", r)
r = [1] + r[:-1]
print("right", r)

Output

left  [1, 1, 0, 0]
right [1, 1, 1, 0]

Common mistakes

  • Believing parallel load needs four clock pulses. All bits load on one pulse.
  • Forgetting that the serial input determines the bit that enters.
  • Assuming every shift keeps all the bits. One bit leaves the register at each shift.

Key takeaways

  • A register is a group of flip-flops with a common clock.
  • Parallel load copies all bits together; shifting moves them one place.
  • A left shift doubles a binary number, a right shift halves it.
  • Mode lines select hold, shift right, shift left or load.

Practice questions

  1. What is a register?
  2. What does a left shift do to a binary number?
  3. What do the mode lines S1 S0 = 11 select in the bidirectional register?

Answers to the practice questions

  1. A group of flip-flops sharing a clock that stores a binary word.
  2. It multiplies the number by 2.
  3. Parallel load.

Sources

  • Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit II