1. Gyanastra
  2. Computer Organisation and Architecture
  3. UGC NET: Basic Computer Design and Programming
  4. Timing Control and Instruction Cycle
Free lesson, no account needed 14 min read 23 practice questions after it

Computer Organisation and Architecture · UGC NET: Basic Computer Design and Programming

Timing Control and Instruction Cycle

Overview

Every instruction in the basic computer is broken into microoperations (elementary register transfers), and the timing and control unit decides which microoperation happens in which clock cycle.
It converts the system clock into a one-hot sequence of timing signals T0, T1, T2, … and ANDs them with the decoded opcode to switch the right control lines on.
This lesson covers that unit and the full instruction cycle — fetch, decode, indirect, execute and interrupt — together with the exact number of timing signals each instruction class consumes.
It belongs to Basic Computer Design and Programming and is the base for microoperation-tracing, match-the-list and interrupt-cycle questions.
Prerequisites: register-transfer notation, memory read/write, decoders, binary counters and instruction formats.

Key concepts

Timing and control

  • Clock: periodic square wave; the interval between two consecutive active edges is one clock cycle or T-state, T=1/fT = 1/f. Convention used here (Mano's basic computer): one timing signal lasts exactly one clock cycle.
  • Timing signal: one of T0 … T15. Exactly one is high in any cycle (one-hot). T0 marks the start of every instruction cycle.
  • Sequence counter (SC): a 4-bit binary up-counter clocked by the system clock; its output feeds a 4 × 16 decoder that produces T0–T15. A microoperation "SC ← 0" clears it, so the next instruction restarts at T0.
  • Ring counter: alternative one-hot generator — a shift register with a single 1 circulating; no decoder is needed but it uses more flip-flops. Its timing behaviour (one-hot, cyclic, cleared each cycle) is identical.
  • Hardwired control unit: gates, flip-flops, decoders and the sequence counter. Each control signal is a Boolean function of timing signals and decoded opcode, e.g. INR(PC)=T1+D6T5INR(PC) = T_1 + D_6T_5. Fast, but a design change needs rewiring.
  • Microprogrammed control unit: the control word is stored in a control memory (ROM); each microinstruction selects a set of microoperations. Flexible, slower.

Data path and instruction format

  • Registers: AR 12 bits, PC 12 bits, DR 16, AC 16, IR 16, TR 16, INPR/OUTR 8, E 1 (carry-out of AC), SC 4. Memory is 4096 words × 16 bits.
  • Instruction word: I (bit 15) | opcode (bits 14–12) | address (bits 11–0); I = 0 direct, I = 1 indirect.
  • Opcode decoder: 3 × 8 decoder on IR(12–14) giving D0 AND, D1 ADD, D2 LDA, D3 STA, D4 BUN, D5 BSA, D6 ISZ, D7 for code 111.
    D7 = 1 means register-reference (if I = 0) or input–output (if I = 1); D7 = 0 means memory-reference.
  • Instruction cycle = fetch + decode + (indirect) + execute + (interrupt cycle). Fetch is always the same three timing signals.

Interrupts

  • Interrupt request is sampled after the execute phase of every instruction, never mid-instruction.
  • The basic computer tests (IEN)(FGI+FGO)(IEN)(FGI + FGO); IEN = interrupt enable flip-flop, FGI/FGO = input/output flags. IEN = 1 means the interrupt is enabled (unmasked); IEN = 0 means masked.
  • In a programmable interrupt controller: IRR (Interrupt Request Register) latches all incoming requests, IMR (Interrupt Mask Register) holds the mask bits, ISR (In-Service Register) records the request being serviced.
  • Classification: external/hardware (from I/O devices) vs internal/software; maskable vs non-maskable; with respect to the clock, synchronous (caused by instruction execution, e.g. divide-by-zero) vs asynchronous (external, unrelated to the clock).

How it works

1. Generating the timing signals

The clock increments SC; the decoder turns the counter value into a single active timing signal. Control logic combines T-signals, D-signals and status bits into signals such as LD(AR)LD(AR), INR(PC)INR(PC), READREAD, WRITEWRITE.

2. Fetch and decode — identical for every instruction

  1. T0: AR ← PC. The instruction address is placed in the address register.
  2. T1: IR ← M[AR], PC ← PC + 1. Memory is read into DR and then loaded into IR (writing "IR ← M[AR]" is the standard shorthand for that read-and-load). PC is incremented here, so PC already holds the return address.
  3. T2: D0 … D7 ← decode IR(12–14), AR ← IR(0–11), I ← IR(15). The opcode decoder is enabled and the decoded outputs become effective at T2; the address part moves to AR and the mode bit to I.

3. Choosing the next phase at T2/T3

  • D7 = 1 → register-reference (I = 0) or input–output (I = 1); execute at T3.
  • D7 = 0, I = 1 → indirect phase at T3; memory-reference execution starts at T4.
  • D7 = 0, I = 0 → T3 does nothing (the timing signal still occurs); memory-reference execution starts at T4.

4. Indirect phase (only when D7 = 0 and I = 1)

T3: DR ← M[AR]; AR ← DR(0–11), i.e. AR ← M[AR]. AR now holds the effective address. With I = 0 the same T3 is an idle step, so direct and indirect instructions take the same number of timing signals.

5. Execute phase — memory-reference instructions

In the basic computer (Mano's design) every memory-reference instruction executes from T4, whether I = 0 or I = 1: T3 is either the indirect step or an idle step.

InstructionMicrooperationsDirect (I = 0)Indirect (I = 1)
ANDDR ← M[AR]; AC ← AC ∧ DR, SC ← 0T4, T5T4, T5
ADDDR ← M[AR]; AC ← AC + DR, E ← CoutC_{out}, SC ← 0T4, T5T4, T5
LDADR ← M[AR]; AC ← DR, SC ← 0T4, T5T4, T5
STAM[AR] ← AC, SC ← 0T4T4
BUNPC ← AR, SC ← 0T4T4
BSAM[AR] ← PC, AR ← AR + 1; PC ← AR, SC ← 0T4, T5T4, T5
ISZDR ← M[AR]; DR ← DR + 1; M[AR] ← DR, if DR = 0 then PC ← PC + 1, SC ← 0T4, T5, T6T4, T5, T6

Every path ends with SC ← 0, which restarts the fetch at T0 for the next instruction.

6. Register-reference and input–output instructions

At T3, with D7 = 1: if I = 0, execute the register operation and clear SC;
if I = 1, execute the I/O operation and clear SC. One-hot bit in IR(0–11): CLA AC ← 0, CLE E ← 0, CMA AC ← ~AC, CME E ← ~E, CIR AC ← shr AC with E in/out, CIL AC ← shl AC with E in/out, INC AC ← AC + 1, SPA/SNA/SZA/SZE PC ← PC + 1 if AC(15) = 0 / AC(15) = 1 / AC = 0 / E = 0, HLT S ← 0.
I/O codes in IR(6–11): INP, OUT, SKI, SKO, ION, IOF.

7. Interrupt cycle

When (IEN)(FGI+FGO)=1(IEN)(FGI + FGO) = 1 at the end of the execute phase, three extra timing signals (written T0′, T1′, T2′ because they reuse counter positions 0–2 under the interrupt condition) do: AR ← 0; M[AR] ← PC; PC ← 0; IEN ← 0; SC ← 0. The return address therefore goes to memory location 0, PC becomes 0, and fetching resumes at address 0 — conventionally a BUN to the interrupt service routine.
IEN is cleared by hardware, so further interrupts stay masked until an ION-type instruction re-enables them.

8. The whole cycle

Figure. Notice that the clock drives the sequence counter and decoder to produce T0–T15, while IR bits 12–14 produce D0–D7. These timing and opcode signals, together with I, E, FGI, and FGO, enter the control logic gates.
Figure. Notice the fetch steps T0–T2, then the D7 check for register or I/O operations and the I check for indirect addressing. If IEN(FGI+FGO)=1, the interrupt cycle stores PC in memory location 0 and sets PC to 0 before fetching resumes.

Formulas

  • Clock period: T=1fT = \dfrac{1}{f}, with ff the clock frequency in Hz and TT in seconds.
  • Time for one instruction: tinstr=n×Tt_{\text{instr}} = n \times T, where nn = number of timing signals (T-states) used.
  • Timing signals for a memory-reference instruction: n=4+mn = 4 + m, where mm is the number of execute microoperations (1 for STA and BUN, 2 for AND, ADD, LDA and BSA, 3 for ISZ); it is the same for direct and indirect addressing because T3 is always spent.
  • Register-reference and I/O instructions: n=4n = 4 (T0–T3).
  • Total program time: tprog=∑knk Tt_{\text{prog}} = \sum_{k} n_k \, T over all instructions.
  • Longest instruction cycle: nmax=7n_{max} = 7 (ISZ, T0–T6).
  • Addressable words: 212=40962^{12} = 4096; opcode space: 23=82^{3} = 8 decoded lines D0–D7.

Worked examples

Example 1 (fetch microoperations and the return address). Write the fetch microoperations and explain which one makes an interrupt return possible.
T0: AR ← PC. T1: memory read DR ← M[AR], then IR ← DR, and PC ← PC + 1. T2: D0–D7 ← decode IR(12–14), AR ← IR(0–11), I ← IR(15). Because PC is incremented at T1, when the interrupt cycle later stores PC into M[0] it stores the address of the next instruction, exactly the return address.

Example 2 (timing signals and time, numeric). The basic computer runs at 1 MHz. How long does an ISZ instruction take with indirect addressing, and with direct addressing?
1 MHz gives T=1 μsT = 1\ \mu s. ISZ executes at T4, T5, T6 for either addressing mode (T3 is the indirect step or an idle step), so it uses T0–T6 = 7 T-states = 7 µs in both cases.

Example 3 (program trace, two-step). A basic-computer program is stored as: 100: CLA; 101: ADD 106; 102: CMA; 103: AND 107; 104: STA 108; 105: HLT; with M[106] = 1234H, M[107] = 00FFH, M[108] = 0000H. Find AC and M[108].
CLA → AC = 0000H. ADD 106: AC = 0000 + 1234 = 1234H, E = 0. CMA: AC = 1234H‾\overline{1234H} = EDCBH. AND 107: AC = EDCBH ∧ 00FFH = 00CBH. STA 108: M[108] = 00CBH, AC unchanged. Final: AC = 00CBH, M[108] = 00CBH.

Example 4 (match the list, statement style). Match List-I with List-II. List-I: A. AR ← PC; B. IR ← M[AR], PC ← PC + 1; C. AR ← IR(0–11), I ← IR(15); D. AR ← M[AR] when I = 1. List-II: i. T3; ii. T2; iii. T1; iv. T0.
A → iv (T0, start of fetch); B → iii (T1); C → ii (T2, decode); D → i (T3, indirect phase). Answer: A-iv, B-iii, C-ii, D-i.

Example 5 (total time, hard). A clock of 2 MHz drives the basic computer. A program contains 3 register-reference instructions, 2 direct ADD instructions and 1 indirect ISZ. Find the total execution time (interrupts disabled).
Register-reference: 3×4=123 \times 4 = 12 cycles. Direct ADD: 2×6=122 \times 6 = 12 cycles (T0–T5). ISZ: 1×7=71 \times 7 = 7 cycles. Total =12+12+7=31= 12 + 12 + 7 = 31 T-states. With T=1/2 μs=0.5 μsT = 1/2\ \mu s = 0.5\ \mu s, time =31×0.5=15.5 μs= 31 \times 0.5 = \mathbf{15.5\ \mu s}.

Comparison

PointHardwired controlMicroprogrammed control
Control word stored ingates and flip-flopscontrol memory (ROM)
Speedfaster (no ROM access)slower (microinstruction fetch)
Flexibilitypoor, redesign means rewiringgood, rewrite the microcode
Hardwaresequence counter, decoders, gatesROM plus simple sequencing logic
Typical usebasic computer as designed, RISC styleCISC designs such as IBM System/360
PhaseTiming signalsConditionMicrooperations
FetchT0, T1, T2alwaysAR ← PC; IR ← M[AR], PC ← PC + 1; decode, AR ← IR(0–11), I ← IR(15)
IndirectT3D7 = 0 and I = 1AR ← M[AR]
ExecuteT3 (register-reference and I/O); T4–T6 (memory-reference)alwaysopcode dependent, ends with SC ← 0
InterruptT0′, T1′, T2′(IEN)(FGI+FGO)=1(IEN)(FGI+FGO)=1 at end of executeM[0] ← PC, PC ← 0, IEN ← 0, SC ← 0
Instruction classTiming signalsCountDirect or indirect?
Register-referenceT0–T34not applicable
Input–outputT0–T34not applicable
STA, BUNT0–T45same for direct and indirect
AND, ADD, LDA, BSAT0–T56same for direct and indirect
ISZT0–T67same for direct and indirect

Revision summary

  • Fetch is always T0, T1, T2 — AR ← PC, then IR ← M[AR] with PC ← PC + 1, then decode plus AR ← IR(0–11) and I ← IR(15).
  • T0 starts the instruction cycle; SC ← 0 at the last microoperation restarts it.
  • Indirect phase = T3, entered only when D7 = 0 and I = 1;
    when I = 0 the T3 step is idle, so the cycle length does not change.
  • Memory-reference instructions are opcodes 000–110 (D0–D6); D7 = 111 means register-reference (I = 0) or I/O (I = 1).
  • ADD stores the carry-out in E, not in AC.
  • Interrupt cycle saves PC in memory location 0, clears PC and IEN; interrupts are tested only after the execute phase.
  • Counts to memorise: register/I-O = 4; STA/BUN = 5; AND/ADD/LDA/BSA = 6; ISZ = 7 (direct or indirect).
  • Longest cycle = 7 timing signals (ISZ); one timing signal = one clock period = 1/f1/f.
  • Hardwired = gates + sequence counter (fast, rigid); microprogrammed = control ROM (slow, flexible).
  • Difference in one line: direct addressing uses AR as the operand address, indirect makes AR point to a word that holds the address.

Previous-year exam insights

  • Direct concept: "which microoperation at T0/T1", "which register is incremented in fetch", "where is the return address stored", "which timing signal enables decoding".
    Learn the fetch triple and the interrupt-cycle triple word for word.
  • Counting questions: number of clock cycles for ISZ/ADD/register-reference, and total program time from clock frequency.
    Identify each instruction's class, then use 4 for register/I-O, 5 for STA and BUN, 6 for AND, ADD, LDA and BSA, 7 for ISZ (Mano's convention).
  • Match List-I with List-II: microoperation ↔ timing signal, or instruction type ↔ number of timing signals.
    Solve by writing the fetch table from memory first.
  • Statement I/II questions: usually test (a) fetch is always three signals, (b) the indirect step happens at T3 and the execute phase of every memory-reference instruction starts at T4, (c) SC is cleared at the end of every instruction, (d) the interrupt cycle is entered only after execute.
    All four are true.
  • Assertion–Reason: the classic pair is "in indirect mode AR is loaded once more from memory at T3" — true;
    remember that this step is idle when I = 0.
  • Trap: the interrupt cycle reuses counter values 0–2, so an option saying "interrupts use T3 only" is wrong; three signals are used.
  • Trap: memory-reference execution starts at T4 in both modes, so "AND direct is T3–T4" is wrong; T3 is used only by register-reference and I/O instructions (and by the indirect step).
  • Trap: STA and BUN need only one execute step but still start at T4, so their cycle is 5 signals (T0–T4), not 4; AND, ADD, LDA and BSA take 6.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  1. Write the complete fetch microoperations T0, T1, T2 from memory and name the register incremented in the fetch.
  2. State the exact condition for entering the indirect phase and the microoperation performed there.
  3. Reproduce the memory-reference execute table with direct and indirect timing signals for all seven instructions.
  4. Compute the number of timing signals for any instruction type, direct or indirect, including ISZ.
  5. Convert a clock frequency into a clock period and total execution time for a short program.
  6. Describe the interrupt cycle's microoperations, the location of the saved return address, and the effect on IEN and PC.
  7. Explain the roles of IRR, IMR and ISR, and classify an interrupt as internal/external, maskable/non-maskable, synchronous/asynchronous.
  8. Compare hardwired and microprogrammed control on speed, flexibility and hardware.
  9. Solve match-the-list and assertion–reason items on timing signals without guessing.

Attempt the sub-topic test on PARIKSHA first; when you score comfortably, move to the subject test.

Pages 1–2 of 2