Inside the Processor: ALU, Registers, Control Unit and Buses

When a program runs, a handful of hardware units inside the processor carry out every instruction, working in step with a clock. CPU organization describes those units: what each one computes or stores, how they cooperate on a single instruction, and how they exchange data with main memory. Knowing the organization lets you trace an instruction through the processor. It also lets you calculate limits such as how much memory a processor can reach and how fast its bus can move data.

Three functional units

The arithmetic logic unit (ALU) performs the processor's calculations: addition, subtraction, comparison and bitwise operations such as AND, OR and NOT. Flag-setting operations update the relevant status flags, for example whether the result was zero or produced a carry. Other operations can preserve the existing flags.


A register is a small storage location inside the CPU that holds one binary word and can be read or written within a single clock cycle. General-purpose registers hold operands and results. Special-purpose registers have fixed jobs, summarized below.


Register

What it holds

Role

Program counter (PC)

Address of the next instruction

Advanced during each fetch; changed by jumps and branches

Memory address register (MAR)

Address about to be accessed

Drives the address bus

Memory data register (MDR)

Word just read or about to be written

Connects to the data bus

Instruction register (IR)

Instruction being decoded

Read by the control unit

Accumulator or general-purpose registers

Operands and results

Inputs and outputs of the ALU

Status register

Zero, carry, negative and overflow flags

Tested by conditional branches



The control unit reads the opcode in the instruction register and decodes it. It then issues control signals that select the ALU operation, choose which registers are read and written, and start memory reads or writes. It moves and sequences data but does not compute results itself.



The system bus

The system bus is the set of parallel signal lines that connects the CPU to main memory and input/output devices. Its lines fall into three groups:

  • Address bus: carries the location being accessed, from the CPU to memory.
  • Data bus: carries the value being read or written, in either direction.
  • Control bus: carries timing and command signals such as read, write, clock and interrupt requests.


Block diagram of a CPU containing a control unit, an ALU and a set of registers, linked to main memory by an address bus, a data bus and a control bus.


Each address line carries one bit, so nn lines can form 2n2^n different addresses. The data bus width ww, in bits, sets how much moves in each transfer, and the number of transfers per second ff sets the pace. The same counting idea fixes the size of an instruction field that selects one of RR registers:


N=2n,Bpeak=w8 f,k=⌈log⁡2R⌉N = 2^{n}, \qquad B_{\text{peak}} = \frac{w}{8}\, f, \qquad k = \lceil \log_2 R \rceil


Here NN is the number of addressable locations, BpeakB_{\text{peak}} is the peak bandwidth in bytes per second, and kk is the number of bits in a register field. The bandwidth is a peak because real buses lose cycles to wait states and control overhead.


Example: A processor with a 16-bit address bus can select 216 = 65,536 locations. If memory is byte-addressable, that is 64 KiB. If its 16-bit data bus completes 8 million transfers per second, it moves at most 2 bytes × 8 × 106 per second = 16 MB/s. With 16 registers, a register field needs log2 16 = 4 bits.



Register transfers in one instruction

Use a simplified serial processor model that handles one instruction at a time. In this model, only the MAR drives the address bus and only the MDR exchanges words with the data bus, so every memory access passes through that pair. The arrow below means the value on the right is copied into the register on the left.

  1. MAR←PC\text{MAR} \leftarrow \text{PC}: the address of the next instruction goes onto the address bus.
  2. MDR←Memory[MAR]\text{MDR} \leftarrow \text{Memory}[\text{MAR}], while the PC advances to the following instruction.
  3. IR←MDR\text{IR} \leftarrow \text{MDR}: the instruction is now inside the CPU.
  4. The control unit decodes the opcode in the IR.
  5. Execution depends on the instruction: arithmetic uses the ALU, loads and stores use the MAR and MDR again, and a taken branch changes the PC. Flag-setting operations update the relevant flags; other operations can preserve them.

The first four steps describe common fetch and decode stages in this model. Execution does not require every instruction to use every unit or access memory for an operand.

What to remember

  • The ALU computes; flag-setting operations update relevant flags, while other operations can preserve them. Registers hold words, and the control unit decodes and sequences instructions.
  • The PC, MAR, MDR, IR and status register each have one fixed job.
  • The address bus is one-way and sets reach: N=2nN = 2^n locations.
  • The data bus is two-way and sets bytes per transfer: Bpeak=(w/8) fB_{\text{peak}} = (w/8)\, f.
  • Selecting one of RR registers takes ⌈log⁡2R⌉\lceil \log_2 R \rceil bits.

