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.
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 answerHide 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.
| Clock | Input D | Q0 | Q1 | Q2 | Q3 | Serial Out |
|---|---|---|---|---|---|---|
| Initial | -- | 0 | 0 | 0 | 0 | -- |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 | 0 | 0 |
| 3 | 1 | 1 | 0 | 1 | 0 | 0 |
| 4 | 1 | 1 | 1 | 0 | 1 | 1 |
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):
| Clock | Input | Q0 | Q1 | Q2 | Q3 | Serial Out |
|---|---|---|---|---|---|---|
| 4 (loaded) | 1 | 1 | 1 | 0 | 1 | -- |
| 5 | 0 | 0 | 1 | 1 | 0 | 1 (last bit out) |
| 6 | 0 | 0 | 0 | 1 | 1 | 0 |
| 7 | 0 | 0 | 0 | 0 | 1 | 1 |
| 8 | 0 | 0 | 0 | 0 | 0 | 1 (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
| Feature | Description |
|---|---|
| Data entry | 1 bit/clock (serial) |
| Data output | 1 bit/clock (serial) |
| Pulses to load 4 bits | 4 |
| Pulses to read 4 bits | 4 more |
| Main use | Time 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.
2079 ยท 5 marks
Draw a Serial-In Serial-Out Shift register and explain it. [5]
Shifter circuits
2081 ยท 5 marks
Define shifter. Design a 4-bit shifter circuit. [1+4]
Show solved answerHide 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
| S | Y3 | Y2 | Y1 | Y0 | Operation |
|---|---|---|---|---|---|
| 0 | D2 | D1 | D0 | 0 | Shift Left by 1 |
| 1 | 0 | D3 | D2 | D1 | Shift 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
| Output | S=0 (Shift Left) | S=1 (Shift Right) |
|---|---|---|
| Y3 | D2 | 0 |
| Y2 | D1 | D3 |
| Y1 | D0 | D2 |
| Y0 | 0 | D1 |
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).
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]
2078 ยท 5 marks
Draw a Parallel-In Parallel-Out Shift register and explain it. [5]
Parity generator and checker
2080 ยท 5 marks
Write short notes on: (Any two) a.) ASCII Code b.)Logic micro operation c.) State table [5]
2077 ยท 5 marks
Write short notes on: a.) Parity generator b.) State Diagram [2.5+2.5]
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.
| letters | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | L | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| 2 | O | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 |
| 3 | G | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 4 | I | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 5 | C | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
| 6 | โจspaceโฉ | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 7 | G | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 8 | A | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 9 | T | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
| 10 | E | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 11 | S | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 12 | Parity byte | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
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 answerHide 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):
| Row | Char | b1 b2 b3 b4 b5 b6 b7 b8 |
|---|---|---|
| 1 | L | 0 1 0 0 1 1 0 0 |
| 2 | O | 0 1 0 0 1 1 1 1 |
| 3 | G | 1 1 0 0 0 1 1 1 |
| 4 | I | 0 1 0 0 1 0 0 1 |
| 5 | C | 0 1 0 0 0 0 1 1 |
| 6 | space | 0 0 1 0 0 0 0 0 |
| 7 | G | 1 1 0 0 0 1 1 1 |
| 8 | A | 1 1 0 0 0 1 0 1 |
| 9 | T | 0 1 0 1 0 1 0 0 |
| 10 | E | 0 1 0 0 0 1 0 1 |
| 11 | S | 1 1 0 1 0 0 1 1 |
| 12 | Parity | 1 1 0 1 0 0 1 0 |
Step 1: Row parity check (each row must be ODD)
| Row | Char | Count of 1s | Odd? |
|---|---|---|---|
| 1 | L | 3 | โ |
| 2 | O | 5 | โ |
| 3 | G | 5 | โ |
| 4 | I | 3 | โ |
| 5 | C | 3 | โ |
| 6 | space | 1 | โ |
| 7 | G | 5 | โ |
| 8 | A | 4 | โ EVEN: fails |
| 9 | T | 3 | โ |
| 10 | E | 3 | โ |
| 11 | S | 5 | โ |
| 12 | Parity | 4 | (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)
| Col | Bits (rows 1-12) | Count | Odd? |
|---|---|---|---|
| 1 | 0,0,1,0,0,0,1,1,0,0,1,1 | 5 | โ |
| 2 | 1,1,1,1,1,0,1,1,1,1,1,1 | 11 | โ |
| 3 | 0,0,0,0,0,1,0,0,0,0,0,0 | 1 | โ |
| 4 | 0,0,0,0,0,0,0,0,1,0,1,1 | 3 | โ |
| 5 | 1,1,0,1,0,0,0,0,0,0,0,0 | 3 | โ |
| 6 | 1,1,1,0,0,0,1,1,1,1,0,0 | 7 | โ |
| 7 | 0,1,1,0,1,0,1,0,0,0,1,1 | 6 | โ EVEN: fails |
| 8 | 0,1,1,1,1,0,1,1,0,1,1,0 | 8 | โ 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.
Status register and processor registers
2079 ยท 5 marks
Write short notes on: (Any two) a. BCD code b. Status Register c. Ring Counter [5]
2081.2 ยท 5 marks
Explain processor registers and ALU connection through common buses with a suitable diagram. [5]
Shift register types and operation
Make Unit 10 stick
Practice BIT103 with flashcards & quizzes