G27
Self-checkedTier 1 14 min readcoa.datapath

Single-bus datapath and register transfer

The registers, ALU and bus that execute instructions: the control signals, the sequence of control steps for fetch and for ADD and LOAD, why a single bus needs the temporary registers Y and Z, memory access with WMFC, and how steps translate into clocks.

Why it exists

The instruction cycle describes what has to happen; the datapath is the hardware that makes it happen. It consists of registers, an ALU, the buses that connect them, and the control signals that open and close the connections. Each control signal is a switch: put this register on the bus, load that register from the bus, make the ALU add, start a memory read. A control step is one clock period during which a set of such switches is closed. An instruction is a sequence of control steps, and the control unit's only job is to produce the right signals in the right order. GATE asks for the control sequence of an instruction on a given datapath, the number of steps it takes, why certain registers exist, and how timing translates to clock rate.

Prerequisites

You need registers and their load control from registers and shift registers, and the ALU from ALU design.

Precise definitions

Single-bus datapath. All registers, the ALU's input and the memory interface are connected to one shared bus. The components:

  • PC, MAR, MDR, IR as in the instruction cycle; general registers R0…RnR_0 \ldots R_n.
  • Y: a temporary register that holds one ALU operand. Z: a temporary register that holds the ALU result. They exist because the bus can carry only one value at a time, while the ALU needs two operands: one comes from Y and the other from the bus, and the result is held in Z until the bus is free to move it to its destination.
  • ALU: its first input is Y or the constant 4 (a multiplexer selects it with SelectY or Select4), its second input is the bus.
  • Memory interface: the memory address is taken from MAR and the data goes through MDR. The Read signal starts a read; WMFC ("wait for memory function completed") stalls the control until the memory has delivered the word into MDR.

Control signals. For each register RR: RinR_{in} loads it from the bus at the end of the control step; RoutR_{out} puts its contents on the bus during the step. Rules:

  1. At most one RoutR_{out} signal may be active in a step (otherwise two registers fight over the bus).
  2. Any number of RinR_{in} signals may be active (several registers can load the same bus value).
  3. A register loaded in a step is not available on the bus until the next step (values are latched at the end of the step).

