10 Shift Registers And Data Processing

Digital Logic ยท Unit 10

Shift Registers and Data Processing

Exam-focused notes for Shift Registers and Data Processing (Digital Logic, BIT103): what the TU syllabus asks and how it has actually been tested, with 11 solved past questions from this unit.

Shift Registers and Data Processing in short

A register is a group of flip-flops that stores a binary word. A shift register can also move the stored bits left or right. Registers hold data inside the processor, and the ALU and bus move and change that data.

Shift Registers and Data Processing: notes

Shift register types and operation

An $n$-bit shift register is a chain of $n$ flip-flops, usually D flip-flops. All share one clock. On each clock pulse every bit moves one place. There are four basic types, based on how data enters and leaves.

TypeData inData outUse
SISOSerialSerialDelay line
SIPOSerialParallelSerial to parallel conversion
PISOParallelSerialParallel to serial conversion
PIPOParallelParallelStorage register

A bidirectional shift register can shift left or right, controlled by a mode input. A universal shift register can do all of these: parallel load, shift left, shift right and hold. It uses a 4-to-1 multiplexer in front of each flip-flop to select the source.

Shifting a binary number left by one place multiplies it by 2. Shifting right divides it by 2. For example $0011$ (3) shifted left gives $0110$ (6).

Serial-in serial-out shift register

In a SISO register one bit enters at a time at the input of the first flip-flop. The output is taken from the last flip-flop. The data comes out after the same number of clock pulses.

Load the 4-bit number 1011 serially. The first bit sent is 1, then 0, 1, 1. The register starts as 0000, with outputs $Q_0Q_1Q_2Q_3$:

ClockSerial inputQ0 Q1 Q2 Q3
0-0 0 0 0
111 0 0 0
200 1 0 0
311 0 1 0
411 1 0 1

After 4 pulses the first bit sent sits at $Q_3$. Four more clock pulses push all bits out at $Q_3$, in the order 1, 0, 1, 1. So a 4-bit SISO register needs 4 clock pulses to load and 4 more to read. It is slow, but it needs only one data line in and one out.

Parallel-in parallel-out shift register

In a PIPO register, all bits are loaded together through parallel inputs. All bits are also available together at the outputs. There is no shifting. One clock pulse loads the full word.

Each flip-flop has its own data input, $D_0$ to $D_3$. On the clock edge, $Q_i = D_i$. A load or enable control decides whether the register loads new data or holds the old data.

A parallel-in serial-out (PISO) register has a control line to choose between loading and shifting. When the control is in load mode, the parallel word is loaded in one clock pulse. In shift mode, the bits are sent out one by one through the last flip-flop. This is how a computer sends a byte over a serial line. A serial-in parallel-out (SIPO) register does the reverse for receiving data.

The PIPO register is the fastest type, but needs the most input and output lines.

What this unit covers

  • Shift register types and operation
  • Serial-in serial-out shift register
  • Parallel-in parallel-out shift register
  • Shifter circuits
  • Parity generator and checker
  • Status register and processor registers
  • ALU and common bus architecture

Serial-in serial-out shift register

2081 ยท 5 marks

Define shift register. Explain the operation of 4-bit Serial-In Serial-Out Shift register with data input 1011. [1+4]

Show solved answer

Shift Register: Definition and 4-bit SISO Operation

Given

  • Register type: 4-bit Serial-In Serial-Out (SISO)
  • Number of flip-flops: 4
  • Data input: 1011
  • Marks distribution: 1 (definition) + 4 (operation)

No values missing. The entry convention (MSB-first vs LSB-first) is not specified; I will state the convention used explicitly.


Solution

Definition of Shift Register (1 mark)

A shift register is a sequential logic circuit made of a cascade of flip-flops (usually D flip-flops) connected in series, in which the stored data bits are shifted one position from one flip-flop to the next on every clock pulse. It is used for temporary storage of data and for serial/parallel data conversion.


4-bit SISO Shift Register (4 marks)

Circuit Description

Four D flip-flops are connected in cascade. The serial input feeds FF0; the output $Q$ of each flip-flop drives the $D$ input of the next; all flip-flops share a common clock. Data appears serially at $Q_3$.

Serial                                                    Serial
Input  -->[ FF0 ]-->[ FF1 ]-->[ FF2 ]-->[ FF3 ]--> Output
  D       Q0         Q1         Q2         Q3
                    CLK (common)

Entry convention (chosen): Data 1011 is entered MSB first, so bits enter in order 1, 0, 1, 1.


State Table (shift right, right-most bit entered first at FF0)

Shift direction. On each clock: new bit -> Q0, old Q0 -> Q1, old Q1 -> Q2, old Q2 -> Q3, old Q3 -> out.

ClockInput DQ0Q1Q2Q3Serial Out
Initial--0000--
1110000
2001000
3110100
4111011

