Skip to main content

7.1 CPU Internal Datapath & Register Transfer Micro-Operations

📚07Topic 7.1⏱️30 min
🎯High-Yield For:Understanding the internal CPU datapath and register transfer logic bridges the gap between high-level instructions and physical silicon gating. It forms the foundation for control unit synthesis, multi-cycle micro-operations, and pipelined processor design.

💡 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, PCPC) noting which assembly card to pull next.
  • An Index Card Holder (Address Register, ARAR) pointing to the exact bin slot.
  • A Work Inspection Desk (Instruction Register, IRIR) examining the assembly blueprint.
  • A Heavy-Duty Hydraulic Press (Arithmetic Logic Unit, ALU) performing forging operations.
  • An Assembler's Staging Workbench (Accumulator Register, ACAC) 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.

Architecture Flow

The Shared Single-Bus Datapath Pipeline

How multiplexed register outputs drive the common bus wire without electrical contention

📦Source Station

Register File (AR, PC, DR, AC)

Registers assert data words onto multiplexer inputs.

→
Bus Select (S2, S1, S0)
🔀Arbitration

Common Bus Multiplexer

Selects exactly 1 of 8 hardware units to drive the bus.

→
16-Bit Shared Rail
📥Destination

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:

P:  R2←R1P: \; R_2 \leftarrow R_1

Where:

  • PP is a control condition (a Boolean predicate generated by the control unit).
  • R1R_1 is the source register.
  • R2R_2 is the destination register.
  • The transfer occurs synchronously on the rising (or falling) edge of the clock signal only when P=1P = 1.
📖Clock Synchronization & RTL Transfer Invariantdefinition
Clock Event: ↑clkAND(P=1)  ⟹  R2←R1\text{Clock Event: } \uparrow \text{clk} \quad \text{AND} \quad (P = 1) \implies R_2 \leftarrow R_1Setup Time Invariant: tsetup+tprop≤Tclk\text{Setup Time Invariant: } t_{\text{setup}} + t_{\text{prop}} \le T_{\text{clk}}

Edge-Triggered Semantic: The output of R1R_1 is transferred into the flip-flops of R2R_2 exclusively on the active transition of the clock pulse while control condition PP evaluates to true (11).



🏛️ Processor Register Architecture​

A classic basic computer system operates over a memory space of 4096 words=212 words4096 \text{ words} = 2^{12} \text{ words}, where each word is 16 bits16 \text{ bits} 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 SymbolRegister NameWidth (Bits)Function & Operational Description
ARAddress Register1212Supplies address directly to the 4096×164096 \times 16 Memory Unit.
PCProgram Counter1212Holds address of next instruction; auto-increments via INR(PC)INR(PC).
DRData Register1616Holds memory operand; feeds one port of the 16-bit ALU.
ACAccumulator1616Core processing register; holds intermediate and final arithmetic/logic results.
IRInstruction Register1616Holds current instruction opcode (15–1215\text{--}12) and address (11–011\text{--}0).
TRTemporary Register1616Stores temporary processor variables during instruction execution.
INPRInput Register88Buffers incoming 8-bit character from peripheral input device.
OUTROutput Register88Latches 8-bit character from bus for peripheral output device.
EExtended Accumulator111-bit flip-flop latching ALU carry-out (CoutC_{out}) and shift overflow.
IIndirect Addressing Bit11Latching bit 15 of IRIR; determines direct (I=0I=0) vs indirect (I=1I=1).
SCSequence Counter44Generates 16 orthogonal timing intervals T0 to T15T_0 \text{ to } T_{15}.

🚌 Common Bus System Architecture​