Control sequences (this page's datapath; +4+4 because instructions are 4 bytes). The fetch, common to all instructions:

StepActive control signalsTransfer
1PCout, MARin, Read, Select4, Add, ZinMAR ←\leftarrow PC; Z ←\leftarrow PC + 4; start the read
2Zout, PCin, Yin, WMFCPC ←\leftarrow Z; Y ←\leftarrow Z; wait for the memory (MDR gets the instruction)
3MDRout, IRinIR ←\leftarrow MDR

Execution of ADD R1,R2 (R1 ←\leftarrow R1 + R2):

StepSignalsTransfer
4R1out, YinY ←\leftarrow R1
5R2out, SelectY, Add, ZinZ ←\leftarrow Y + R2
6Zout, R1in, EndR1 ←\leftarrow Z; start the next fetch

Execution of LOAD R3,(R2) (R3 ←\leftarrow M[R2]):

StepSignalsTransfer
4R2out, MARin, ReadMAR ←\leftarrow R2; start the read
5WMFCwait for the word to arrive in MDR
6MDRout, R3in, EndR3 ←\leftarrow MDR

So both instructions take 6 control steps in this design. An instruction with a memory operand such as ADD R1,(R2) takes 7 (fetch 3, then R2out/MARin/Read; R1out/Yin/WMFC; MDRout/SelectY/Add/Zin; Zout/R1in/End), because the memory read adds a step.

Clocks per instruction. With a fast memory every control step is one clock. A slow memory makes the step with WMFC last as many clocks as the memory needs: with a 3-clock read the fetch takes 1+3+1=51 + 3 + 1 = 5 clocks, ADD R1,R2 takes 5+3=85 + 3 = 8, and LOAD R3,(R2) takes 5+1+3+1=105 + 1 + 3 + 1 = 10.

Clock period. It must be at least the delay of the slowest control step: the time for a register to drive the bus, the bus to settle, the ALU to compute (when used) and the destination register's setup time. Steps that use the ALU are the longest, which is why the ALU delay sets the clock.

Multiple-bus organisations. With two or three buses (for example one for the source registers and one for the destination) the ALU's two operands and its result can move at the same time, so Y and Z are not needed and instructions take fewer steps (the textbook three-bus design executes the same ADD in four control steps instead of six), at the cost of more wiring and gates.

How it works

Step through the two instructions. The rtl line is the set of control signals active in that control step. In each step only one register drives the bus, and every register loaded in the step shows its new value in the next table row.

Single-bus datapath: ADD R1,R2 then LOAD R3,(R2): step 1

Machine run, not typed
start(PC = 100)
PC
100
MAR
0
MDR
0
IR
-
Y
0
Z
0
R1
5
R2
8
R3
0
addrcontentsmeaning
064ADD R1,R2instructionPC
068LOAD R3,(R2)instruction
00842data

Step 1

A single-bus datapath: PC, MAR, MDR, IR, the ALU with its temporary registers Y and Z, and general registers R1 to R3. Every transfer goes over the one bus, so each control step lets only ONE register drive the bus. Two instructions are in memory; R1 = 5 and R2 = 8 (the address of the data word 42).

1 / 13
computed by script: a simulation of the machine, one register transfer per step. python3 scripts/gen-coa-traces.py

Worked examples

EX 1The control steps in a program

Easy

The C program executes the control-step table on a model of the datapath: it rejects a step with two bus drivers, latches loaded registers at the end of each step and completes a memory read at WMFC.

#include <stdio.h>
 
enum {
    PCout = 1 << 0, PCin = 1 << 1, MARin = 1 << 2, MDRout = 1 << 3, IRin = 1 << 4, Yin = 1 << 5, Zin = 1 << 6, Zout = 1 << 7,
    R1out = 1 << 8, R1in = 1 << 9, R2out = 1 << 10, R3in = 1 << 11, Read = 1 << 12, WMFC = 1 << 13, Select4 = 1 << 14,
    SelectY = 1 << 15, Add = 1 << 16, End = 1 << 17
};
#define OUTS (PCout | MDRout | Zout | R1out | R2out)
 
static const int fetch[3] = { PCout | MARin | Read | Select4 | Add | Zin, Zout | PCin | Yin | WMFC, MDRout | IRin };
static const int add_seq[3] = { R1out | Yin, R2out | SelectY | Add | Zin, Zout | R1in | End };
static const int load_seq[3] = { R2out | MARin | Read, WMFC, MDRout | R3in | End };
 
static int pc = 100, mar, mdr, ir, y, z, r1 = 5, r2 = 8, r3;
static int mem[64];                                   /* word index = byte address / 4: 1 = ADD R1,R2   2 = LOAD R3,(R2) */
static int pending;
 
/* one control step: at most one register may drive the bus; everything loaded is latched at the end of the step */
static int step(int s) {
    int drivers = s & OUTS;
    if (drivers & (drivers - 1)) return -1;           /* two drivers on the bus */
    int bus = 0;
    if (s & PCout) bus = pc;
    if (s & MDRout) bus = mdr;
    if (s & Zout) bus = z;
    if (s & R1out) bus = r1;
    if (s & R2out) bus = r2;
    int alu = ((s & Select4) ? 4 : y) + bus;
    int npc = pc, nmar = mar, nmdr = mdr, nir = ir, ny = y, nz = z, nr1 = r1, nr3 = r3;
    if (s & PCin) npc = bus;
    if (s & MARin) nmar = bus;
    if (s & IRin) nir = bus;                          /* the bus carries MDR during the IRin step */
    if (s & Yin) ny = bus;
    if ((s & Zin) && (s & Add)) nz = alu;
    if (s & R1in) nr1 = bus;
    if (s & R3in) nr3 = bus;
    if (s & Read) pending = 1;
    if (s & WMFC) { nmdr = mem[mar / 4]; pending = 0; }
    pc = npc; mar = nmar; mdr = nmdr; ir = nir; y = ny; z = nz; r1 = nr1; r3 = nr3;
    return 0;
}
 
int main(void) {
    mem[100 / 4] = 1;
    mem[104 / 4] = 2;
    mem[8 / 4] = 42;
    int steps = 0;
    for (int instr = 0; instr < 2; instr++) {
        for (int i = 0; i < 3; i++) { step(fetch[i]); steps++; }
        const int *seq = ir == 1 ? add_seq : load_seq;
        for (int i = 0; i < 3; i++) { step(seq[i]); steps++; }
        printf("after %s: PC = %d, R1 = %d, R3 = %d, %d control steps so far\n", ir == 1 ? "ADD R1,R2" : "LOAD R3,(R2)", pc, r1, r3, steps);
    }
    printf("two drivers on the bus (R1out + R2out) rejected: %s\n", step(R1out | R2out) < 0 ? "yes" : "no");
    return 0;
}
after ADD R1,R2: PC = 104, R1 = 13, R3 = 0, 6 control steps so far
after LOAD R3,(R2): PC = 108, R1 = 13, R3 = 42, 12 control steps so far
two drivers on the bus (R1out + R2out) rejected: yes

Reading it. After ADD R1,R2 the PC is 104 (fetch step 1 computed 100+4100 + 4) and R1 = 5+8=135 + 8 = 13. After LOAD R3,(R2), R3 = 42 (the word at address 8, the value held in R2), and the PC is 108. Each instruction used 6 control steps (12 in all). The last line shows that asserting R1out and R2out together is a bus conflict.

EX 2Why Y and Z?

Easy

For ADD R1,R2 the ALU needs both R1 and R2 at the same time. The single bus can carry only one of them. So R1 is first moved to Y (step 4); in step 5 R2 is on the bus and Y supplies the first operand; the sum goes into Z because the bus is busy with R2 in that very step and the result can only travel in the next step (step 6, Zout, R1in). Without Y and Z the addition could not be done with one bus.

EX 3A memory operand

Medium

ADD R1,(R2) adds the memory word addressed by R2 to R1. After the 3-step fetch: step 4: R2out, MARin, Read (the address goes to MAR and the read starts). Step 5: R1out, Yin, WMFC (R1 goes to Y while we wait for the memory; the word arrives in MDR). Step 6: MDRout, SelectY, Add, Zin (the memory word is on the bus, Y supplies R1, the sum is in Z). Step 7: Zout, R1in, End. Total 7 steps. With R1=5R1 = 5 and M[8]=42M[8] = 42 (R2=8R2 = 8) the result is 47. The checking script runs this sequence on the datapath model.

EX 4Clocks with a slow memory

Medium

If a memory read takes 3 clock cycles, the control step with WMFC lasts 3 clocks and every other step 1. Fetch: 1+3+1=51 + 3 + 1 = 5. ADD R1,R2: 5+3=85 + 3 = 8 (no WMFC in the execute steps). LOAD R3,(R2): 5+(1+3+1)=105 + (1 + 3 + 1) = 10. For a mix of 60% adds and 40% loads the average is 0.6×8+0.4×10=8.80.6 \times 8 + 0.4 \times 10 = 8.8 clocks per instruction. With a fast memory both would take 6 and the average would be 6.

EX 5Clock period of a control step

GATE level

Suppose a register output takes 1 ns to drive the bus, the bus settles in 1 ns, the ALU takes 4 ns, and the destination register's setup time is 1 ns. The slowest step (one that goes through the ALU, such as step 5 of ADD) takes 1+1+4+1=71 + 1 + 4 + 1 = 7 ns, so the clock period is at least 7 ns (a frequency of about 143 MHz). A step that only moves a register to another takes about 1+1+1=31 + 1 + 1 = 3 ns and is limited to the same period because all steps share one clock.

EX 6Spot the invalid step

GATE level

A proposed step is "R1out, R2out, Add, Zin" with the idea of adding R1 and R2 directly. It is invalid on a single bus: two registers (R1 and R2) would drive the bus at once. The correct version uses two steps and the register Y (step 4: R1out, Yin; step 5: R2out, SelectY, Add, Zin). Any step with two *_out signals, or one that reads a register loaded in the same step, is wrong.

Cheat box

Cheat box

  • Single bus: one RoutR_{out} per step; any number of RinR_{in}; loaded values appear in the next step.
  • Y holds one ALU operand, Z holds the result (the bus carries the other operand).
  • Fetch: (1) PCout, MARin, Read, Select4, Add, Zin; (2) Zout, PCin, Yin, WMFC; (3) MDRout, IRin.
  • ADD R1,R2: R1out Yin; R2out SelectY Add Zin; Zout R1in End (6 steps with the fetch).
  • LOAD R3,(R2): R2out MARin Read; WMFC; MDRout R3in End (6 steps).
  • Memory-operand ADD: 7 steps. Slow memory: the WMFC step lasts as many clocks as the memory needs.
  • Clock period ≥\ge the longest step (register out + bus + ALU + setup). More buses mean fewer steps.

Traps and GATE patterns

Connections

The sequence of micro-operations here is the register-transfer description of the instruction cycle. The signals are produced either by a hardwired control unit or by a microprogrammed one. The registers are the registers of the digital logic part, and the ALU is ALU design. Pipelining replaces one long multi-step execution by overlapping the steps of several instructions.

PYQs

4 previous year questions from your book. I re-solved each one myself (0 by running or simulating, 4 by reasoning only); the book's key is shown next to my answer. All PYQs

GATE 2025 · MSQQ1 · page 490 of the book
A partial data path of a processor is given in the
figure, where RA, RB, and RZ are 32-bit registers.
Which option(s) is/are CORRECT related to
arithmetic operations using the data path as shown?
  • (a)The data path can implement arithmetic operations involving two registers.
  • (b)The data path can implement arithmetic operations involving one register and one immediate value.
  • (c)The data path can implement arithmetic operations involving two immediate values.
  • (d)The data path can only implement arithmetic operations involving one register and one immediate value.
GATE 2020 · MCQ · 1 markQ2 · page 490 of the book
Consider the following data path diagram

Consider an instruction: R0 ← R1 + R2. The
following steps are used to execute it over the given
data path. Assume that the PC is incremented
appropriately. The subscripts r and w indicate read
and write operations, respectively.
1. R2r TEMP1r, ALUadd, TEMP2w
2. R1r TEMP1w,
3. PCr, MARw, MEMr
4. TEMP2r, R0w
5. MDRr, IRw
Which one of the following is the correct order of
execution of the above steps?
  • (a)2,1,4,5,3
  • (b)1,2,4,3,5
  • (c)3,5,2,1,4
  • (d)3,5,1,2,4
GATE 2005 · MCQ · 2 marksQ6 · page 491 of the book
The following data path of a CPU

The ALU, the bus and all the registers in the data
path are of identical size. All operations including
incrementation of the PC and the GPRs are to be
carried out in the ALU. Two clock cycles are
needed for memory read operation—the first one
for loading addresses in the MAR and the next one
for loading data from the memory bus into the
MDR.
The instruction "add R0, R1" has the register
transfer interpretation
R0 ← R0 + R1.
The minimum number of cycles needed for
execution cycle of this instruction is
  • (a)2
  • (b)3
  • (c)4
  • (d)5
GATE 2005 · MCQ · 2 marksQ7 · page 491 of the book
Consider the following data path of a CPU.

The ALU, the bus and all the registers in the data
path are of identical size. All operations including
incrementation of the PC and the GPRs are to be
carried out in the ALU. Two clock cycles are
needed for memory read operation - the first one
for loading address in the MAR and the next one
for loading data from the memory bus into the
MDR.
The instruction "call Rn, sub" is a two word
instruction. Assuming that PC is incremented
during the fetch cycle of the first word of the
instruction, its register transfer interpretation is
Rn ← PC + 1
PC ← M[PC]
The minimum number of CPU clock cycles needed
during the execution cycle of this instruction is:
  • (a)2
  • (b)3
  • (c)4
  • (d)5 Computer Organization and Architecture
  • (a)S5 = T1 + I2 ⋅ T3 and

Self-check

Question 1

How many control steps does ADD R1,R2 need on the single-bus datapath, including the fetch?

Show answer

6: three for the fetch and three for the execution (R1out Yin; R2out SelectY Add Zin; Zout R1in End).

Question 2

Why can the sum of ADD R1,R2 not be moved to R1 in the same step in which it is computed?

Show answer

The ALU result is latched into Z at the end of the step; the bus is busy with R2 during that step, and Z can only drive the bus in the next step.

Question 3

A memory read takes 4 clocks. How many clocks does the fetch take (steps 1 to 3)?

Show answer

Steps 1 and 3 take 1 clock each and the WMFC step takes 4: 1+4+1=61 + 4 + 1 = 6 clocks.

Question 4

Which signals are active in step 3 of the fetch, and what do they do?

Show answer

MDRout and IRin: the instruction word in MDR is put on the bus and loaded into IR.

Revision card

One-screen revision

  • Single bus: one source per step; Y and Z hold the ALU operand and result.
  • Fetch 3 steps; ADD R1,R2 3 more; LOAD R3,(R2) 3 more; memory-operand ADD 4 more.
  • WMFC waits for memory; slow memory stretches that step.
  • Clock period = slowest step; more buses = fewer steps.

References

  • ·Hamacher, Vranesic, Zaky, Computer Organization, 5th ed., Chapter 7 Basic Processing Unit (single-bus organization, control sequences, multiple-bus organization)
  • ·Hennessy and Patterson, Computer Organization and Design, Chapter 4 The Processor (datapath, multicycle implementation)
  • ·Morris Mano, Computer System Architecture, 3rd ed., Chapter 7 Micro-programmed Control and Chapter 8 (CPU organization)

Verification

The control-step table (fetch, ADD, LOAD, and ADD with a memory operand) is executed by a simulator of the single-bus datapath that rejects two drivers on the bus and requires a read to be completed by WMFC; tests/coa-traces.test.ts re-checks the animation (one bus driver per step, WMFC completes the read, final R1 = 13, R3 = 42, PC advances by 4) and scripts/enum-checks/coa_alu.py recomputes the sequences, the 7-step memory-operand ADD and the clock counts with a slow memory. A C program (npm run verify:c) is a second implementation. The sequences follow the textbook single-bus design; other books split the steps differently (for example merging the PC increment into the memory read), and the three-bus figures quoted are the textbook's, not simulated here. Textbook chapter titles are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand (long C programs were not re-read line by line: they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose). No defect found. Status raised to self-checked; verified needs a textbook or human check.

last verified: never