Verification of shifting

  • Clock 1: D=1 -> Q0=1, rest 0. State = 1000 โœ“
  • Clock 2: D=0 -> Q0=0, old Q0(1)->Q1. State = 0100 โœ“
  • Clock 3: D=1 -> Q0=1, old Q0(0)->Q1, old Q1(1)->Q2. State = 1010 โœ“
  • Clock 4: D=1 -> Q0=1, old Q0(1)->Q1, old Q1(0)->Q2, old Q2(1)->Q3. State = 1101; the bit leaving Q3 is the old Q3, which is 0.

At the end of clock 4 the register holds the whole word, because the bit entered at clock 1 has been clocked through all four stages and now sits in Q3. Shifting it back out takes three further pulses, so a full load and unload of an n = 4 stage register takes 2n - 1 = 7 clock pulses in total.

Read-out phase (feeding 0s after loading):

ClockInputQ0Q1Q2Q3Serial Out
4 (loaded)11101--
5001101 (last bit out)
6000110
7000011
8000001 (first bit out)

So after loading in 4 pulses, the data is retrieved serially over the next 4 pulses. It is worth noting that at clock 4 the bit sitting at Q3 is the LSB-side bit that was loaded first, but the systematic read-out still requires clocks 5 to 8.


Key Characteristics

FeatureDescription
Data entry1 bit/clock (serial)
Data output1 bit/clock (serial)
Pulses to load 4 bits4
Pulses to read 4 bits4 more
Main useTime delay / data buffering

Final Result

The 4-bit SISO register loads 1011 in 4 clock pulses. Register state sequence: 0000 -> 1000 -> 0100 -> 1010 -> 1101. The stored data is then read out serially over the next 4 pulses. Note that "serial output = 1 at clock 4" is imprecise, since full retrieval needs clocks 5 to 8.

Open this answer on its own page โ†’

2079 ยท 5 marks

Draw a Serial-In Serial-Out Shift register and explain it. [5]

A Serial-In Serial-Out (SISO) shift register is a sequential logic circuit in which data is entered one bit at a time (serially) from one end and shifted out one bit at a time (serially) from the other end, synchronized by a clock signal. --- More precisely: - FF-0, FF-1, FF-2, FF-3: Four D Flip-...

Open this answer on its own page โ†’

Shifter circuits

2081 ยท 5 marks

Define shifter. Design a 4-bit shifter circuit. [1+4]

Show solved answer

Shifter: Definition and 4-bit Design


Definition of Shifter (1 mark)

A shifter is a combinational logic circuit that shifts the bits of a binary input word either to the left or to the right by one or more bit positions. It can also perform logical shift, arithmetic shift, or circular (rotate) operations depending on the control inputs.


Design of a 4-bit Shifter Circuit (4 marks)

Overview

A basic 4-bit combinational shifter accepts:

  • A 4-bit input: D3, D2, D1, D0 (D3 = MSB, D0 = LSB)
  • A control signal: S (shift direction)
    • S = 0 โ†’ Shift Left (each bit moves one position toward MSB; LSB filled with 0)
    • S = 1 โ†’ Shift Right (each bit moves one position toward LSB; MSB filled with 0)

Truth Table / Operation

SY3Y2Y1Y0Operation
0D2D1D00Shift Left by 1
10D3D2D1Shift Right by 1

Boolean Expressions for Each Output

Using a 2-to-1 MUX at each output bit:

$$Y_3 = \bar{S} \cdot D_2 + S \cdot 0 = \bar{S} \cdot D_2$$

$$Y_2 = \bar{S} \cdot D_1 + S \cdot D_3$$

$$Y_1 = \bar{S} \cdot D_0 + S \cdot D_2$$

$$Y_0 = \bar{S} \cdot 0 + S \cdot D_1 = S \cdot D_1$$


Circuit Diagram (Gate Level)

Each output bit is implemented using a 2-to-1 MUX (two AND gates + one OR gate):

D3 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                             AND โ”€โ”€โ”
S  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     |
                                   OR โ”€โ”€ Y2
Sฬ„  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     |
                             AND โ”€โ”€โ”˜
D1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

(Similar structure for Y3, Y1, Y0)

Complete structure:

         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚           4-bit Shifter                     โ”‚
         โ”‚                                             โ”‚
D3 โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€ [AND] โ”€โ”€(SยทD3)โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Y2      โ”‚
         โ”‚       โ†‘                                     โ”‚
         โ”‚       S                                     โ”‚
         โ”‚                                             โ”‚
D2 โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€ [AND] โ”€โ”€(Sฬ„ยทD2)โ”€โ”€[OR]โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Y3     โ”‚
         โ”‚                        โ†‘                   โ”‚
         โ”‚       0 โ”€โ”€[AND]โ”€โ”€(Sยท0)โ”€โ”˜                   โ”‚
         โ”‚                                             โ”‚