Example: Sizing the buses of an embedded processor

An embedded processor has a 24-bit address bus and a 32-bit data bus. Memory is byte-addressable, and the bus completes one transfer per clock cycle at 100 MHz with no wait states. Use 1 MiB = 220 bytes and 1 MB/s = 106 bytes per second.



a) What is the largest main memory, in MiB, that the processor can address?


Each address line carries one bit, so 24 lines form 2242^{24} = ________ distinct addresses. Because memory is byte-addressable, each address names one byte, so the reachable memory is 2242^{24} bytes. Convert to mebibytes by dividing by 2202^{20}:


224 B220 B/MiB=24 MiB=16 MiB\frac{2^{24}\ \text{B}}{2^{20}\ \text{B/MiB}} = 2^{4}\ \text{MiB} = 16\ \text{MiB}


The processor can address at most 16 MiB of main memory.


b) What is the peak bandwidth of the data bus, in MB/s?


A 32-bit data bus moves 32 ÷ 8 = ________ per transfer. At one transfer per cycle and 100 MHz, the bus makes ________ transfers per second. Multiply the two:


Bpeak=w8 f=(4 B)(100×106 s−1)=400×106 B/s=400 MB/sB_{\text{peak}} = \frac{w}{8}\, f = (4\ \text{B})(100 \times 10^{6}\ \text{s}^{-1}) = 400 \times 10^{6}\ \text{B/s} = 400\ \text{MB/s}


The peak data bandwidth is 400 MB/s.


c) The processor reads a 64-byte block of consecutive memory with back-to-back transfers. How long does the read take, in nanoseconds?


Each transfer carries 4 bytes, so the block needs 64 ÷ 4 = ________ transfers, one per clock cycle. The clock period is the reciprocal of the frequency, T=1/(100×106 Hz)T = 1/(100 \times 10^{6}\ \text{Hz}), which is ________. The total time is


t=16×10 ns=160 nst = 16 \times 10\ \text{ns} = 160\ \text{ns}


Reading the block takes 160 ns.


d) The designer widens the data bus to 64 bits and changes nothing else. What are the new answers to parts a), b) and c)?


The address bus still has 24 lines, so addressable memory is unchanged at 16 MiB: the data bus width plays no part in N=2nN = 2^n.


The data bus now moves 64 ÷ 8 = ________ per transfer, so the peak bandwidth doubles:


Bpeak=(8 B)(100×106 s−1)=800 MB/sB_{\text{peak}} = (8\ \text{B})(100 \times 10^{6}\ \text{s}^{-1}) = 800\ \text{MB/s}


The 64-byte block now needs 64 ÷ 8 = ________ transfers, so the read takes 8×10 ns=80 ns8 \times 10\ \text{ns} = 80\ \text{ns}.


The new answers are 16 MiB, 800 MB/s and 80 ns. Widening the data bus speeds up transfers but does not let the processor reach more memory.

Match each part of a processor's organization with the job it performs while a program runs. Each description is used exactly once.

Match each term
A.

Holds condition flags, each reflecting its most recent relevant flag-setting operation

B.

Holds the address of the next instruction to be fetched

C.

Decodes the opcode and issues the signals that sequence every other part

D.

Performs addition, comparison and bitwise operations on operands

E.

Holds the instruction currently being decoded

F.

Holds the word just read from, or about to be written to, main memory

G.

Holds the location being read or written and drives the address lines

Status register

Memory address register

Program counter

Arithmetic logic unit

Memory data register

Instruction register

Control unit

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A microcontroller has a 20-bit address bus and a 16-bit data bus, and its memory is byte-addressable. An engineer redesigns it with a 32-bit data bus but leaves the address bus at 20 lines. The bus clock frequency, transfer protocol and number of transfers per clock cycle remain unchanged. Which statement describes the effect of the redesign?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A processor has a 32-bit address bus with byte-addressable memory and a 64-bit data bus that completes one transfer per clock cycle at 200 MHz. Find the maximum addressable memory in GiB (1 GiB = 230 bytes), the peak data bus bandwidth in MB/s (1 MB = 106 bytes), and the time in ns to read 512 consecutive bytes using back-to-back transfers with no wait states. Give each answer as a whole number.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice