Instruction Formats and Addressing Modes Formula Sheet: COA Revision Notes with Worked Examples
Revise COA instruction formats with one compact sheet covering field widths, address-count sequences, effective-address formulas, expanding opcodes and memory-reference checks.
KnowledgeGate Team
Exam prep & CS education

Instruction-format problems mix bit allocation, opcode counts, effective-address arithmetic and memory-reference counts. Solve them with three checks: identify the field budget, apply the addressing rule and verify the memory accesses. The worked checks here produce 6 opcode bits, 18 remaining bits, X = 72, effective addresses 200, 800, 1000, 224, 4296, 1160, 3000 and 2996, 32 one-address opcodes, and the PC-relative range 0x0800 to 0x17FF. Each result follows declared instruction length, addressability, register width and PC convention.
Instruction format anatomy and bit-budget rules
An instruction format fixes how word bits represent the opcode and operand specifiers.
Item | Rule | When to use |
|---|---|---|
Opcode capacity |
|
|
Opcode width |
|
|
Register width |
|
|
Remaining bits | length minus opcode, register, mode and fixed bits | Immediate or displacement |
Unsigned range |
| Unsigned field |
Two's-complement range |
| Signed field |
A 32-bit word with 64 operations and two 16-register fields needs ceil(log2 64)=6 opcode bits and ceil(log2 16)=4 per register. Eight register bits leave 32-6-8=18 without mode or function fields. Unsigned range: 0 to 2^18-1=262,143. Two's-complement range: -2^17 to 2^17-1, or -131,072 to 131,071. Width does not establish signedness, scaling or addressability. See Instruction Formats & Addressing Modes in COA: Worked Guide owns the full concept-first walkthrough; this page keeps the formula-sheet and revision angle.
Zero-, one-, two- and three-address instruction formats
Address count means explicit specifiers, not memory accesses. Three-address names a destination and two sources; two-address overwrites one operand; one-address implies an accumulator; zero-address implies the stack top.
For A = 7, B = 5, C = 10, D = 4, compile X = (A + B) x (C - D) = 12 x 6 = 72:
Format | Sequence | Count |
|---|---|---|
Three-address |
| 3 |
Two-address |
| 6 |
One-address accumulator |
| 7 |
Zero-address stack |
| 8 |
Stack notation is bottom to top; binary operators take left from next-to-top and right from top. Trace: [7,5] -> [12] -> [12,10,4] -> [12,6] -> [72]. Code-size and traffic comparisons require instruction widths and operand locations.
Addressing-mode formula sheet: operand, EA and update order
Let A be the address or displacement, R register contents, M[x] memory, and PC_next the post-fetch PC.
Mode | Operand or EA rule | Extra state change | Question cue |
|---|---|---|---|
Immediate |
| None | Literal |
Register |
| None | Value in register |
Direct |
| None | Address field |
Memory indirect |
| None | Memory pointer |
Register indirect |
| None | Register pointer |
Indexed |
| None | Index |
Base register |
| None | Base |
PC-relative |
| None | Signed offset |
Auto-increment |
| Then | Old |
Auto-decrement | First | Before access | New |
Implied | No explicit field | Defined by architecture | Implicit |
Here d is operand size in addressable units, not automatically a byte or word. Indexed, base and relative modes add different reference values; relative displacement is signed.
Addressing modes worked from one machine state
Use a byte-addressed machine with A=200, R1=1000, IX=24, BR=4096, PC_next=1200, relative displacement -40, R2=R3=3000, and d=4 for a 4-byte operand. Memory has M[200]=800, M[800]=34, M[1000]=55, M[224]=66, M[4296]=88, M[1160]=99, M[3000]=111, M[2996]=222.
Immediate gives operand
200; direct givesEA=200, operand800.Memory indirect reads pointer
M[200]=800, thenEA=800, operandM[800]=34.Register indirect gives
EA=R1=1000, operand55.Indexed gives
EA=200+24=224, operand66; base givesEA=200+4096=4296, operand88.PC-relative gives
EA=1200+(-40)=1160, operand99.Auto-increment uses old
R2:EA=3000, operand111, thenR2=3004. Auto-decrement acts first:R3=3000-4=2996,EA=2996, operand222.