D1 โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€ [AND] โ”€โ”€(Sฬ„ยทD1)โ”€โ”€[OR]โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Y2     โ”‚
         โ”‚                        โ†‘                   โ”‚
         โ”‚    D3โ”€โ”€[AND]โ”€โ”€(SยทD3)โ”€โ”€โ”€โ”˜                   โ”‚
         โ”‚                                             โ”‚
D0 โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€ [AND] โ”€โ”€(Sฬ„ยทD0)โ”€โ”€[OR]โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Y1     โ”‚
         โ”‚                        โ†‘                   โ”‚
         โ”‚    D2โ”€โ”€[AND]โ”€โ”€(SยทD2)โ”€โ”€โ”€โ”˜                   โ”‚
         โ”‚                                             โ”‚
  0 โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€ [AND] โ”€โ”€(Sฬ„ยท0) โ”€โ”€[OR]โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Y0     โ”‚
         โ”‚                        โ†‘                   โ”‚
         โ”‚    D1โ”€โ”€[AND]โ”€โ”€(SยทD1)โ”€โ”€โ”€โ”˜                   โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary Table

OutputS=0 (Shift Left)S=1 (Shift Right)
Y3D20
Y2D1D3
Y1D0D2
Y00D1

Key Points

  • Each output bit uses one 2-to-1 MUX controlled by S.
  • Total: 4 MUX units (each built from 2 AND gates + 1 OR gate + 1 NOT gate shared).
  • The circuit is purely combinational (no clock or memory elements).
  • The vacated bit position is filled with logic 0 (logical shift).
Open this answer on its own page โ†’

Parallel-in parallel-out shift register

2080 ยท 5 marks

Explain the operation of 4-bit Parallel-In parallel-Out Shift register with data input 1010. [5]

  • Register type: 4-bit PIPO - Data input to load: $1010$ - Interpreting bits (MSB to LSB): $D3=1,\ D2=0,\ D1=1,\ D0=0$ --- A Parallel-In Parallel-Out (PIPO) shift register loads all data bits at the same time (parallel input) and makes all output bits available at the same time (parallel output)....
Open this answer on its own page โ†’

2078 ยท 5 marks

Draw a Parallel-In Parallel-Out Shift register and explain it. [5]

A Parallel-In Parallel-Out (PIPO) shift register is a type of shift register in which all data bits are loaded simultaneously (in parallel) into the register and all bits are also available at the output simultaneously (in parallel). It acts primarily as a temporary storage or buffer register. --...

Open this answer on its own page โ†’

Parity generator and checker

2080 ยท 5 marks

Write short notes on: (Any two) a.) ASCII Code b.)Logic micro operation c.) State table [5]

--- ASCII stands for American Standard Code for Information Interchange. - It is a 7-bit character encoding standard used to represent text in computers and communication devices. - A 7-bit ASCII code can represent 2โท = 128 different characters. - These characters include: - Uppercase letters (A-...

Open this answer on its own page โ†’

2077 ยท 5 marks

Write short notes on: a.) Parity generator b.) State Diagram [2.5+2.5]

Definition: A parity generator is a combinational logic circuit that generates a parity bit (either even or odd) to be appended to a binary data word for the purpose of error detection during data transmission. Working Principle: - The circuit takes n data bits as input and produces 1 parity bit ...

Open this answer on its own page โ†’

0 ยท 10 marks

Logic Gates Transmission Error Detection

The term LOGIC GATES is to be transmitted as 12 bytes of data. Each character in the term has an ASCII value. The system uses odd parity and the leftmost bit is used as parity bit. An additional parity byte is also sent after the term. The following bytes have arrived at their destination.

letters12345678
1L01001100
2O01001111
3G11000111
4I01001001
5C01000011
6โŸจspaceโŸฉ00100000
7G11000111
8A11000101
9T01010100
10E01000101
11S11010011
12Parity byte11010010

a. Locate which character contains an error.

b. Locate the bit that has been transmitted incorrectly.

c. Explain how you have arrived at your conclusion.

[10]

Show solved answer

Error Detection Using Two-Dimensional Parity (Odd Parity)

Given data

  • Message: "LOGIC GATES" transmitted as 12 bytes (11 characters + 1 parity byte).
  • Odd parity, leftmost bit = parity bit.
  • Received bit matrix (rows 1-11 = characters, row 12 = parity byte):