Instead of providing individual point-to-point physical wires between every pair of registers (which would require O(N2)O(N^2) 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 8×18 \times 1 multiplexers are connected such that multiplexer ii selects bit ii from one of seven potential driving registers or the memory unit.

Each bit line ii (0≤i≤150 \le i \le 15) of the 16-bit common bus receives inputs from bit ii of all seven registers and the memory output, gated by a bank of sixteen 8×18 \times 1 multiplexers sharing common selection lines S2,S1,S0S_2, S_1, S_0:

Three binary selection lines (S2,S1,S0S_2, S_1, S_0) control which unit drives the 16-bit bus lines at any specific cycle:

S2S_2S1S_1S0S_0Decimal SelectActive Source Register Placed on Bus
00000000None (Bus is idle / High-Impedance)
00001111Address Register (AR)
00110022Program Counter (PC)
00111133Data Register (DR)
11000044Accumulator (AC)
11001155Instruction Register (IR)
11110066Temporary Register (TR)
11111177Memory Unit (M[AR]M[AR])

[!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 (LDLD) 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:

  1. Logic 0: Low output voltage (active drive low).
  2. Logic 1: High output voltage (active drive high).
  3. High-Impedance State (ZZ): 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 (EE). Exactly one buffer enable is driven high (E=1E=1) while all other drivers remain in state ZZ, 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

Single-Bus Datapath

🚌
Dominant Architecture / DomainArea-Optimized (Microcontrollers & Edge Silicon)
  • •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.
"Minimizes silicon interconnects at the cost of serialized multi-cycle ALU transfers."
Three-Bus

Three-Bus Datapath

⚡
Dominant Architecture / DomainHigh-Throughput (Pipelined RISC-V & Superscalar)
  • •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.
"Maximizes throughput by routing dual operands and writeback concurrently in a single 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:

R1←R2+R3R_1 \leftarrow R_2 + R_3

The processor must serialize the transfer across three clock cycles using temporary registers YY and ZZ:

  1. Cycle 1: Place R2R_2 on the bus; assert LD(Y)LD(Y). (Y←R2Y \leftarrow R_2)
  2. Cycle 2: Place R3R_3 on the bus; configure ALU to add; latch output into ZZ. (Z←Y+R3Z \leftarrow Y + R_3)
  3. Cycle 3: Place ZZ on the bus; assert LD(R1)LD(R_1). (R1←ZR_1 \leftarrow Z)

In contrast, a three-bus datapath places R2R_2 onto Bus A, R3R_3 onto Bus B, triggers the addition, and gates the result onto Bus C directly into R1R_1 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

1

Fetch Phase (T0 - T1)

Transfer current PC address to AR, load instruction word from memory into IR, and increment PC.

2

Decode Phase (T2)

Decode 3-bit opcode into D0-D7, transfer 12-bit address field to AR, and extract Indirect flag bit I.

3

Effective Address Phase (T3)

If addressing mode is indirect (I=1), fetch the 12-bit effective address from memory location M[AR].

4

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 (SCSC).

  • SCSC receives a continuous system clock and has control inputs: Increment (INRINR) and Clear (CLRCLR).
  • The 4-bit output of SCSC is decoded by a 4×164 \times 16 decoder into 16 mutually exclusive timing pulses: T0,T1,T2,…,T15T_0, T_1, T_2, \dots, T_{15}.
  • Only one timing pulse is active (11) during any given clock period.
📐Sequence Counter Timing Invarianttheorem
Ti⋅Tj=0(∀i≠j),∑k=015Tk=1T_i \cdot T_j = 0 \quad (\forall i \neq j), \quad \sum_{k=0}^{15} T_k = 1

When an instruction finishes execution at cycle TkT_k, the control unit asserts CLR(SC)CLR(SC), causing the next clock edge to reset SCSC to 000020000_2, returning the processor to T0T_0 for the next instruction fetch.


⚙️ Micro-Operation Execution Traces for Memory-Reference Instructions​

The operation code in IR(14−12)IR(14-12) is decoded by a 3×83 \times 8 decoder into eight output lines D0,D1,…,D7D_0, D_1, \dots, D_7.

  • If D7=0D_7 = 0, the instruction is a Memory-Reference Instruction.
  • If D7=1D_7 = 1 and I=0I = 0, the instruction is a Register-Reference Instruction.
  • If D7=1D_7 = 1 and I=1I = 1, the instruction is an Input/Output Instruction.

1. Fetch & Decode Phase RTL (Universal for All Instructions)​

During cycles T0T_0, T1T_1, and T2T_2, all instructions execute the identical micro-operation sequence regardless of opcode:

T0:  AR←PC(Select PC onto bus, LD(AR)=1)T1:  IR←M[AR],PC←PC+1(Memory Read, LD(IR)=1,  INR(PC)=1)T2:  D0…D7←Decode IR(14−12),AR←IR(11−0),I←IR(15)\begin{aligned} T_0 &: \; AR \leftarrow PC && \text{(Select PC onto bus, } LD(AR)=1\text{)} \\ T_1 &: \; IR \leftarrow M[AR], \quad PC \leftarrow PC + 1 && \text{(Memory Read, } LD(IR)=1, \; INR(PC)=1\text{)} \\ T_2 &: \; D_0 \dots D_7 \leftarrow \text{Decode } IR(14-12), \quad AR \leftarrow IR(11-0), \quad I \leftarrow IR(15) \end{aligned}

2. Addressing Evaluation at T3T_3​

At timing pulse T3T_3, the control unit inspects D7D_7 and II:

D7′IT3:  AR←M[AR](Indirect Memory Reference: fetch Effective Address)D7′I′T3:  NOP(Direct Memory Reference: Effective Address already in AR)D7I′T3:  Execute Register-Reference Instruction(Execution completes in T3,  SC←0)D7IT3:  Execute I/O Instruction(Execution completes in T3,  SC←0)\begin{aligned} D_7' I T_3 &: \; AR \leftarrow M[AR] && \text{(Indirect Memory Reference: fetch Effective Address)} \\ D_7' I' T_3 &: \; \text{NOP} && \text{(Direct Memory Reference: Effective Address already in } AR\text{)} \\ D_7 I' T_3 &: \; \text{Execute Register-Reference Instruction} && \text{(Execution completes in } T_3, \; SC \leftarrow 0\text{)} \\ D_7 I T_3 &: \; \text{Execute I/O Instruction} && \text{(Execution completes in } T_3, \; SC \leftarrow 0\text{)} \end{aligned}

3. Execution Phase Micro-Operations (T4 to T6T_4 \text{ to } T_6)​

For memory-reference instructions (D7=0D_7 = 0), execution starts at T4T_4 with the effective address guaranteed to reside in ARAR:

Opcode DecoderInstruction MnemonicFull Operation NameExecution Cycle Spans
D0D_0ANDLogical AND to AccumulatorT4 to T5T_4 \text{ to } T_5
D1D_1ADDAdd to Accumulator with Carry (EE)T4 to T5T_4 \text{ to } T_5
D2D_2LDALoad Memory Word to AccumulatorT4 to T5T_4 \text{ to } T_5
D3D_3STAStore Accumulator into MemoryT4T_4 (Single Cycle!)
D4D_4BUNBranch UnconditionallyT4T_4 (Single Cycle!)
D5D_5BSABranch and Save Return AddressT4 to T5T_4 \text{ to } T_5
D6D_6ISZIncrement Memory Word & Skip if ZeroT4 to T6T_4 \text{ to } T_6

Detailed RTL Equations:​

  1. AND to AC (D0D_0):

    • D0T4:  DR←M[AR]D_0 T_4: \; DR \leftarrow M[AR] (Read memory operand into Data Register)
    • D0T5:  AC←AC∧DR,SC←0D_0 T_5: \; AC \leftarrow AC \land DR, \quad SC \leftarrow 0 (Bitwise logical AND, reset counter)
  2. ADD to AC (D1D_1):

    • D1T4:  DR←M[AR]D_1 T_4: \; DR \leftarrow M[AR] (Read operand)
    • D1T5:  AC←AC+DR,E←Cout,SC←0D_1 T_5: \; AC \leftarrow AC + DR, \quad E \leftarrow C_{out}, \quad SC \leftarrow 0 (Sum to AC, carry to E)
  3. LDA: Load to AC (D2D_2):

    • D2T4:  DR←M[AR]D_2 T_4: \; DR \leftarrow M[AR]
    • D2T5:  AC←DR,SC←0D_2 T_5: \; AC \leftarrow DR, \quad SC \leftarrow 0 (Transfer DR to AC via ALU pass-through)
  4. STA: Store AC (D3D_3):

    • D3T4:  M[AR]←AC,SC←0D_3 T_4: \; M[AR] \leftarrow AC, \quad SC \leftarrow 0 (Write AC to memory in a single cycle!)
  5. BUN: Branch Unconditionally (D4D_4):

    • D4T4:  PC←AR,SC←0D_4 T_4: \; PC \leftarrow AR, \quad SC \leftarrow 0 (Directly load target address into PC)
  6. BSA: Branch and Save Return Address (D5D_5):

    • D5T4:  M[AR]←PC,AR←AR+1D_5 T_4: \; M[AR] \leftarrow PC, \quad AR \leftarrow AR + 1 (Save return address at subroutine entry, advance AR)
    • D5T5:  PC←AR,SC←0D_5 T_5: \; PC \leftarrow AR, \quad SC \leftarrow 0 (Jump execution to subroutine body)
  7. ISZ: Increment and Skip if Zero (D6D_6):

    • D6T4:  DR←M[AR]D_6 T_4: \; DR \leftarrow M[AR] (Fetch loop counter from memory)
    • D6T5:  DR←DR+1D_6 T_5: \; DR \leftarrow DR + 1 (Increment counter in Data Register)
    • D6T6:  M[AR]←DR,if (DR=0) then (PC←PC+1),SC←0D_6 T_6: \; M[AR] \leftarrow DR, \quad \text{if } (DR = 0) \text{ then } (PC \leftarrow PC + 1), \quad SC \leftarrow 0

🏭 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.

Out-of-Order Engine

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.

Register RenamingCommon Data Bus (CDB)Speculative Branch Recovery
↓Translates to Silicon Interconnect
Embedded RISC

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.

Dual 32-bit Read PortsSingle 32-bit Write PortForwarding Multiplexers
↓Fabricated with CMOS Standard Cells
Classical Datapath

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.

Time-Multiplexed BusAccumulator BottleneckMicro-sequencer SC

📐 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 (I=1I = 1) located at memory address 10016100_{16}. The instruction word at memory address 10016100_{16} is:

Instruction Word=925016\text{Instruction Word} = 9250_{16}

Memory contents are:

  • M[10016]=925016M[100_{16}] = 9250_{16}
  • M[25016]=050016M[250_{16}] = 0500_{16}
  • M[50016]=002516M[500_{16}] = 0025_{16}
  • Accumulator initial content: AC=001216AC = 0012_{16}, E=0E = 0.

Determine:

  1. The opcode bit pattern and decoded output line DkD_k.
  2. The exact sequence of micro-operations executed cycle-by-cycle from T0T_0 to completion.
  3. The bus selection code (S2S1S0S_2 S_1 S_0) and active register control inputs for each clock cycle.
  4. The final values of ACAC, EE, PCPC, and SCSC.

Step-by-Step Solution​

1. Instruction Word Decoding: Convert 9250169250_{16} to 16-bit binary:

925016=1⏟Bit 15: I  001⏟Bits 14-12: Opcode  0010  0101  0000⏟Bits 11-0: Address 250169250_{16} = \underbrace{1}_{\text{Bit 15: } I} \; \underbrace{001}_{\text{Bits 14-12: Opcode}} \; \underbrace{0010 \; 0101 \; 0000}_{\text{Bits 11-0: Address } 250_{16}}
  • Bit 15=1  ⟹  I=115 = 1 \implies I = 1 (Indirect addressing).
  • Opcode =0012=110  ⟹  = 001_2 = 1_{10} \implies Decoder output D1=1D_1 = 1 (ADD instruction).
  • Address field =25016= 250_{16}.

2. Cycle-by-Cycle Execution Trace:

CycleActive PulseRegister Transfer StatementBus SourceS2S1S0S_2 S_1 S_0Active Register ControlsDescription
0T0T_0AR←PCAR \leftarrow PCPCPC010010LD(AR)LD(AR)PCPC (10016100_{16}) transferred to ARAR.
1T1T_1IR←M[AR],  PC←PC+1IR \leftarrow M[AR], \; PC \leftarrow PC + 1Memory111111LD(IR),  INR(PC)LD(IR), \; INR(PC)Fetch instruction word 9250169250_{16}; PCPC becomes 10116101_{16}.
2T2T_2AR←IR(11-0),  I←IR(15)AR \leftarrow IR(11\text{-}0), \; I \leftarrow IR(15)IRIR101101LD(AR)LD(AR)AR←25016AR \leftarrow 250_{16}, I←1I \leftarrow 1, Opcode decoded (D1=1D_1=1).
3T3T_3AR←M[AR]AR \leftarrow M[AR]Memory111111LD(AR)LD(AR)Read pointer at 25016250_{16}: M[25016]=050016M[250_{16}] = 0500_{16}. AR←50016AR \leftarrow 500_{16}.
4T4T_4DR←M[AR]DR \leftarrow M[AR]Memory111111LD(DR)LD(DR)Read operand at 50016500_{16}: DR←M[50016]=002516DR \leftarrow M[500_{16}] = 0025_{16}.
5T5T_5AC←AC+DR,  E←Cout,  SC←0AC \leftarrow AC + DR, \; E \leftarrow C_{out}, \; SC \leftarrow 0None000000LD(AC),  CLR(SC)LD(AC), \; CLR(SC)AC←001216+002516=003716AC \leftarrow 0012_{16} + 0025_{16} = 0037_{16}. E←0E \leftarrow 0. Reset SCSC.

3. Final Register State:

  • AC=003716AC = 0037_{16}
  • E=0E = 0 (No carry out)
  • PC=10116PC = 101_{16}
  • SC=00002SC = 0000_2 (Instruction completed in exactly 6 clock cycles: T0 to T5T_0 \text{ to } T_5).

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 201620_{16}.

  1. Detail the micro-operations occurring during cycles T4T_4 and T5T_5 of BSA.
  2. Write the exact memory contents at address 15016150_{16} and the value of PCPC after T5T_5.
  3. Write the single instruction and addressing mode that must be placed at the end of the subroutine at memory address 18016180_{16} to return control to the main calling program.

Step-by-Step Solution​

1. Micro-Operations of BSA: Prior to T4T_4:

  • At T0T_0: AR←PC=2016AR \leftarrow PC = 20_{16}.
  • At T1T_1: IR←M[2016],  PC←2116IR \leftarrow M[20_{16}], \; PC \leftarrow 21_{16} (Notice that PCPC is already incremented to point to the instruction after the call!).
  • At T2T_2: AR←15016AR \leftarrow 150_{16}, D5=1D_5 = 1.
  • At T3T_3: I=0I = 0 (direct addressing), NOP.

At execution cycles:

  • Cycle T4T_4: D5T4:  M[AR]←PC,AR←AR+1D_5 T_4: \; M[AR] \leftarrow PC, \quad AR \leftarrow AR + 1
    • PCPC (211621_{16}) is written into memory location M[15016]M[150_{16}].
    • ARAR increments: AR←15016+1=15116AR \leftarrow 150_{16} + 1 = 151_{16}.
  • Cycle T5T_5: D5T5:  PC←AR,SC←0D_5 T_5: \; PC \leftarrow AR, \quad SC \leftarrow 0
    • PCPC is loaded with 15116151_{16}.
    • SCSC is cleared to 0.

2. State After Execution:

  • M[15016]=002116M[150_{16}] = 0021_{16} (Return address stored in the entry slot of the subroutine!).
  • PC=15116PC = 151_{16} (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 15016150_{16}. It issues an indirect unconditional branch:

BUN 150with I=1(Hex Machine Code: C15016)\text{BUN } 150 \quad \text{with } I = 1 \quad (\text{Hex Machine Code: } C150_{16})

During execution of BUN 150 (I=1):

  • At T2T_2: AR←15016AR \leftarrow 150_{16}.
  • At T3T_3: AR←M[AR]=M[15016]=02116AR \leftarrow M[AR] = M[150_{16}] = 021_{16}.
  • At T4T_4: PC←AR=02116PC \leftarrow AR = 021_{16}. The calling program resumes seamlessly at address 211621_{16}.

Example 3: Datapath Bus Contention & Latency Comparison​

Problem Statement​

An arithmetic logic instruction performs an in-memory accumulation:

Instruction: AC←AC+M[Raddr]\text{Instruction: } AC \leftarrow AC + M[R_{\text{addr}}]

Compare the cycle latency and intermediate register requirements between:

  1. A Single Common Bus datapath where memory output drives the bus directly.
  2. 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).
  3. If the clock frequency is 1 GHz1 \text{ GHz} 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 ARAR: AR←RaddrAR \leftarrow R_{\text{addr}}. (Bus used by RaddrR_{\text{addr}}).
  • Cycle 2: Read memory operand into DRDR: DR←M[AR]DR \leftarrow M[AR]. (Bus used by Memory).
  • Cycle 3: Perform ALU addition and latch result: AC←AC+DRAC \leftarrow AC + DR. (Bus is free or used for latching).

Total clock cycles on Single-Bus = 3 cycles3 \text{ cycles}.

2. Dual-Bus Datapath Execution: With two independent buses (Bus A and Bus B) and direct ALU output feedback to ACAC:

  • Cycle 1: Place RaddrR_{\text{addr}} on Bus A; latch into ARAR: AR←RaddrAR \leftarrow R_{\text{addr}}.
  • Cycle 2: Memory reads operand directly onto Bus B while ACAC is routed onto Bus A. The ALU computes AC+M[AR]AC + M[AR] continuously and latches the final sum directly into ACAC on the next clock edge!

Total clock cycles on Dual-Bus = 2 cycles2 \text{ cycles}.

3. Execution Time & Speedup:

Tsingle=3×1109 Hz=3.0 nsT_{\text{single}} = 3 \times \frac{1}{10^9 \text{ Hz}} = 3.0 \text{ ns} Tdual=2×1109 Hz=2.0 nsT_{\text{dual}} = 2 \times \frac{1}{10^9 \text{ Hz}} = 2.0 \text{ ns} Speedup=TsingleTdual=32=1.50×(33.33% latency reduction)\text{Speedup} = \frac{T_{\text{single}}}{T_{\text{dual}}} = \frac{3}{2} = 1.50 \times \quad (33.33\% \text{ latency reduction})

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  1. Why is the Address Register (ARAR) sized at 12 bits while the Data Register (DRDR) is 16 bits?

    • The memory capacity is 4096 words=212 words4096 \text{ words} = 2^{12} \text{ words}. Hence, exactly 12 bits are required to address any memory location (212=40962^{12} = 4096). 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 DRDR and 16-bit data bus lines.
  2. 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 3×83 \times 8 multiplexer select circuit or tri-state enable decoders physically guarantee that at most one source (S2S1S0S_2 S_1 S_0) is gated onto the bus lines in any given clock cycle.
  3. Why does BSABSA 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 (SPSP) register. Storing the return address at M[subroutine_entry]M[\text{subroutine\_entry}] 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!
Common Interview Traps
  • Trap 1: Assuming PCPC increments during the Execute phase (T4 to T6T_4 \text{ to } T_6).
    • In reality, PCPC auto-increments at T1T_1 during the Fetch phase (IR←M[AR],  PC←PC+1IR \leftarrow M[AR], \; PC \leftarrow PC + 1). By the time execution begins, PCPC already points to the next sequential instruction. This is why branching instructions must explicitly overwrite PCPC (PC←ARPC \leftarrow AR).
  • Trap 2: Believing T3T_3 is an execution cycle for all instructions.
    • For direct memory-reference instructions (D7′I′T3D_7' I' T_3), cycle T3T_3 performs no operation (NOP) because the effective address was already latched into ARAR during T2T_2. T3T_3 only performs a memory read (AR←M[AR]AR \leftarrow M[AR]) if indirect addressing (I=1I = 1) is asserted.
  • Trap 3: Confusing Register Clear (CLRCLR) with Sequence Counter Clear (CLR(SC)CLR(SC)).
    • Clearing a data register (AC←0AC \leftarrow 0) zeroes the register's contents. Clearing the sequence counter (SC←0SC \leftarrow 0) terminates the current instruction's execution cycle and resets the timing state machine to T0T_0 to begin the next instruction fetch.

💬

Discussion & Doubts