Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 2 — Applications of Flip-Flops: Latches, Registers and Shift Registers

Lesson 25 of 49 in the free Computer Organization and Architecture notes on Siksha Sarovar, written by Rohit Jangra.

Registers

A register is a group of n flip-flops sharing a common clock, storing an n-bit word. It is the fundamental storage unit inside a CPU — Unit III is built entirely on registers.

1. Simple 4-bit Register

   Four D flip-flops, common clock, common clear.
   On each clock edge:  A3A2A1A0  <-  I3I2I1I0

   IC 74175 is exactly this: quad D flip-flop with common clock and clear.

2. Register with Parallel Load

A plain register loads new data on every clock edge — usually undesirable. A load control fixes this.

   Method 1 (WRONG in synchronous design): gate the clock.
        CLK(FF) = CLK . LOAD
        -> creates clock skew and glitches. Never do this.

   Method 2 (CORRECT): feed the output back through a MUX.

        D(i) = LOAD . I(i)  +  LOAD' . Q(i)

        LOAD = 1  ->  new data loaded
        LOAD = 0  ->  the flip-flop reloads its own value (holds)

3. Shift Registers

A shift register moves its stored bits one position per clock, by connecting each flip-flop's output to the next one's input.

   Q0 -> Q1 -> Q2 -> Q3       (right shift)

   D0 = Serial In
   D1 = Q0
   D2 = Q1
   D3 = Q2
   Serial Out = Q3

The four types

TypeData inData outClocks needed to load / read
SISO Serial-In Serial-Out1 bit per clock1 bit per clockn to load, n to read
SIPO Serial-In Parallel-Out1 bit per clockall n at oncen to load, 1 to read
PISO Parallel-In Serial-Outall n at once1 bit per clock1 to load, n to read
PIPO Parallel-In Parallel-Outall n at onceall n at once1 to load, 1 to read

SISO worked trace

   Load 1011 serially (MSB first) into a 4-bit right-shift register.
   Initial state Q3Q2Q1Q0 = 0000.

   Clock | Serial In | Q0 Q1 Q2 Q3
   ------+-----------+------------
     0   |     -     | 0  0  0  0
     1   |     1     | 1  0  0  0
     2   |     0     | 0  1  0  0
     3   |     1     | 1  0  1  0
     4   |     1     | 1  1  0  1

   After 4 clocks the word is fully loaded. After 4 MORE clocks it emerges
   at the serial output, one bit per clock.

4. Universal Shift Register

A universal (bidirectional) shift register performs four operations selected by two control bits:

S1S0Operation
00Hold (no change)
01Shift right
10Shift left
11Parallel load
   Each stage uses a 4-to-1 MUX:

      I0 of the MUX = Q(i)          (hold)
      I1 of the MUX = Q(i+1)        (shift right)
      I2 of the MUX = Q(i-1)        (shift left)
      I3 of the MUX = parallel input I(i)

      D(i) = MUX output,  selects = S1 S0

   IC 74194 is a 4-bit universal shift register built exactly this way.

5. Shift Register Applications

ApplicationHow it works
Serial ↔ parallel conversionSIPO in a UART receiver, PISO in a transmitter
Multiplication / division by 2Left shift = ×2, right shift = ÷2 (arithmetic shift preserves the sign bit)
Delay lineAn n-stage SISO delays a serial stream by n clocks
Sequence generatorFeedback from Q outputs produces a repeating pattern
Ring counter / Johnson counterFeedback variants (next lesson)
LFSR (pseudo-random generator)XOR feedback of selected taps; used in CRC and scramblers
Data transfer between registersSerial transfer needs only one wire instead of n

Arithmetic vs logical shift

   Logical right shift of 1011:      0101   (0 shifted in)
   Arithmetic right shift of 1011:   1101   (sign bit replicated)

   For signed numbers, ONLY the arithmetic shift preserves the value:
      1011 = -5 (2's complement);  -5 / 2 = -2.5 -> -3 = 1101 ✓
      Logical shift would give 0101 = +5, which is wrong.

6. Latch vs Register vs Shift Register

LatchRegisterShift register
Bits stored1nn
ClockLevel (enable)EdgeEdge
Data movementNoneNoneOne position per clock
Typical useBus holding, temporary storageCPU registers, buffersSerial I/O, delays, counters

7. Serial vs Parallel Transfer Between Registers

   PARALLEL transfer: n wires, 1 clock, fast, expensive in wiring.
        R2 <- R1     happens in a single clock pulse.

   SERIAL transfer: 1 wire, n clocks, slow, cheap.
        Shift out of R1 and into R2 simultaneously, n times.
        Control: a shift-control signal ANDed with the clock enables
        exactly n pulses.

This distinction reappears in Unit III (bus transfer) and Unit IV (serial asynchronous communication).

Summary

   Register        = n flip-flops + common clock
   Parallel load   = MUX feedback (never gate the clock)
   Shift register  = each Q feeds the next D
   SISO SIPO PISO PIPO = the four data-movement combinations
   Universal SR    = 4:1 MUX per stage -> hold, shift L, shift R, load

The last Unit II lesson turns these same flip-flops into counters.