RowCharb1 b2 b3 b4 b5 b6 b7 b8
1L0 1 0 0 1 1 0 0
2O0 1 0 0 1 1 1 1
3G1 1 0 0 0 1 1 1
4I0 1 0 0 1 0 0 1
5C0 1 0 0 0 0 1 1
6space0 0 1 0 0 0 0 0
7G1 1 0 0 0 1 1 1
8A1 1 0 0 0 1 0 1
9T0 1 0 1 0 1 0 0
10E0 1 0 0 0 1 0 1
11S1 1 0 1 0 0 1 1
12Parity1 1 0 1 0 0 1 0

Step 1: Row parity check (each row must be ODD)

RowCharCount of 1sOdd?
1L3โœ“
2O5โœ“
3G5โœ“
4I3โœ“
5C3โœ“
6space1โœ“
7G5โœ“
8A4โœ— EVEN: fails
9T3โœ“
10E3โœ“
11S5โœ“
12Parity4(parity byte)

Row 8 (character 'A') fails: it has 4 ones (even), so it contains the error.

Step 2: Column parity check (each column must be ODD across rows 1-12)

ColBits (rows 1-12)CountOdd?
10,0,1,0,0,0,1,1,0,0,1,15โœ“
21,1,1,1,1,0,1,1,1,1,1,111โœ“
30,0,0,0,0,1,0,0,0,0,0,01โœ“
40,0,0,0,0,0,0,0,1,0,1,13โœ“
51,1,0,1,0,0,0,0,0,0,0,03โœ“
61,1,1,0,0,0,1,1,1,1,0,07โœ“
70,1,1,0,1,0,1,0,0,0,1,16โœ— EVEN: fails
80,1,1,1,1,0,1,1,0,1,1,08โœ— EVEN

Two columns (7 and 8) appear even, which conflicts with a single-bit error model. The consistent conclusion must come from combining the row and column tests.

Step 3: Resolving the location

A single-bit error causes exactly one row and exactly one column to fail. Row 8 is the unique failing row. Therefore the erroneous bit lies in row 8, and the failing column identifies the bit position.

Correcting the error must fix Row 8's parity (make it odd) AND fix the failing column simultaneously. Row 8 currently = 1 1 0 0 0 1 0 1 (four 1s). Flipping any single bit in row 8 makes it odd (5 or 3 ones).

Testing which flip also restores a single failing column to odd:

  • Column 7 has count 6 (even). Row 8, col 7 currently = 0. Flipping it to 1 makes column 7 count = 7 (odd โœ“), and row 8 count becomes 5 (odd โœ“).

So the correct transmitted bit was:

  • Row 8 (character 'A'), bit position 7 should be 1, but was received as 0.

Verifying 'A': ASCII 'A' = 1000001. With odd parity leftmost, total 1s must be odd. Correct byte 1 1 0 0 0 0 0 1 gives data 1000001 = 'A', parity bit chosen for odd count. The received byte with bit 7 = 0 corrupted the value.

Answers

a. Character in error: Row 8 โ†’ character 'A'.

b. Incorrectly transmitted bit: Bit position 7 of character 'A' (received as 0, should be 1).

c. Reasoning: Using two-dimensional odd parity, the received byte for 'A' has an even number of 1s (4), so it fails the row parity check, isolating the faulty byte to row 8. The intersecting column that also fails its odd-parity check points to the exact bit; the flip that simultaneously restores both the row's odd parity and the failing column's odd parity is bit 7. Hence the single erroneous bit is at (row 8, column 7).

Check both parities before deciding: column 6 already has an odd count (7) and is correct, so the bold bit there is not the faulty one. The bit that fails both checks is column 7, so the erroneous bit is (row 8, bit 7), received as 0 when it should be 1.

Open this answer on its own page โ†’

Status register and processor registers

2079 ยท 5 marks

Write short notes on: (Any two) a. BCD code b. Status Register c. Ring Counter [5]

--- BCD (Binary Coded Decimal) is a numeric code in which each decimal digit (0-9) is represented individually by its 4-bit binary equivalent. - Uses 4 bits per decimal digit - Only the combinations 0000 to 1001 are valid (representing 0-9) - Combinations 1010 to 1111 are invalid/forbidden in BCD...

Open this answer on its own page โ†’

2081.2 ยท 5 marks

Explain processor registers and ALU connection through common buses with a suitable diagram. [5]

Inside a processor, registers and the ALU (Arithmetic Logic Unit) must be interconnected so that data can flow between them efficiently. A common bus (or internal bus) is a shared set of wires/lines used to transfer data between multiple registers and the ALU within the CPU. --- Component Role --...

Open this answer on its own page โ†’

Shift register types and operation

2077 ยท 5 marks

Define shift register with its types. [5]

A shift register is a sequential logic circuit consisting of a cascade of flip-flops connected in series, where data is stored and shifted (moved) from one flip-flop to the next on each clock pulse. It is used for temporary data storage, data transfer, and serial-to-parallel or parallel-to-serial...

Open this answer on its own page โ†’