7.1 CPU Internal Datapath & Register Transfer Micro-Operations
💡 Core Intuition: The Central Processing Datapath
At the physical core of every computing system lies the CPU Datapath: the interconnected collection of high-speed storage elements (registers), operational functional units (ALU, shifters), and shared communication pathways (internal buses) that physically latch, route, and transform binary words.
Every high-level software construct—from a simple integer addition to a complex database pointer dereference—decomposes into a deterministic sequence of atomic hardware operations known as Register Transfer Level (RTL) Micro-Operations.
🍳 The Everyday Analogy: The Single-Track Factory Railway
Imagine an industrial manufacturing floor with multiple specialized workstations:
- A Raw Material Bin (Memory Unit) holding incoming parts.
- A Clipboard Worker (Program Counter, ) noting which assembly card to pull next.
- An Index Card Holder (Address Register, ) pointing to the exact bin slot.
- A Work Inspection Desk (Instruction Register, ) examining the assembly blueprint.
- A Heavy-Duty Hydraulic Press (Arithmetic Logic Unit, ALU) performing forging operations.
- An Assembler's Staging Workbench (Accumulator Register, ) holding the work-in-progress item.
Now imagine all these stations must exchange components over a single shared railway track (The Common Bus). Only one station may place a payload onto the railway track at any given instant. If two stations placed parts on the track simultaneously, a physical crash would occur (bus contention). However, multiple stations can simultaneously observe and latch the item rolling past if their gate latches are opened.
The foreman timing every rail movement with an ultra-precise metronome is the Timing Circuit & Sequence Counter.
The Shared Single-Bus Datapath Pipeline
How multiplexed register outputs drive the common bus wire without electrical contention
Register File (AR, PC, DR, AC)
Registers assert data words onto multiplexer inputs.
Common Bus Multiplexer
Selects exactly 1 of 8 hardware units to drive the bus.
Receiving Register Latches
Asserted Load (LD) signal latches data into destination flip-flops on the clock edge.
💻 Bridging to Computer Science
In physical hardware, a digital system coordinates transfers between registers synchronized to a master system clock. A micro-operation is an elementary operation performed on information stored in one or more registers during a single clock cycle.
Mathematically, a conditional register transfer is written as:
Where:
- is a control condition (a Boolean predicate generated by the control unit).
- is the source register.
- is the destination register.
- The transfer occurs synchronously on the rising (or falling) edge of the clock signal only when .
Edge-Triggered Semantic: The output of is transferred into the flip-flops of exclusively on the active transition of the clock pulse while control condition evaluates to true ().
📑Table of Contents
- 🏛️ Processor Register Architecture
- 🚌 Common Bus System Architecture
- ⚡ Datapath Topologies: Single-Bus vs. Multi-Bus
- 🔄 The Instruction Cycle & Micro-Operation Phases
- ⚙️ Micro-Operation Execution Traces for Memory-Reference Instructions
- 🏭 Real-World Production Context: Modern Datapath Scaling
- 📐 Numerical Applications & Worked Examples
- 🎯 Exam & Interview Pitfall Check
🏛️ Processor Register Architecture
A classic basic computer system operates over a memory space of , where each word is wide. To coordinate execution, the CPU datapath maintains eight dedicated registers, each sized precisely to its functional domain.
CPU Datapath Register Organization
Functional breakdown, bit widths, and bus roles of the primary internal registers
Program Counter (PC)
12 Bits- Holds the memory address of the next instruction word to fetch.
- Auto-increments sequentially via INR(PC) during fetch cycle T1.
- Connects directly to the 12 least significant lines of the Common Bus.
Address Register (AR)
12 Bits- Directly drives the 12-bit physical address lines into the Memory Unit.
- Must latch the target memory address before any read/write cycle.
- Loaded from PC during fetch, or from IR/Bus during decode.
Data Register (DR)
16 Bits- Serves as the bidirectional Memory Data Register (MDR).
- Latches 16-bit operands read from memory at M[AR].
- Directly feeds operand input port B of the 16-bit ALU.
Accumulator (AC)
16 Bits- Primary computational register holding intermediate and final results.
- Directly latches ALU results and supplies operand port A.
- Coupled with the 1-bit extended carry flip-flop (E).
Instruction Register (IR)
16 Bits- Holds the fetched machine instruction word: Opcode [14:12], Mode [15], Address [11:0].
- Directly feeds the 3x8 opcode decoder and control logic.
- Cannot drive the Common Bus directly (address field gates via bus multiplexer).
Temporary Register (TR)
16 Bits- Internal scratchpad holding intermediate data words during multi-cycle execution.
- Prevents register clobbering when AC or DR must be preserved.
- Drives Common Bus input 6 via S2, S1, S0 = 110.
Input Register (INPR)
8 Bits- Buffers incoming 8-bit character data from peripheral devices.
- Routes data to the 8 least significant bits of AC via ALU logic.
- Synchronized to serial input flag flip-flop (FGI).
Output Register (OUTR)
8 Bits- Latches 8-bit ASCII characters from Common Bus bits [7:0] for external displays.
- Does NOT drive the Common Bus (write-only peripheral port).
- Synchronized to display output flag flip-flop (FGO).
Register Bit Allocation & Specification Summary
| Register Symbol | Register Name | Width (Bits) | Function & Operational Description |
|---|---|---|---|
| AR | Address Register | Supplies address directly to the Memory Unit. | |
| PC | Program Counter | Holds address of next instruction; auto-increments via . | |
| DR | Data Register | Holds memory operand; feeds one port of the 16-bit ALU. | |
| AC | Accumulator | Core processing register; holds intermediate and final arithmetic/logic results. | |
| IR | Instruction Register | Holds current instruction opcode () and address (). | |
| TR | Temporary Register | Stores temporary processor variables during instruction execution. | |
| INPR | Input Register | Buffers incoming 8-bit character from peripheral input device. | |
| OUTR | Output Register | Latches 8-bit character from bus for peripheral output device. | |
| E | Extended Accumulator | 1-bit flip-flop latching ALU carry-out () and shift overflow. | |
| I | Indirect Addressing Bit | Latching bit 15 of ; determines direct () vs indirect (). | |
| SC | Sequence Counter | Generates 16 orthogonal timing intervals . |
🚌 Common Bus System Architecture
Instead of providing individual point-to-point physical wires between every pair of registers (which would require copper traces and cause silicon routing congestion), modern processors utilize a Common Bus Architecture.
Multiplexer-Based Bus Interconnect
In a 16-bit multiplexer-based common bus system, 16 individual multiplexers are connected such that multiplexer selects bit from one of seven potential driving registers or the memory unit.
Each bit line () of the 16-bit common bus receives inputs from bit of all seven registers and the memory output, gated by a bank of sixteen multiplexers sharing common selection lines :
Three binary selection lines () control which unit drives the 16-bit bus lines at any specific cycle:
| Decimal Select | Active Source Register Placed on Bus | |||
|---|---|---|---|---|
| None (Bus is idle / High-Impedance) | ||||
| Address Register (AR) | ||||
| Program Counter (PC) | ||||
| Data Register (DR) | ||||
| Accumulator (AC) | ||||
| Instruction Register (IR) | ||||
| Temporary Register (TR) | ||||
| Memory Unit () |
[!IMPORTANT] Single Driver Invariant: Only one register can drive the bus per clock cycle. However, multiple destination registers can simultaneously latch data from the bus on the same clock pulse by asserting their respective Load () enable lines!
Tri-State Bus Drivers Alternative
An alternative to multiplexer switching is the use of Three-State (Tri-state) Bus Buffers. A tri-state gate exhibits three distinct states:
- Logic 0: Low output voltage (active drive low).
- Logic 1: High output voltage (active drive high).
- High-Impedance State (): The output is physically disconnected from the bus wire, presenting near-infinite open-circuit resistance.
When using tri-state buffers, each register output connects to the shared copper line through a buffer enabled by a decoded control signal (). Exactly one buffer enable is driven high () while all other drivers remain in state , preventing current contention while eliminating the routing bulk of centralized multiplexers.
⚡ Datapath Topologies: Single-Bus vs. Multi-Bus
Processor datapaths are classified by the number of simultaneous internal communication channels available between registers and arithmetic execution units:
Processor Datapath Architectures
The fundamental architectural trade-off between silicon footprint and execution latency
Single-Bus Datapath
- •Only one data word can traverse the CPU bus per clock cycle.
- •ALU requires temporary latch registers (Y and Z) to hold operands across clock edges.
- •An arithmetic instruction like R1 <- R2 + R3 requires 3 serialized clock cycles.
- •Lowest silicon area, minimal routing metal layers, and lowest static leakage.
Three-Bus Datapath
- •Three independent buses: Bus A & Bus B (source operands) and Bus C (result writeback).
- •Both source registers feed ALU input ports A and B concurrently in a single clock cycle.
- •ALU result writes back directly to destination register R1 via Bus C.
- •An arithmetic instruction like R1 <- R2 + R3 executes in exactly 1 single clock cycle.
Single-Bus ALU Contention & Pipeline Bubbles
In a single-bus datapath, the ALU cannot receive two register inputs simultaneously from the bus. Consider executing the register addition:
The processor must serialize the transfer across three clock cycles using temporary registers and :
- Cycle 1: Place on the bus; assert . ()
- Cycle 2: Place on the bus; configure ALU to add; latch output into . ()
- Cycle 3: Place on the bus; assert . ()
In contrast, a three-bus datapath places onto Bus A, onto Bus B, triggers the addition, and gates the result onto Bus C directly into in one single clock cycle.
🔄 The Instruction Cycle & Micro-Operation Phases
Every instruction loaded into the CPU undergoes four mandatory sequential phases:
The Universal Instruction Execution Lifecycle
Fetch Phase (T0 - T1)
Transfer current PC address to AR, load instruction word from memory into IR, and increment PC.
Decode Phase (T2)
Decode 3-bit opcode into D0-D7, transfer 12-bit address field to AR, and extract Indirect flag bit I.
Effective Address Phase (T3)
If addressing mode is indirect (I=1), fetch the 12-bit effective address from memory location M[AR].
Execution Phase (T4 - T6)
Execute the decoded operation (ALU manipulation, data transfer, branching) and clear Sequence Counter to 0.
Timing Circuit & Sequence Counter
The timing of all micro-operations is controlled by a 4-bit Sequence Counter ().
- receives a continuous system clock and has control inputs: Increment () and Clear ().
- The 4-bit output of is decoded by a decoder into 16 mutually exclusive timing pulses: .
- Only one timing pulse is active () during any given clock period.
When an instruction finishes execution at cycle , the control unit asserts , causing the next clock edge to reset to , returning the processor to for the next instruction fetch.
⚙️ Micro-Operation Execution Traces for Memory-Reference Instructions
The operation code in is decoded by a decoder into eight output lines .
- If , the instruction is a Memory-Reference Instruction.
- If and , the instruction is a Register-Reference Instruction.
- If and , the instruction is an Input/Output Instruction.
1. Fetch & Decode Phase RTL (Universal for All Instructions)
During cycles , , and , all instructions execute the identical micro-operation sequence regardless of opcode:
2. Addressing Evaluation at
At timing pulse , the control unit inspects and :
3. Execution Phase Micro-Operations ()
For memory-reference instructions (), execution starts at with the effective address guaranteed to reside in :
| Opcode Decoder | Instruction Mnemonic | Full Operation Name | Execution Cycle Spans |
|---|---|---|---|
AND | Logical AND to Accumulator | ||
ADD | Add to Accumulator with Carry () | ||
LDA | Load Memory Word to Accumulator | ||
STA | Store Accumulator into Memory | (Single Cycle!) | |
BUN | Branch Unconditionally | (Single Cycle!) | |
BSA | Branch and Save Return Address | ||
ISZ | Increment Memory Word & Skip if Zero |
Detailed RTL Equations:
-
AND to AC ():
- (Read memory operand into Data Register)
- (Bitwise logical AND, reset counter)
-
ADD to AC ():
- (Read operand)
- (Sum to AC, carry to E)
-
LDA: Load to AC ():
- (Transfer DR to AC via ALU pass-through)
-
STA: Store AC ():
- (Write AC to memory in a single cycle!)
-
BUN: Branch Unconditionally ():
- (Directly load target address into PC)
-
BSA: Branch and Save Return Address ():
- (Save return address at subroutine entry, advance AR)
- (Jump execution to subroutine body)
-
ISZ: Increment and Skip if Zero ():
- (Fetch loop counter from memory)
- (Increment counter in Data Register)
🏭 Real-World Production Context: Modern Datapath Scaling
Modern microprocessors have moved far beyond Mano's single-accumulator model, yet the fundamental concepts of register transfer and bus isolation remain universal:
Modern Microprocessor Datapath Evolution
From basic accumulator machines to out-of-order superscalar architectures.
Superscalar Execution Core (Intel Raptor Lake / AMD Zen 4)
Replaces single buses with massive Reservation Stations, 180+ Physical Register Files (PRF), Register Alias Tables (RAT), and a Reorder Buffer (ROB) supporting 6+ micro-ops per cycle.
Pipelined 3-Bus Datapath (ARM Cortex-M4 / RISC-V RV32I)
Direct separate Read Bus A, Read Bus B, and Writeback Bus C connected to 32 general-purpose registers, allowing single-cycle execution of arithmetic instructions.
Mano Basic Computer & Microcontroller Datapaths (8051 / PIC)
Single-bus architecture multiplexing shared registers to minimize silicon die area and pin count at the cost of multi-cycle instruction execution.
📐 Numerical Applications & Worked Examples
Example 1: Cycle-by-Cycle RTL Trace of Indirect ADD Instruction
Problem Statement
A basic computer with a 16-bit single common bus executes an ADD instruction with indirect addressing () located at memory address . The instruction word at memory address is:
Memory contents are:
- Accumulator initial content: , .
Determine:
- The opcode bit pattern and decoded output line .
- The exact sequence of micro-operations executed cycle-by-cycle from to completion.
- The bus selection code () and active register control inputs for each clock cycle.
- The final values of , , , and .
Step-by-Step Solution
1. Instruction Word Decoding: Convert to 16-bit binary:
- Bit (Indirect addressing).
- Opcode Decoder output (ADD instruction).
- Address field .
2. Cycle-by-Cycle Execution Trace:
| Cycle | Active Pulse | Register Transfer Statement | Bus Source | Active Register Controls | Description | |
|---|---|---|---|---|---|---|
| 0 | () transferred to . | |||||
| 1 | Memory | Fetch instruction word ; becomes . | ||||
| 2 | , , Opcode decoded (). | |||||
| 3 | Memory | Read pointer at : . . | ||||
| 4 | Memory | Read operand at : . | ||||
| 5 | None | . . Reset . |
3. Final Register State:
- (No carry out)
- (Instruction completed in exactly 6 clock cycles: ).
Example 2: Subroutine Linkage Mechanics (BSA and Indirect Return)
Problem Statement
A processor executes a Branch and Save Return Address instruction: BSA 150 located at memory address .
- Detail the micro-operations occurring during cycles and of
BSA. - Write the exact memory contents at address and the value of after .
- Write the single instruction and addressing mode that must be placed at the end of the subroutine at memory address to return control to the main calling program.
Step-by-Step Solution
1. Micro-Operations of BSA:
Prior to :
- At : .
- At : (Notice that is already incremented to point to the instruction after the call!).
- At : , .
- At : (direct addressing), NOP.
At execution cycles:
- Cycle :
- () is written into memory location .
- increments: .
- Cycle :
- is loaded with .
- is cleared to 0.
2. State After Execution:
- (Return address stored in the entry slot of the subroutine!).
- (Execution begins at the first executable instruction of the subroutine).
3. Subroutine Return Instruction: To return to the calling program, the subroutine must branch to the address stored at . It issues an indirect unconditional branch:
During execution of BUN 150 (I=1):
- At : .
- At : .
- At : . The calling program resumes seamlessly at address .
Example 3: Datapath Bus Contention & Latency Comparison
Problem Statement
An arithmetic logic instruction performs an in-memory accumulation:
Compare the cycle latency and intermediate register requirements between:
- A Single Common Bus datapath where memory output drives the bus directly.
- A Dual-Bus Datapath (Bus A connects register outputs to ALU input A, Bus B connects Memory/Registers to ALU input B, and ALU output latches directly into destination).
- If the clock frequency is for both designs, calculate the execution time reduction achieved by the dual-bus architecture.
Step-by-Step Solution
1. Single-Bus Datapath Execution: On a single bus, each transfer requires a dedicated cycle:
- Cycle 1: Transfer address to : . (Bus used by ).
- Cycle 2: Read memory operand into : . (Bus used by Memory).
- Cycle 3: Perform ALU addition and latch result: . (Bus is free or used for latching).
Total clock cycles on Single-Bus = .
2. Dual-Bus Datapath Execution: With two independent buses (Bus A and Bus B) and direct ALU output feedback to :
- Cycle 1: Place on Bus A; latch into : .
- Cycle 2: Memory reads operand directly onto Bus B while is routed onto Bus A. The ALU computes continuously and latches the final sum directly into on the next clock edge!
Total clock cycles on Dual-Bus = .
3. Execution Time & Speedup:
🎯 Exam & Interview Pitfall Check
-
Why is the Address Register () sized at 12 bits while the Data Register () is 16 bits?
- The memory capacity is . Hence, exactly 12 bits are required to address any memory location (). In contrast, each memory word stores a 16-bit binary payload, meaning operands, instructions, and data words are 16 bits wide, requiring a 16-bit and 16-bit data bus lines.
-
Can Memory and a Register drive the Common Bus simultaneously?
- No. Attempting to drive the shared bus from two distinct digital drivers simultaneously results in electrical bus contention, creating indeterminate logic levels, massive current spikes, and hardware damage. The multiplexer select circuit or tri-state enable decoders physically guarantee that at most one source () is gated onto the bus lines in any given clock cycle.
-
Why does save the return address at the destination address rather than pushing it onto a hardware stack?
- In early accumulator-based architectures (like Mano's basic computer), there is no dedicated hardware Stack Pointer () register. Storing the return address at was the standard subroutine linkage protocol (self-modifying code pattern). However, this architectural design fundamentally cannot support recursion, as a recursive call to the subroutine would overwrite the stored return address!
- Trap 1: Assuming increments during the Execute phase ().
- In reality, auto-increments at during the Fetch phase (). By the time execution begins, already points to the next sequential instruction. This is why branching instructions must explicitly overwrite ().
- Trap 2: Believing is an execution cycle for all instructions.
- For direct memory-reference instructions (), cycle performs no operation (NOP) because the effective address was already latched into during . only performs a memory read () if indirect addressing () is asserted.
- Trap 3: Confusing Register Clear () with Sequence Counter Clear ().
- Clearing a data register () zeroes the register's contents. Clearing the sequence counter () terminates the current instruction's execution cycle and resets the timing state machine to to begin the next instruction fetch.