Computer Organization & Architecture
Unit 2: Register Transfer & Micro Operations
From flip-flop arrays to ALU internals โ master register transfers, micro operations, bus systems, and build a working shift-register simulator.
โฑ๏ธ 5 hrs theory + 3 hrs lab | ๐ฏ GATE ~3 marks | ๐ฅ๏ธ Intel Core i9 Registers
Opening Hook โ The Registers Inside Your Processor
๐ฅ๏ธ Intel Core i9 โ 32 General-Purpose Registers Running at 6 GHz
Right now, inside your laptop or desktop, the Intel Core i9 processor has 32 general-purpose registers, each 64 bits wide. Every single instruction your computer executes โ opening Chrome, playing a video, compiling code โ involves data moving between these registers at speeds exceeding 6 billion cycles per second.
When you type a = b + c in C, the compiler translates it into register-level operations: Load b into R1, Load c into R2, ADD R1+R2โR3, Store R3 to memory. These tiny operations โ called micro operations โ are the atomic building blocks of everything a CPU does.
Understanding register transfers and micro operations is understanding how a processor actually thinks. This chapter teaches you the exact language (RTL โ Register Transfer Language) that hardware designers at Intel, AMD, and Qualcomm use to describe what happens inside a chip โ one clock pulse at a time.
Learning Outcomes โ Bloom's Taxonomy Mapped
| Bloom's Level | Learning Outcome |
|---|---|
| ๐ต Remember | Define register, register transfer, and list all RTL notation symbols with their meanings |
| ๐ต Remember | State the four types of micro operations: register transfer, arithmetic, logic, and shift |
| ๐ต Understand | Explain how a common bus system uses multiplexers to connect multiple registers to a shared data path |
| ๐ต Understand | Describe memory read and memory write operations using RTL notation (DRโM[AR], M[AR]โDR) |
| ๐ข Apply | Trace the step-by-step execution of conditional register transfers with timing diagrams |
| ๐ข Apply | Perform selective-set, selective-clear, selective-complement, and insert operations on binary data |
| ๐ข Analyze | Compare logical, circular, and arithmetic shift operations and predict the output for any 8-bit input |
| ๐ข Analyze | Differentiate SISO, SIPO, PISO, and PIPO shift registers by data flow and application |
| ๐ Evaluate | Determine the correct ALSU function-select code (SโSโSโSโ) for a given micro operation |
| ๐ Evaluate | Justify why bus-based architecture is preferred over direct register-to-register connections in CPU design |
| ๐ Create | Write a Python simulator for an 8-bit shift register supporting all shift types |
| ๐ Create | Design a complete ALSU operation table mapping function-select bits to arithmetic, logic, and shift outputs |
Concept Explanation โ Register Transfer & Micro Operations from Scratch
1. Register โ The CPU's Scratchpad
A register is a group of flip-flops (bistable circuits) that stores binary information. Each flip-flop stores one bit. An n-bit register has n flip-flops and can store any value from 0 to 2โฟโ1.
Analogy: Think of a register like a row of light switches. Each switch is either ON (1) or OFF (0). A 16-bit register is like 16 switches lined up โ together they represent a 16-bit binary number.
๐ 16-Bit Register with Parallel Load
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ 16-BIT PARALLEL LOAD REGISTER โ โ โ โ Input: Iโโ Iโโ Iโโ Iโโ Iโโ Iโโ Iโ Iโ Iโ Iโ Iโ Iโ Iโ Iโ Iโ Iโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โ โ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ LOADโโโถโFFโ โFFโ โFFโ โFFโ โFFโ โFFโ โFFโโFFโโFFโโFFโโFFโโFFโโFFโโFFโโFFโโFFโโ โ โ15โ โ14โ โ13โ โ12โ โ11โ โ10โ โ 9โโ 8โโ 7โโ 6โโ 5โโ 4โโ 3โโ 2โโ 1โโ 0โโ โ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ CLKโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โผ โ โ Output: Qโโ Qโโ Qโโ Qโโ Qโโ Qโโ Qโ Qโ Qโ Qโ Qโ Qโ Qโ Qโ Qโ Qโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Key Signals: โข LOAD = 1 โ On next CLK edge, inputs (Iโโ ...Iโ) are loaded into register โข LOAD = 0 โ Register retains its current value (no change) โข CLK โ All flip-flops are triggered simultaneously (parallel load)
How it works: When LOAD = 1, on the rising edge of CLK, all 16 input bits are simultaneously captured by the 16 flip-flops. When LOAD = 0, the register holds its previous value โ this is the "memory" property. The outputs Qโโ โฆQโ always reflect the currently stored value.
2. Register Transfer โ Moving Data Between Registers
A register transfer operation copies the contents of one register into another. It is the most fundamental operation inside a CPU.
๐ Register Transfer: R2 โ R1
โโโโโโโโโโโโโ โโโโโโโโโโโโโ
โ โ n-bit data bus โ โ
โ R1 โ โโโโโโโโโโโโโโโโโโโโโโโโถ โ R2 โ
โ (Source) โ Qโโ
...Qโ of R1 โ (Dest) โ
โ โ โ โ
โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโ CLK (shared) โโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
RTL Statement: R2 โ R1
Meaning: Copy the contents of R1 into R2.
R1 is NOT modified (source is read, not erased).
Transfer happens on the clock edge.
Conditional Register Transfer
โโโโโโโ
P โโโโโถโ AND โโโโโ LOAD input of R2
CLK โโโถโ โ
โโโโโโโ
RTL Statement: P: R2 โ R1
Meaning: IF control signal P = 1,
THEN on the next clock edge, R2 gets the value of R1.
IF P = 0, R2 remains unchanged.
Timing Diagram:
CLK: โโ โโโโ โโโโ โโโโ โโโ
โโโโ โโโโ โโโโ โโโโ
P: โโโโโโ โโโโโโโโโโโ
โโโโโโโโโโโโโ
R2: [old] [old] [R1] [R1] [R1]
โฒ
Transfer occurs here (P=1 at CLK edge)
3. RTL (Register Transfer Language) Notation
RTL is a symbolic notation to describe micro operations precisely. It's the "assembly language" of hardware design.
RTL Notation Rules
| Rule | Description | Example |
|---|---|---|
| Registers | Denoted by uppercase letters with optional numbers | R1, R2, AR, DR, AC, PC |
| Arrow โ | Denotes transfer (destination โ source) | R2 โ R1 |
| Comma , | Separates simultaneous operations | R1 โ R2, R3 โ R4 |
| Colon : | Separates condition from operation | P: R2 โ R1 |
| Parentheses () | Denote specific bits of a register | R1(0-7) = lower 8 bits |
| Brackets [] | Denote memory word address | M[AR] = memory at address AR |
RTL Operation Examples
| # | RTL Statement | Meaning | Type |
|---|---|---|---|
| 1 | R2 โ R1 | Copy R1 into R2 | Transfer |
| 2 | P: R2 โ R1 | If P=1, copy R1 into R2 | Conditional Transfer |
| 3 | R1 โ R1 + R2 | Add R1 and R2, store in R1 | Arithmetic |
| 4 | R3 โ R1 + Rฬ2 + 1 | Subtract: R3 โ R1 โ R2 (2's complement) | Arithmetic |
| 5 | R1 โ R1 โง R2 | Bitwise AND of R1 and R2 | Logic |
| 6 | R1 โ R1 โจ R2 | Bitwise OR of R1 and R2 | Logic |
| 7 | R1 โ R1 โ R2 | Bitwise XOR of R1 and R2 | Logic |
| 8 | R1 โ Rฬ1 | Complement (NOT) all bits of R1 | Logic |
| 9 | R1 โ shl R1 | Shift R1 left by 1 bit | Shift |
| 10 | R1 โ shr R1 | Shift R1 right by 1 bit | Shift |
| 11 | DR โ M[AR] | Memory read: load memory word at address AR into DR | Memory |
| 12 | M[AR] โ DR | Memory write: store DR into memory at address AR | Memory |
| 13 | R1 โ R2, R3 โ R4 | Simultaneous: copy R2โR1 AND R4โR3 in same clock | Parallel Transfer |
4. Bus & Memory Transfer โ The Shared Highway
Problem: If you have 8 registers and each can transfer to any other, you need 8ร7 = 56 direct connections. That's a wiring nightmare!
Solution: Use a common bus โ a shared set of wires that any register can place data on, and any register can read from, but only one at a time.
๐ Common Bus System โ 3 Registers + ALU via MUX
R1 (n bits) R2 (n bits) R3 (n bits)
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ โ โ โ โ โ
โ Qโ...Qโ โ โ Qโ...Qโ โ โ Qโ...Qโ โ
โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ n-bit MUX (n:1) โ
โ โ
โ Sโ Sโ (select lines) โ SโSโ = 00 โ R1 on bus
โ โโฌโโโฌโ โ SโSโ = 01 โ R2 on bus
โ โ โ โ SโSโ = 10 โ R3 on bus
โโโโโโผโโโผโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โผ
โ โ โโโโโโโโโโโโโโโโโโโโ โ COMMON BUS (n bits wide)
โ โ โ
โ โ โโโโโโดโโโโโ
โ โ โ โ
โผ โผ โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โ ALU โ โ Any Reg โ
โ โ โ (LOAD=1) โ
โโโโโโโโโโโโ โโโโโโโโโโโโ
Operation Example: R3 โ R1 + R2
Step 1: SโSโ = 00 โ R1 placed on bus โ ALU input A
Step 2: SโSโ = 01 โ R2 placed on bus โ ALU input B
Step 3: ALU performs ADD โ result placed on bus
Step 4: R3 LOAD = 1 โ R3 captures result from bus on CLK edge
Memory Read & Write Operations
๐ Memory Transfer Operations
MEMORY READ: DR โ M[AR]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ AR โโโโโโโโโโถโ MEMORY โ
โ (Address โ addr โ โ
โ Register)โ bus โ Address Decoder โ
โโโโโโโโโโโโ โ โ โ
โ โโโโโโผโโโโโ โ
โ โ Cell at โ โ
โโโโโโโโโโโโ โ โ AR addr โ โ
โ DR โโโโโโโโโโโ โโโโโโฌโโโโโ โ
โ (Data โ data โ โ โ
โ Register)โ bus โ data out โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
Control: READ = 1
Result: DR gets the word stored at memory address AR
MEMORY WRITE: M[AR] โ DR
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ AR โโโโโโโโโโถโ MEMORY โ
โ (Address โ addr โ โ
โ Register)โ bus โ Address Decoder โ
โโโโโโโโโโโโ โ โ โ
โ โโโโโโผโโโโโ โ
โโโโโโโโโโโโ โ โ Cell at โ โ
โ DR โโโโโโโโโโถโ โ AR addr โ โ
โ (Data โ data โ โโโโโโโโโโโ โ
โ Register)โ bus โ โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
Control: WRITE = 1
Result: The word in DR is written into memory at address AR
5. Logic Micro Operations
Logic micro operations perform bit-by-bit (bitwise) operations on data stored in registers. These do NOT consider carry or sign โ each bit is processed independently.
Truth Tables for Basic Logic Operations
| A | B | A โง B (AND) | A โจ B (OR) | A โ B (XOR) | ฤ (Complement) |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Selective Operations โ Practical Applications
๐ Selective Set, Clear, Complement & Insert
Selective Set (using OR)
Set specific bits to 1 without disturbing others. OR with a mask where 1 = set that bit.
R1 = 1 0 1 0 0 1 1 0 (original) Mask = 0 0 0 0 1 1 0 0 (set bits 2,3) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ R1โจMask= 1 0 1 0 1 1 1 0 (bits 2,3 are now 1, others unchanged) RTL: R1 โ R1 โจ B (B is the mask register)
Selective Clear (using AND with complement)
Clear specific bits to 0 without disturbing others. AND with complement of mask.
R1 = 1 0 1 0 1 1 1 0 (original) Mask = 0 0 0 0 1 1 0 0 (clear bits 2,3) Bฬ = 1 1 1 1 0 0 1 1 (complement of mask) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ R1 โง Bฬ = 1 0 1 0 0 0 1 0 (bits 2,3 are now 0, others unchanged) RTL: R1 โ R1 โง Bฬ
Selective Complement (using XOR)
Toggle specific bits. XOR with a mask where 1 = toggle that bit.
R1 = 1 0 1 0 1 1 1 0 (original) Mask = 0 0 0 0 1 1 0 0 (toggle bits 2,3) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ R1โMask = 1 0 1 0 0 0 1 0 (bits 2,3 are toggled, others unchanged) RTL: R1 โ R1 โ B
Insert Operation (Clear then Set)
Replace specific bits with new values. First CLEAR the target bits, then OR with new values.
R1 = 1 0 1 0 1 1 1 0 (original โ want to insert 01 at bits 2,3)
Step 1 โ Clear bits 2,3:
Mask = 0 0 0 0 1 1 0 0
Bฬ = 1 1 1 1 0 0 1 1
R1โงBฬ = 1 0 1 0 0 0 1 0 (bits 2,3 cleared)
Step 2 โ Insert new value 01 at bits 2,3:
New = 0 0 0 0 0 1 0 0 (01 positioned at bits 2,3)
Result = 1 0 1 0 0 1 1 0 (bits 2,3 = 01, others unchanged)
RTL: R1 โ (R1 โง Bฬ) โจ New
6. Shift Register Types โ SISO, SIPO, PISO, PIPO
A shift register is a group of flip-flops connected in a chain, where each flip-flop passes its output to the next on every clock pulse. The type depends on how data enters and exits:
| Type | Full Name | Input | Output | Application |
|---|---|---|---|---|
| SISO | Serial In Serial Out | 1 bit at a time | 1 bit at a time | Delay lines, time delay |
| SIPO | Serial In Parallel Out | 1 bit at a time | All bits together | Serial-to-parallel conversion |
| PISO | Parallel In Serial Out | All bits together | 1 bit at a time | Parallel-to-serial conversion |
| PIPO | Parallel In Parallel Out | All bits together | All bits together | Buffer register, temporary storage |
๐ 4-Bit Shift Register Types โ ASCII Diagrams
SISO โ Serial In, Serial Out
Data In (1 bit) โโโถ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโถ Data Out (1 bit)
โ FFโ โโโโถโ FFโ โโโโถโ FFโ โโโโถโ FFโ โ
CLK โโโถโโโโโโ โโโโโโ โโโโโโ โโโโโโ
Data flow: Input โ FFโ โ FFโ โ FFโ โ FFโ โ Output
Takes 4 clock cycles to load/read 4 bits.
Example: Input sequence 1,0,1,1 (one bit per clock)
CLK 1: [1] [0] [0] [0] โ 1 enters FFโ
CLK 2: [0] [1] [0] [0] โ 0 enters, 1 shifts right
CLK 3: [1] [0] [1] [0] โ 1 enters, others shift
CLK 4: [1] [1] [0] [1] โ 1 enters, first bit exits FFโ
SIPO โ Serial In, Parallel Out
Data In (1 bit) โโโถ โโโโโโ โโโโโโ โโโโโโ โโโโโโ
โ FFโ โโโโถโ FFโ โโโโถโ FFโ โโโโถโ FFโ โ
CLK โโโถโโโโฌโโ โโโโฌโโ โโโโฌโโ โโโโฌโโ
โ โ โ โ
โผ โผ โผ โผ
Qโ Qโ Qโ Qโ (Parallel Output)
Usage: Convert serial data (UART) to parallel (CPU bus)
PISO โ Parallel In, Serial Out
Dโ Dโ Dโ Dโ (Parallel Input) โ โ โ โ โผ โผ โผ โผ โโโโโโ โโโโโโ โโโโโโ โโโโโโ โโโถ Data Out (1 bit) โ FFโ โโโโถโ FFโ โโโโถโ FFโ โโโโถโ FFโ โ โโโโโโ โโโโโโ โโโโโโ โโโโโโ LOAD/SHIFT โโโโโโโโโโโโโโโโโโโโโโโ Mode 1 (LOAD=1): All 4 bits loaded simultaneously Mode 2 (SHIFT=1): Bits shift right, one exits per clock Usage: Convert parallel data (CPU bus) to serial (USB/UART)
PIPO โ Parallel In, Parallel Out
Dโ Dโ Dโ Dโ (Parallel Input)
โ โ โ โ
โผ โผ โผ โผ
โโโโโโ โโโโโโ โโโโโโ โโโโโโ
โ FFโ โ โ FFโ โ โ FFโ โ โ FFโ โ
โโโโฌโโ โโโโฌโโ โโโโฌโโ โโโโฌโโ
โ โ โ โ
โผ โผ โผ โผ
Qโ Qโ Qโ Qโ (Parallel Output)
LOAD โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Usage: Buffer/temporary register, pipeline stage
7. Shift Micro Operations
Shift micro operations move bits within a register left or right. There are three types:
| Shift Type | Direction | What Happens | Vacated Bit | Use Case |
|---|---|---|---|---|
| Logical Shift Left | โ | All bits move left by 1 | LSB = 0 | Multiply by 2 |
| Logical Shift Right | โ | All bits move right by 1 | MSB = 0 | Unsigned divide by 2 |
| Circular Shift Left | โ (rotate) | All bits rotate left | LSB = old MSB | Cryptography, CRC |
| Circular Shift Right | โ (rotate) | All bits rotate right | MSB = old LSB | Bit pattern rotation |
| Arithmetic Shift Right | โ | All bits move right | MSB = old MSB (sign preserved) | Signed divide by 2 |
8-Bit Shift Trace Table
๐ Before/After Trace โ All 5 Shift Types on 10110011
| Operation | Before (8 bits) | After (8 bits) | Notes |
|---|---|---|---|
| Logical Shift Left | 1 0 1 1 0 0 1 1 | 0 1 1 0 0 1 1 0 | MSB (1) lost, LSB = 0 |
| Logical Shift Right | 1 0 1 1 0 0 1 1 | 0 1 0 1 1 0 0 1 | LSB (1) lost, MSB = 0 |
| Circular Shift Left | 1 0 1 1 0 0 1 1 | 0 1 1 0 0 1 1 1 | MSB (1) wraps to LSB |
| Circular Shift Right | 1 0 1 1 0 0 1 1 | 1 1 0 1 1 0 0 1 | LSB (1) wraps to MSB |
| Arithmetic Shift Right | 1 0 1 1 0 0 1 1 | 1 1 0 1 1 0 0 1 | MSB (sign=1) preserved, LSB lost |
Logical Shift Left: [1 0 1 1 0 0 1 1] โ โshiftโ โ [0 1 1 0 0 1 1 0]
โ lost โ zero fill
Logical Shift Right: [1 0 1 1 0 0 1 1] โ โshiftโ โ [0 1 0 1 1 0 0 1]
zero fill โ โ lost
Circular Shift Left: [1 0 1 1 0 0 1 1] โ โrotateโ โ [0 1 1 0 0 1 1 1]
โโโโโโโโwraps aroundโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Circular Shift Right: [1 0 1 1 0 0 1 1] โ โrotateโ โ [1 1 0 1 1 0 0 1]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโwraps aroundโโโโโโโ
Arithmetic Shift Right:[1 0 1 1 0 0 1 1] โ โshiftโ โ [1 1 0 1 1 0 0 1]
sign bit preserved โ โ lost
8. Arithmetic Logic Shift Unit (ALSU) โ Complete Block Diagram
The ALSU (Arithmetic Logic Shift Unit) is the central processing component of any CPU. It combines three sub-units โ arithmetic, logic, and shift โ controlled by function-select lines.
๐ ALSU Complete Block Diagram
A (n bits) B (n bits)
โ โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ โ โ โ
โ โโโโโโโโดโโโโโโโ โโโโโโโโดโโโโโโโ โ
โ โ โ โ โ โ
โ โผ โผ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ ARITHMETIC UNIT โ โ LOGIC UNIT โ โ
โ โ โ โ โ โ
โ โ Operations: โ โ Operations: โ โ
โ โ โข Add (A + B) โ โ โข A โง B (AND) โ โ
โ โ โข Subtract โ โ โข A โจ B (OR) โ โ
โ โ (A + Bฬ + 1) โ โ โข A โ B (XOR) โ โ
โ โ โข Increment (A+1) โ โ โข ฤ (NOT) โ โ
โ โ โข Decrement (Aโ1) โ โ โ โ
โ โ โข Transfer (A) โ โ โ โ
โ โโโโโโโโโโฌโโโโโโโโโโโโ โโโโโโโโโฌโโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 4ร1 MUX โ โ
โ โ โ โ
โ โ Inputs: Arith | Logic | Shift | (rsv) โ โ
โ โ โ โ
โ โ Sโ Sโ (Unit Select) โ โ
โ โ โโฌโโโฌโ โ โ
โ โโโโโโโโโโโโผโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโดโโโดโโโโโโโ โ โ
โ โ โ โ โ
โ โผ โ โ โ
โ โโโโโโโโโโโโโโโโโโ โ โ โ
A (n bits) โโโโโโโถ SHIFT UNIT โ โ โ โ
โ โ โ โ โ โ
โ โ Operations: โ โ โ โ
โ โ โข Shift Left โโโโโ โ โ
โ โ โข Shift Right โ โ โ
โ โ โข Rotate L/R โ โ โ
โ โ โข Arith Shr โ โ โ
โ โโโโโโโโโโโโโโโโโโ โ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ OUTPUT F โ โ
โ โ (n bits) โ โ
โ โโโโโโโโโโโโโโโโ โ
โ โ
โ SโSโ = Unit Select SโSโ = Op Select โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ 00 = Arithmetic Selects which โ
โ 01 = Logic operation within โ
โ 10 = Shift the selected unit โ
โ 11 = Reserved โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Function Select Lines: Sโ Sโ Sโ Sโ + Cแตขโ (carry in)
ALSU Operation Table
| Sโ | Sโ | Sโ | Sโ | Cแตขโ | Operation | Function | Type |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | F = A | Transfer A | Arithmetic |
| 0 | 0 | 0 | 0 | 1 | F = A + 1 | Increment A | Arithmetic |
| 0 | 0 | 0 | 1 | 0 | F = A + B | Addition | Arithmetic |
| 0 | 0 | 0 | 1 | 1 | F = A + B + 1 | Add with carry | Arithmetic |
| 0 | 0 | 1 | 0 | 0 | F = A + Bฬ | A plus 1's comp B | Arithmetic |
| 0 | 0 | 1 | 0 | 1 | F = A + Bฬ + 1 | Subtraction (A โ B) | Arithmetic |
| 0 | 0 | 1 | 1 | 0 | F = A โ 1 | Decrement A | Arithmetic |
| 0 | 0 | 1 | 1 | 1 | F = A | Transfer A | Arithmetic |
| 0 | 1 | 0 | 0 | ร | F = A โง B | AND | Logic |
| 0 | 1 | 0 | 1 | ร | F = A โจ B | OR | Logic |
| 0 | 1 | 1 | 0 | ร | F = A โ B | XOR | Logic |
| 0 | 1 | 1 | 1 | ร | F = ฤ | Complement A | Logic |
| 1 | 0 | 0 | 0 | ร | F = shl A | Logical Shift Left | Shift |
| 1 | 0 | 0 | 1 | ร | F = shr A | Logical Shift Right | Shift |
| 1 | 0 | 1 | 0 | ร | F = cil A | Circular Shift Left | Shift |
| 1 | 0 | 1 | 1 | ร | F = cir A | Circular Shift Right | Shift |
Learn by Doing โ 3-Tier Lab Structure
๐ข Tier 1 โ GUIDED: RTL Trace Exercise
Problem: Trace the following RTL sequence
Given initial values: R1 = 1010 0110, R2 = 0011 1100, R3 = 0000 0000. Trace each step:
Step 1: R3 โ R1 (Transfer) Step 2: R1 โ R1 โง R2 (AND) Step 3: R2 โ R2 โจ R3 (OR) Step 4: R3 โ R1 โ R2 (XOR)
Solution Trace:
| Step | Operation | R1 | R2 | R3 |
|---|---|---|---|---|
| Initial | โ | 1010 0110 | 0011 1100 | 0000 0000 |
| 1 | R3 โ R1 | 1010 0110 | 0011 1100 | 1010 0110 |
| 2 | R1 โ R1 โง R2 | 0010 0100 | 0011 1100 | 1010 0110 |
| 3 | R2 โ R2 โจ R3 | 0010 0100 | 1011 1110 | 1010 0110 |
| 4 | R3 โ R1 โ R2 | 0010 0100 | 1011 1110 | 1001 1010 |
๐ก Tier 2 โ SEMI-GUIDED: Shift Operations Drill
Exercise: Complete the shift table
Given the 8-bit value: 11001010 (decimal โ54 signed, 202 unsigned)
| Operation | Input | Your Answer | Decimal (unsigned) |
|---|---|---|---|
| Logical Shift Left ร1 | 11001010 | 10010100 | 148 |
| Logical Shift Right ร1 | 11001010 | 01100101 | 101 |
| Logical Shift Left ร2 | 11001010 | 00101000 | 40 |
| Circular Shift Left ร1 | 11001010 | 10010101 | 149 |
| Circular Shift Right ร1 | 11001010 | 01100101 | 101 |
| Arithmetic Shift Right ร1 | 11001010 | 11100101 | โ27 (signed) |
| Arithmetic Shift Right ร2 | 11001010 | 11110010 | โ14 (signed) |
๐ด Tier 3 โ OPEN CHALLENGE: Python 8-Bit Shift Register Simulator
Your Mission: Build a Complete Shift Register Simulator in Python
Create a program that simulates an 8-bit register with all micro operations.
Python class ShiftRegister: def __init__(self, value=0): # Store as 8-bit integer (0-255) self.value = value & 0xFF self.size = 8 def display(self): binary = format(self.value, '08b') print(f" Register: [{binary}] (Dec: {self.value}, Hex: 0x{self.value:02X})") def logical_shift_left(self): # All bits shift left, LSB = 0, MSB is lost self.value = (self.value << 1) & 0xFF def logical_shift_right(self): # All bits shift right, MSB = 0, LSB is lost self.value = (self.value >> 1) & 0x7F def circular_shift_left(self): # MSB wraps to LSB msb = (self.value >> 7) & 1 self.value = ((self.value << 1) | msb) & 0xFF def circular_shift_right(self): # LSB wraps to MSB lsb = self.value & 1 self.value = ((self.value >> 1) | (lsb << 7)) & 0xFF def arithmetic_shift_right(self): # Sign bit preserved, LSB is lost sign = self.value & 0x80 self.value = ((self.value >> 1) | sign) & 0xFF # === Test the simulator === reg = ShiftRegister(0b10110011) print("Original:") reg.display() reg.logical_shift_left() print("After Logical Shift Left:") reg.display()
โข Add AND, OR, XOR operations with a second register
โข Implement the selective set/clear/complement/insert operations
โข Build an interactive menu that lets users choose operations
โข Add ALSU function-select: user enters SโSโSโSโ and Cแตขโ โ output result
Problem Bank โ Diagram, Numerical, Industry & GATE
๐ Diagram-Based Problems (3)
Draw a 4-bit common bus system using 4ร1 MUX connecting four registers R0, R1, R2, R3. Label select lines SโSโ and show which register is placed on bus for each select combination.
R0 R1 R2 R3
โ โ โ โ
โโโโฌโโโ โโโโ โ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ 4ร1 MUX โ
โ SโSโ = 00 โ R0 โ
โ SโSโ = 01 โ R1 โ
โ SโSโ = 10 โ R2 โ
โ SโSโ = 11 โ R3 โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
COMMON BUS
Each MUX is n-bits wide (one MUX per bit position). For n-bit registers, we need n separate 4ร1 MUX circuits.
Draw the block diagram of a 4-bit SIPO shift register. Show the serial input, all 4 flip-flops, clock, and parallel outputs QโQโQโQโ. Trace the loading of the value 1011 over 4 clock cycles.
Serial In โ [FFโ] โ [FFโ] โ [FFโ] โ [FFโ]
โ โ โ โ
Qโ Qโ Qโ Qโ
CLK 1: Input=1 โ [1][0][0][0]
CLK 2: Input=0 โ [0][1][0][0]
CLK 3: Input=1 โ [1][0][1][0]
CLK 4: Input=1 โ [1][1][0][1]
After 4 clocks: QโQโQโQโ = 1101 (reversed input order)
Note: The first bit entered (1) ends up at Qโ, and the last bit (1) at Qโ.
Draw the complete ALSU block diagram showing arithmetic unit, logic unit, shift unit, MUX selector, and function-select lines SโSโSโSโ. Label all inputs (A, B, Cแตขโ) and output F.
๐ข Numerical Problems (6)
Given R1 = 10101100 and R2 = 11001010, compute: (a) R1 โง R2 (b) R1 โจ R2 (c) R1 โ R2 (d) Rฬ1
(b) R1 โจ R2 = 11101110
(c) R1 โ R2 = 01100110
(d) Rฬ1 = 01010011
Perform selective set on R = 10100011 to set bits 4 and 5 to 1 (without changing other bits). Show the mask and result.
R โจ Mask = 10110011 โจ 00110000 โ Wait, let me redo:
R = 10100011
R โจ Mask = 10100011 โจ 00110000 = 10110011
Bits 4,5 are now 1. Other bits unchanged. โ
Perform two consecutive logical shift left operations on the 8-bit value 00110101. What is the result? What is the equivalent decimal multiplication?
After 1st LSL: 01101010 = 106 (53 ร 2)
After 2nd LSL: 11010100 = 212 (53 ร 4)
Two left shifts = multiply by 4. โ
Given the signed 8-bit value 11010100 (= โ44 in 2's complement), perform arithmetic shift right twice. Show the result and verify it equals โโ44/4โ.
After 1st ASR: 11101010 = โ22 (โ44 รท 2)
After 2nd ASR: 11110101 = โ11 (โ22 รท 2)
โโ44/4โ = โ11 โ (Sign bit 1 is preserved in both shifts)
In an ALSU, function select SโSโSโSโ = 0010 with Cแตขโ = 1. If A = 01010000 and B = 00110000, compute F.
SโSโ = 10 โ F = A + Bฬ + Cแตขโ
Bฬ = 11001111
F = 01010000 + 11001111 + 1 = 00100000
This is A โ B = 80 โ 48 = 32 = 00100000 โ
A common bus system has 16 registers. How many select lines does the MUX need? If each register is 32 bits wide, how many 16ร1 MUX circuits are required?
MUX circuits needed = 32 (one 16ร1 MUX per bit position)
Total: 32 MUX circuits, each being a 16ร1 multiplexer.
๐ญ Industry Application Problems (3)
A network interface card (NIC) receives data serially over Ethernet at 1 Gbps. It needs to present this data to the CPU's 64-bit bus in parallel. Which type of shift register is used? How many clock cycles to fill the register for one 64-bit transfer?
Clock cycles needed = 64 (one bit loaded per clock cycle).
At 1 Gbps, each bit arrives in 1 ns, so 64 bits take 64 ns = 64 clock cycles.
After 64 clocks, all 64 bits are available simultaneously on parallel outputs for the CPU bus.
In an ARM Cortex-A78 processor (used in Qualcomm Snapdragon chips made at Qualcomm Hyderabad), the barrel shifter can perform any shift operation in a single clock cycle. Why is this faster than using a sequential shift register? How does the barrel shifter achieve this using MUX layers?
A barrel shifter uses logโ(n) layers of multiplexers. For 32-bit data, it uses 5 MUX layers.
Each layer either shifts by 2โฑ positions or passes through, controlled by shift-amount bits.
Result: ANY shift amount (0โ31) in ONE clock cycle, regardless of shift distance.
This is critical for ARM's single-cycle execution pipeline used in mobile SoCs designed in India.
ISRO's Chandrayaan-3 telemetry system packs 8 sensor readings (each 4 bits) into a single 32-bit register using insert operations. Describe the RTL sequence to insert the 3rd sensor reading (value 1010) into bits 8โ11 of the register R1 without disturbing other bits.
Step 1: Create clear mask for bits 8-11 Mask = 00000000 00000000 00001111 00000000 Bฬ = 11111111 11111111 11110000 11111111 Step 2: Clear bits 8-11 R1 โ R1 โง Bฬ Step 3: Position new value at bits 8-11 New = 00000000 00000000 00001010 00000000 (1010 shifted left by 8) Step 4: Insert R1 โ R1 โจ New Combined RTL: R1 โ (R1 โง Bฬ) โจ (Sensorโ shl 8)
๐ฏ GATE Practice Problems (5)
The operation performed by R3 โ R1 + Rฬ2 + 1 is equivalent to:
- R1 AND R2
- R1 โ R2
- R1 + R2
- R1 XOR R2
A bus system uses a 64-to-1 multiplexer. How many selection lines are required?
- 5
- 6
- 7
- 8
The arithmetic shift right operation on signed number 11110010 gives:
- 01111001
- 11111001
- 11110001
- 01110010
To selectively complement bits 2 and 5 of register A = 10110100, the mask B and operation should be:
- B = 00100100, A โง B
- B = 00100100, A โจ B
- B = 00100100, A โ B
- B = 11011011, A โง B
In a common bus system with k registers, each n bits wide, using n multiplexers each of size kร1, the total number of MUX select lines required is:
- n ร logโ(k)
- logโ(k)
- k ร n
- n ร k
MCQ Assessment Bank โ 30 Questions (Bloom's Mapped)
Remember / Identify (Q1โQ6)
A register is a group of:
- Counters
- Decoders
- Flip-flops
- Multiplexers
The RTL statement R2 โ R1 means:
- Delete R1 and store in R2
- Copy contents of R1 into R2
- Swap R1 and R2
- Compare R1 and R2
In RTL notation, M[AR] refers to:
- The address register
- The memory word at the address stored in AR
- The multiplication of A and R
- A memory array of AR size
SIPO stands for:
- Serial Input Parallel Output
- Single Input Pair Output
- Synchronous In Phase Operation
- Serial In Pulse Out
The four types of micro operations are:
- Register transfer, arithmetic, logic, shift
- Add, subtract, multiply, divide
- AND, OR, XOR, NOT
- Read, write, execute, store
In a common bus system, which component selects which register places data on the bus?
- Decoder
- Multiplexer (MUX)
- Encoder
- Flip-flop
Understand / Explain (Q7โQ12)
Why does R2 โ R1 NOT erase R1?
- Because R1 is read-only
- Because it's a copy operation โ the source register is only read, not cleared
- Because both registers share the same flip-flops
- Because the clock prevents erasure
What is the purpose of the LOAD control signal in a register?
- To reset the register to zero
- To determine whether the register captures new input on the next clock edge
- To select which bit to read
- To connect the register to the ALU
Why is a bus system preferred over point-to-point connections between registers?
- It's faster
- It reduces the number of wires from O(nยฒ) to O(n)
- It allows multiple simultaneous transfers
- It eliminates the need for multiplexers
What distinguishes arithmetic shift right from logical shift right?
- Arithmetic shift right is faster
- Arithmetic shift right preserves the sign bit (MSB), logical shift right fills MSB with 0
- They are identical operations
- Logical shift right preserves the sign bit
In memory read operation DR โ M[AR], what is the role of AR?
- AR stores the data to be read
- AR contains the address of the memory location to be read
- AR performs the read operation
- AR stores the result of the read
Why is circular shift useful in cryptographic algorithms?
- It destroys the data permanently
- No bits are lost โ all information is preserved while rearranging bit positions
- It's the same as addition
- It only works on prime-length registers
Apply / Compute (Q13โQ18)
If R1 = 11001010 and R2 = 10110011, what is R1 โง R2?
- 10000010
- 11111011
- 01111001
- 10001000
Logical shift left of 01011010 gives:
- 10110100
- 00101101
- 01011010
- 10110101
Circular shift right of 10000001 gives:
- 01000000
- 11000000
- 11000000
- 01000001
To selectively set bits 0 and 3 of R = 10100100, the mask and operation are:
- Mask = 00001001, R โง Mask
- Mask = 00001001, R โจ Mask
- Mask = 00001001, R โ Mask
- Mask = 11110110, R โง Mask
In the ALSU, SโSโSโSโ = 0101 selects:
- Addition (A + B)
- OR (A โจ B)
- XOR (A โ B)
- Shift left
What is the result of R1 โ R1 + Rฬ1 + 1?
- R1 = 0 (all zeros)
- R1 = all ones
- R1 unchanged
- R1 = 1
Analyze / Compare (Q19โQ24)
Which shift register type is needed to convert parallel CPU data to serial data for USB transmission?
- SISO
- SIPO
- PISO
- PIPO
For a system with 32 registers, how many MUX select lines are needed for the common bus?
- 4
- 5
- 16
- 32
Three consecutive logical shift left operations on an 8-bit value are equivalent to:
- Multiplying by 3
- Multiplying by 6
- Multiplying by 8
- Multiplying by 16
Which operation is used to test if a specific bit is 1 without modifying the register?
- Selective set (OR)
- Selective clear (AND complement)
- Mask operation (AND with mask, check result)
- Complement (NOT)
If both memory read and memory write use the same data bus, what prevents data collision?
- They use different clock speeds
- Read and write control signals are mutually exclusive โ only one is active at a time
- They use separate address registers
- Memory can handle simultaneous read and write
What advantage does a barrel shifter have over a sequential shift register in ALU design?
- It uses fewer transistors
- It can shift by any amount in one clock cycle instead of one bit per cycle
- It only works with 8-bit data
- It doesn't need control signals
Evaluate / Justify (Q25โQ27)
A student claims "Arithmetic shift left is different from logical shift left." Is this correct?
- Yes, arithmetic shift left preserves the sign bit
- No, both operations are identical โ shift all bits left, fill LSB with 0
- Yes, arithmetic shift left fills MSB with 1
- No, arithmetic shift left doesn't exist
Why can't two registers simultaneously drive the common bus?
- The clock can only trigger one register
- Different voltage levels from two sources would cause bus contention (short circuit)
- MUX has only one output
- Both B and C
Is the operation R1 โ R1 โ R1 useful? What does it produce?
- It doubles R1
- It complements R1
- It always produces all zeros โ a quick way to clear a register
- It produces all ones
XOR EAX, EAX).Create / Design (Q28โQ30)
To swap two registers R1 and R2 without a temporary register, the correct RTL sequence using XOR is:
- R1โR1โR2, R2โR1โR2, R1โR1โR2
- R1โR1โงR2, R2โR1โจR2, R1โR1โงR2
- R1โR1+R2, R2โR1โR2, R1โR1โR2
- Both A and C
To implement R3 โ R1 โ R2 using only addition and complement operations, the correct design is:
- R3 โ R1 + R2
- R3 โ R1 + Rฬ2 + 1
- R3 โ Rฬ1 + R2 + 1
- R3 โ R1 + Rฬ2
Design an RTL sequence to multiply the contents of R1 by 5 using only shift and add operations:
- R2 โ shl R1; R2 โ shl R2; R1 โ R1 + R2
- R2 โ R1; R1 โ shl R1; R1 โ shl R1; R1 โ R1 + R2
- R1 โ shl R1; R1 โ shl R1; R1 โ R1 + R1
- R2 โ shl R1; R1 โ R1 + R2
Short Answer Questions (8)
Define a register and explain the role of the LOAD signal. (3 marks)
LOAD signal: The LOAD control signal determines whether the register accepts new data. When LOAD = 1, the register captures the input data on the next clock edge. When LOAD = 0, the register retains its current contents regardless of input changes. This makes the register "selective" โ it only updates when explicitly commanded to do so.
Explain the difference between R2 โ R1 and P: R2 โ R1. (3 marks)
P: R2 โ R1: Conditional transfer. The transfer occurs ONLY when control variable P = 1. If P = 0, R2 retains its old value. The condition P is checked at the clock edge โ both P = 1 and the clock edge must coincide for the transfer to happen. This is implemented by ANDing P with the CLK signal to generate the LOAD input for R2.
What is a common bus system? Why is it preferred over direct connections? (4 marks)
Why preferred:
1. Reduced wiring: k registers need only k connections to the bus, versus k(kโ1) point-to-point connections
2. Scalability: Adding a new register requires only connecting it to the bus, not to every other register
3. Simpler control: Only logโ(k) select lines needed to choose the source register
4. Trade-off: Slower (only one transfer per clock cycle) but much simpler and cheaper hardware
Describe the four selective logic operations with one example each. (5 marks)
2. Selective Clear (AND complement): Clears specific bits to 0. R = 10101111, Mask = 00001100, Bฬ = 11110011 โ R โง Bฬ = 10100011. Bits 2,3 cleared.
3. Selective Complement (XOR): Toggles specific bits. R = 10100011, Mask = 00001100 โ R โ Mask = 10101111. Bits 2,3 flipped.
4. Insert (Clear then Set): Replaces specific bits with new values. First clear target bits using AND complement, then set new values using OR. R = 10100011, clear bits 2,3, insert 10 โ (R โง 11110011) โจ 00001000 = 10101011.
Compare logical shift right and arithmetic shift right with a numerical example. (4 marks)
Example: 11010110 โ 01101011 (214 โ 107 unsigned)
Arithmetic Shift Right (ASR): All bits shift right by 1. MSB retains its original value (sign preservation). Used for signed division by 2.
Example: 11010110 โ 11101011 (โ42 โ โ21 signed)
Key difference: For positive numbers (MSB=0), both produce the same result. For negative numbers (MSB=1), LSR incorrectly changes the sign to positive, while ASR correctly preserves the negative sign.
List and briefly describe the four types of shift registers (SISO, SIPO, PISO, PIPO). (4 marks)
2. SIPO (Serial In Parallel Out): Data enters one bit at a time but all bits are available simultaneously at the output. Used for serial-to-parallel conversion (e.g., UART receiver).
3. PISO (Parallel In Serial Out): All bits are loaded at once, then shifted out one at a time. Used for parallel-to-serial conversion (e.g., UART transmitter).
4. PIPO (Parallel In Parallel Out): All bits loaded and read simultaneously. Acts as a buffer or temporary storage register. Used in pipeline stages and data latches.
Explain how subtraction is implemented using addition in an ALU. (3 marks)
To compute A โ B, the ALU performs: A + Bฬ + 1
Steps:
1. Take the 1's complement of B (invert all bits): Bฬ
2. Add 1 to get the 2's complement: Bฬ + 1 = โB
3. Add A + (โB) = A โ B
This means the ALU only needs an adder and a complementer โ no separate subtraction circuit is required. The Cแตขโ (carry input) provides the +1.
What are the function-select lines in an ALSU? How do SโSโ and SโSโ work together? (4 marks)
Two-level selection:
โข SโSโ (Unit Select): Selects which sub-unit produces the output:
- 00 = Arithmetic unit (add, subtract, increment, etc.)
- 01 = Logic unit (AND, OR, XOR, NOT)
- 10 = Shift unit (logical, circular, arithmetic shifts)
โข SโSโ (Operation Select): Selects the specific operation within the chosen unit. For example, in the logic unit: 00=AND, 01=OR, 10=XOR, 11=NOT.
Additionally, Cแตขโ (carry input) acts as an extra selector for arithmetic operations, effectively doubling the number of arithmetic functions (e.g., Transfer A vs Increment A).
Long Answer Questions (3)
๐ LA1: Explain Register Transfer Language (RTL) with all notation rules, 10 operation examples, and conditional transfer with timing diagram (10 marks)
Model Answer Outline:
- Definition of RTL: A symbolic notation used to describe the micro operations and data transfers between registers in a digital system. It specifies which register receives data (destination โ source), under what conditions, and what operation is performed.
- Notation rules (6 rules): Uppercase letters for registers, โ for transfer, comma for simultaneous operations, colon for conditions, parentheses for bit selection, brackets for memory access.
- 10 operation examples:
- R2 โ R1 (simple transfer)
- P: R2 โ R1 (conditional transfer)
- R1 โ R1 + R2 (addition)
- R3 โ R1 + Rฬ2 + 1 (subtraction via 2's complement)
- R1 โ R1 โง R2 (AND), R1 โ R1 โจ R2 (OR), R1 โ R1 โ R2 (XOR)
- R1 โ shl R1, R1 โ shr R1 (shifts)
- DR โ M[AR] (memory read), M[AR] โ DR (memory write)
- Conditional transfer with timing diagram: Show P: R2 โ R1 with clock pulses, P signal, and the exact clock edge where transfer occurs. Explain that P must be 1 BEFORE the clock edge.
- Hardware implementation: P signal ANDed with CLK to generate the LOAD pulse for the destination register.
๐ LA2: Explain the Common Bus System with a diagram for 4 registers using multiplexers. Describe memory read and write operations with RTL. (10 marks)
Model Answer Outline:
- Problem: k registers need k(kโ1) direct connections โ impractical for large systems
- Solution: Common bus โ shared data path using MUX to select source register
- Diagram: 4 registers (R0-R3) connected through n-bit 4ร1 MUX. 2 select lines (SโSโ). Show bus and LOAD signals for each register.
- Number of MUXes: For n-bit registers, need n separate 4ร1 MUX circuits. All share the same SโSโ select lines.
- Transfer example: R3 โ R1 requires SโSโ = 01 (select R1 onto bus) and R3 LOAD = 1.
- Memory Read (DR โ M[AR]): AR provides address to memory address bus, READ control activated, data from memory cell placed on data bus, DR captures data on clock edge.
- Memory Write (M[AR] โ DR): AR provides address, DR provides data on data bus, WRITE control activated, memory cell at AR address stores the data.
- Advantages: Reduced wiring complexity, easier to scale, simpler control logic.
- Disadvantage: Only one transfer per clock cycle (bus bottleneck).
๐ LA3: Design and explain the Arithmetic Logic Shift Unit (ALSU) with complete operation table. Show how subtraction and all shift types are performed. (12 marks)
Model Answer Outline:
- ALSU Structure: Three sub-units โ Arithmetic Unit, Logic Unit, Shift Unit โ with output MUX
- Block Diagram: Inputs A, B (n-bit), function select SโSโSโSโ, carry input Cแตขโ, output F (n-bit)
- SโSโ Unit Selection: 00 = Arithmetic, 01 = Logic, 10 = Shift
- Complete Operation Table: All 16+ operations with SโSโSโSโ and Cแตขโ values
- Arithmetic operations: Transfer, Increment, Add, Add with carry, A+Bฬ, Subtract (AโB = A+Bฬ+1), Decrement
- Subtraction explained: A โ B = A + 2's complement of B = A + Bฬ + 1. The complementer inverts B, Cแตขโ = 1 adds the extra 1.
- Logic operations: AND, OR, XOR, NOT (complement)
- Shift operations:
- Logical shift left/right: 0 fills vacated bit
- Circular shift left/right: lost bit wraps around
- Arithmetic shift right: sign bit preserved
- MUX design: 4ร1 MUX at output selects Arith/Logic/Shift result based on SโSโ
- Status flags: Carry out, Zero flag, Sign flag, Overflow flag generated from arithmetic unit results
Industry Spotlight โ A Day in the Life
๐จโ๐ป Rajesh Kumar, 30 โ RTL Design Engineer at Qualcomm India, Hyderabad
Background: B.Tech ECE from NIT Warangal. Joined Qualcomm as a campus hire in 2018. Worked his way up from junior verification engineer to RTL design engineer. Designs register files and data-path logic for Snapdragon mobile SoCs.
A Typical Day:
9:00 AM โ Morning standup with the CPU micro-architecture team. Review overnight regression test results for the register file design.
10:00 AM โ Write Verilog RTL code for a new 64-entry register file with 3 read ports and 2 write ports. Implement bypass logic for back-to-back register transfers (write-then-read in the same cycle).
11:30 AM โ Run synthesis to check if the register file meets timing at 3.2 GHz target frequency. Debug a critical path through the MUX tree.
1:00 PM โ Lunch at Qualcomm's Hyderabad campus. Discuss a new power-gating technique for idle registers with a colleague from the power team.
2:00 PM โ Code review for a junior engineer's shift-unit design. Spot a bug: arithmetic shift right isn't preserving the sign bit correctly for 16-bit mode.
4:00 PM โ Write SystemVerilog assertions (SVA) to formally verify that all register transfer operations produce correct results under all corner cases.
5:30 PM โ Architecture review meeting: discuss adding a barrel shifter to the ALSU design for the next-gen Snapdragon chip targeting 4 nm process.
| Detail | Info |
|---|---|
| Tools Used Daily | Verilog/SystemVerilog, Synopsys Design Compiler, VCS, Verdi, Python scripting |
| Entry Salary (2024) | โน12โ18 LPA (NIT/IIT campus) |
| Mid-Level (3โ5 yrs) | โน20โ35 LPA |
| Senior (7+ yrs) | โน40โ70 LPA |
| Companies Hiring in India | Qualcomm, Intel, AMD, Samsung R&D, ARM, MediaTek, Texas Instruments, Synopsys, Cadence, ISRO |
| Required Skills | Digital design, Verilog HDL, RTL coding, computer architecture, VLSI fundamentals |
Earn With It โ GATE Coaching & Freelance Opportunities
๐ฐ Your Earning Path After This Chapter
Portfolio Piece: "8-Bit Shift Register Simulator in Python" + comprehensive RTL trace solutions for GATE-level problems. Host on GitHub.
Earning Opportunities:
โข GATE coaching assistance โ Help juniors with COA register transfer topic โ โน500โโน1,000/session on Chegg/Doubtnut
โข Create GATE COA YouTube/Unacademy micro-lectures โ Register Transfer & Micro Ops (high search volume topic)
โข Freelance Verilog/VHDL assignments โ write RTL code for university assignments โ โน1,000โโน5,000/project on Chegg Study
โข Build digital design simulators for engineering colleges โ โน5,000โโน15,000/project
| Opportunity | Platform | Earning Potential |
|---|---|---|
| GATE COA tutoring | Chegg, Doubtnut, WhatsApp groups | โน3,000โโน8,000/month |
| YouTube GATE prep videos | YouTube, Unacademy | โน5,000โโน30,000/month (with traction) |
| Verilog assignments | Chegg Study, Freelancer | โน1,000โโน5,000/project |
| Digital design simulators | Direct college contracts | โน5,000โโน15,000/project |
| GATE full-length coaching | Toppr, BYJU's, offline | โน10,000โโน25,000/month |
Chapter Summary & Unit Map
๐ Key Takeaways โ Unit 2: Register Transfer & Micro Operations
- Register = group of flip-flops with LOAD control and CLK synchronization. n-bit register has n flip-flops.
- Register Transfer (R2 โ R1) copies source to destination without erasing source. Conditional: P: R2 โ R1.
- RTL Notation uses โ, commas (simultaneous), colons (conditions), brackets (memory), parentheses (bit select).
- Common Bus = shared data path via MUX. Reduces k(kโ1) wires to k connections + logโ(k) select lines.
- Memory ops: Read: DR โ M[AR]. Write: M[AR] โ DR. AR = address, DR = data.
- Logic micro ops: AND (selective clear), OR (selective set), XOR (selective complement), NOT (full complement).
- Shift registers: SISO (delay), SIPO (serialโparallel), PISO (parallelโserial), PIPO (buffer).
- Shift micro ops: Logical (0 fill), Circular (wrap), Arithmetic right (sign preserve). Left shift = ร2.
- ALSU: SโSโ selects unit (Arith/Logic/Shift), SโSโ selects operation within unit. Cแตขโ adds +1 for arithmetic.
- Subtraction = Addition of 2's complement: A โ B = A + Bฬ + 1. No separate subtractor needed.
๐บ๏ธ Unit Map โ Concept Hierarchy
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ UNIT 2: REGISTER TRANSFER & MICRO OPERATIONS โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ โ โ REGISTERS โ โ REGISTER โ โ BUS SYSTEM โ โ โ โ โ โ TRANSFER โ โ โ โ โ โ โข Flip-flops โ โ โ โ โข Common bus โ โ โ โ โข LOAD/CLK โ โ โข R2 โ R1 โ โ โข MUX select โ โ โ โ โข Parallel โ โ โข P: R2 โ R1 โ โ โข Memory R/W โ โ โ โ load โ โ โข RTL notation โ โ โข DR โ M[AR] โ โ โ โโโโโโโโฌโโโโโโโโ โโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโ โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โผ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ MICRO OPERATIONS โ โ โ โโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโค โ โ โ โ โ โ โ โ โผ โผ โผ โผ โ โ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโโโโ โ โ โARITHMETICโ โ LOGIC โ โ SHIFT โ โ SHIFT โ โ โ โ โ โ โ โ REGS โ โ MICRO โ โ โ โ Add โ โ AND โ โ โ โ OPS โ โ โ โ Subtract โ โ OR โ โ SISO โ โ โ โ โ โ Incr/Decrโ โ XOR โ โ SIPO โ โ Logical โ โ โ โ Transfer โ โ NOT โ โ PISO โ โ Circular โ โ โ โ โ โ โ โ PIPO โ โ Arithmeticโ โ โ โโโโโโฌโโโโโโ โโโโโฌโโโโโ โโโโโโโโโ โโโโโโโฌโโโโโโ โ โ โ โ โ โ โ โโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ โ โ โผ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ ALSU (Combined) โ โ โ โ โ โ โ โ SโSโSโSโ + Cแตขโ โ โ โ โ Function Select โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Earning Checkpoint โ Self-Assessment
| Skill / Concept | Tool / Method | Evidence of Mastery | Ready to Earn? |
|---|---|---|---|
| Register basics | Conceptual | Can draw n-bit register with LOAD/CLK | โ Can explain in GATE coaching |
| RTL notation | Pen & paper | Can write & trace any RTL sequence | โ Can tutor juniors |
| Bus system design | Diagram | Can draw MUX-based common bus | โ Interview-ready concept |
| Logic micro ops | Binary computation | Can perform selective set/clear/complement/insert | โ Can solve GATE numericals |
| Shift registers (4 types) | Diagram + trace | Can trace SISO/SIPO/PISO/PIPO data flow | โ Can create teaching material |
| Shift micro ops (5 types) | Binary computation | Can predict output for any 8-bit shift | โ Can solve any GATE shift question |
| ALSU operation table | Table + diagram | Can map SโSโSโSโ to operations | โ GATE 2-3 mark question ready |
| Python simulator | Python code | Working 8-bit shift register simulator | โ Portfolio piece on GitHub |
| Memory operations | RTL notation | Can explain DR โ M[AR] and M[AR] โ DR | โ Can teach in college lab |
โ Unit 2 complete. Ready for Unit 3: Basic Computer Organization!
[QR: Link to EduArtha video tutorial โ Register Transfer & Micro Operations]