Expanding opcode formula and worked allocation
A fixed k-bit opcode allows at most 2^k operations. An expanding opcode uses prefix allocation, reclaiming missing operand fields as extensions. At each stage, next-format capacity = unused prefixes x 2^(reclaimed field width); only unused prefixes continue.
For a 16-bit instruction and 16 registers, each register field needs 4 bits. Layout [opcode 4][R1 4][R2 4][R3 4] has 16 primary patterns. Assign 15 three-address operations and reserve 1111.
Reclaim one field for [1111][extension 4][R1 4][R2 4]. Its capacity is 1 x 2^4 = 16; assign 14, leaving 1110 and 1111. Reclaim another for [1111][1110 or 1111][extension 4][R1 4]: 2 x 2^4 = 32 one-address operations. Checksum: 15 three-address, 14 two-address, at most 32 one-address. 16 - 15 - 14 is invalid because extension depths are unequal opcode spaces.

Addressability, displacement range and memory-reference checks
Capacity rules: n address bits select 2^n units; byte capacity is units times bytes per unit; an n-bit signed displacement spans -2^(n-1) to 2^(n-1)-1 units. Thus 24 bits select 2^24 bytes, or 16 MiB, with byte addressing; 4-byte word addressing gives 64 MiB.
For PC_next=0x1000, a 12-bit signed byte displacement is -2^11 to 2^11-1, or -2048 to +2047. The range is 0x1000-0x0800=0x0800 through 0x1000+0x07FF=0x17FF. Scale only if supplied.
For a single-word load, assuming no cache or extra translation accesses:
Modes | Memory references |
|---|---|
Immediate, register |
|
Direct, register-indirect, indexed, base, relative, auto-update |
|
Memory indirect |
|
Stores, multiword instructions and multi-level indirection change these counts.
How instruction formats and addressing modes are tested
Start with the right scratch action: draw bit fields; compile one expression; write EA = ... before substitution; mark PC_next; preserve signed units; draw a prefix tree; separate fetch, pointer and operand accesses.
Avoid floor(log2) in place of ceil(log2), counting implicit operands, confusing immediate A with direct M[A], stopping at an indirect pointer, reversing auto-update order, assuming every address field is signed, and subtracting counts across opcode depths.
For effective-address practice, use Addressing Modes MCQs: 12 Solved COA Questions. This page owns the formula sheet and worked checks; the earlier Instruction Formats and Addressing Modes: Mistakes and How to Avoid Them is the error-diagnosis and 60-second-audit companion.
Instruction formats and addressing modes: the two-minute checksum
Closed book, reproduce ceil(log2 M), ceil(log2 R), remaining bits, 0/1/2/3-address meanings, EA rules, auto-update order, prefix expansion, 2^n units, signed range and memory-reference counts. Checksum: 6 + 8 + 18 = 32 bits, X = 72, indirect EA = 800, indexed EA = 224, base EA = 4296, relative EA = 1160, auto registers 3004 and 2996, 32 one-address opcodes, and 0x0800 to 0x17FF. For full COA, use Computer Architecture and Organisation; for adjacent notes, use CS Fundamentals for Exams & Placements.
Keep learning
Instruction Formats and Addressing Modes in COA: Complete Guide with Worked Examples
Learn how zero, one, two, and three-address instructions change a program, then solve expanding-opcode and effective-address questions step by step.
Instruction Formats and Addressing Modes: 7 Mistakes and How to Fix Them
Fix seven common COA errors by tracing effective addresses, memory reads, register updates, instruction fields and expanding opcodes step by step.
Instruction Formats and Addressing Modes for GATE: One Cross-Concept COA Problem Solved
Decode one teaching instruction from 0x2E35FFEC, calculate its effective address, read the little-endian value, and trace the result through a five-stage pipeline.
Instruction Formats and Addressing Modes MCQs: 12 Solved Cross-Concept Questions
Solve 12 cross-concept COA questions that connect addressing-mode choices with PC rules, memory references, opcode fields, and byte-aligned instructions.





