Zero Address Instruction Format (Stack-Based Instruction Formats)
A zero-address instruction format is an instruction representation used in stack-based architectures: the operands are implicitly taken from the top(s) of a stack, and results are pushed back to the stack. As a result, instructions typically contain no register/memory address fields for operands—the “addressing” is handled by the stack discipline rather than by explicit operand specifiers.2
In contrast, one-, two-, and three-address formats encode explicit operand locations (registers or memory addresses) directly in the instruction. Zero-address formats are therefore closely associated with register stack organizations and virtual machine–style stacks.
Footnotes
-
"0 Address Instruction Format Example" (YouTube) - Includes explanations/examples of zero-address instruction behavior in stack contexts. https://www.youtube.com/watch?v=qM3-OVfVbLs ↩
-
"Various Instruction Formats | Zero Address Instruction|3,2,1 Address Instructions" (YouTube) - Compares zero-address with other address formats and illustrates implicit operand handling. https://www.youtube.com/watch?v=0RvbPtvUnTQ ↩
-
"L-1.17: Register Stack Organisation | Zero Address Instructions | COA" (YouTube) - Discusses register stack organization as an implementation technique for zero-address instructions. https://www.youtube.com/watch?v=u-sp4gBAJKI ↩
Zero Address Instructions (Stack-Based) — Conceptual Overview
Core idea
In a zero-address ISA, an arithmetic instruction like ADD does not name where operands live. Instead, the execution unit assumes that:
- the first operand is at the top of the stack (or a defined position),
- the second operand is next on the stack,
- the instruction replaces them with the result on the stack.
So the instruction format can be thought of as just an operation code plus (optionally) immediate constants or other non-address fields (e.g., PUSH c includes a literal constant, but still has no operand address).2
Key terms (learn these):
- instruction format
- stack pointer
- opcode
- operand stack
Footnotes
-
"0 Address Instruction Format Example" (YouTube) - Includes explanations/examples of zero-address instruction behavior in stack contexts. https://www.youtube.com/watch?v=qM3-OVfVbLs ↩
-
"Various Instruction Formats | Zero Address Instruction|3,2,1 Address Instructions" (YouTube) - Compares zero-address with other address formats and illustrates implicit operand handling. https://www.youtube.com/watch?v=0RvbPtvUnTQ ↩
How a zero-address instruction executes (e.g., ADD)
- 1Step 1
The CPU fetches the instruction and decodes the opcode (e.g.,
ADD). - 2Step 2
The CPU pops the top value from the operand stack into an internal temporary (operand 1).
- 3Step 3
The CPU pops the next top value from the operand stack into an internal temporary (operand 2).
- 4Step 4
The execution unit computes the operation (e.g., operand2 + operand1).
- 5Step 5
The CPU pushes the result back onto the operand stack; subsequent instructions implicitly use it.
Instruction format structure
Because zero-address instructions do not explicitly name operand locations, the instruction encoding often looks like:
- Opcode-only instructions: e.g.,
ADD,SUB,MUL,DIV - Opcode + immediate instructions: e.g.,
PUSH 5(still no operand address; the constant is immediate)
This is why many explanations of “zero-address” emphasize that the stack location is implicit, not encoded in the instruction’s address fields.2
Footnotes
-
"0 Address Instruction Format Example" (YouTube) - Includes explanations/examples of zero-address instruction behavior in stack contexts. https://www.youtube.com/watch?v=qM3-OVfVbLs ↩
-
"L-1.17: Register Stack Organisation | Zero Address Instructions | COA" (YouTube) - Discusses register stack organization as an implementation technique for zero-address instructions. https://www.youtube.com/watch?v=u-sp4gBAJKI ↩
Conceptual instruction fields across address formats
Qualitative view of whether operand addresses appear in the instruction.
Benefits and trade-offs
Benefits
- Shorter instruction encodings: with no explicit operand address fields, instruction size can be reduced.2
- Simpler instruction format/decoding: execution can rely on the stack discipline instead of register/memory specifiers.
Trade-offs
- More stack traffic: each operation may require pops/pushes, increasing implicit memory/register-stack activity.2
- Harder optimization for the compiler (depending on the target): extracting parallelism or keeping values in registers can be less direct than in register-based multi-address ISAs.2
[Callout]{type="tip" title="Pro Tip"} When analyzing a zero-address instruction sequence, always track the stack effect: how many items each instruction pops and pushes. This “stack accounting” makes program reasoning much faster. [/Callout]
[Callout]{type="warning" title="Common pitfall"} Don’t confuse zero-address with zero operands.
ADDstill consumes operands—it just gets them implicitly from the stack rather than from explicit address fields. [/Callout]
Footnotes
-
"0 Address Instruction Format Example" (YouTube) - Includes explanations/examples of zero-address instruction behavior in stack contexts. https://www.youtube.com/watch?v=qM3-OVfVbLs ↩ ↩2 ↩3
-
"Various Instruction Formats | Zero Address Instruction|3,2,1 Address Instructions" (YouTube) - Compares zero-address with other address formats and illustrates implicit operand handling. https://www.youtube.com/watch?v=0RvbPtvUnTQ ↩ ↩2 ↩3 ↩4
-
"L-1.17: Register Stack Organisation | Zero Address Instructions | COA" (YouTube) - Discusses register stack organization as an implementation technique for zero-address instructions. https://www.youtube.com/watch?v=u-sp4gBAJKI ↩ ↩2
Where zero-address formats appear in system designs
Implicit operands via stack
1. Stack-based ISA conceptOperations take operands from stack top(s) and push results."
Instruction selection and stack discipline
2. Compiler/VM integrationCompilers emit sequences that manage stack depth and value order."
Memory stack vs register stack
3. Implementation choiceImplementations may use actual memory or register stack organizations to reduce overhead."
Footnotes
-
"L-1.17: Register Stack Organisation | Zero Address Instructions | COA" (YouTube) - Discusses register stack organization as an implementation technique for zero-address instructions. https://www.youtube.com/watch?v=u-sp4gBAJKI ↩
Concept checks & edge cases
Small worked example (stack effect)
Consider computing in a stack model:
PUSH a→ stack:[a]PUSH b→ stack:[a, b]ADD→ popsbanda, pushesa+b→ stack:[a+b]PUSH c→ stack:[a+b, c]MUL→ popscanda+b, pushes(a+b)*c→ stack:[(a+b)*c]
This illustrates that the “operand addresses” are implicit in stack position, not encoded in the instructions.2
Footnotes
-
"0 Address Instruction Format Example" (YouTube) - Includes explanations/examples of zero-address instruction behavior in stack contexts. https://www.youtube.com/watch?v=qM3-OVfVbLs ↩
-
"Various Instruction Formats | Zero Address Instruction|3,2,1 Address Instructions" (YouTube) - Compares zero-address with other address formats and illustrates implicit operand handling. https://www.youtube.com/watch?v=0RvbPtvUnTQ ↩
Knowledge Check
In a zero-address instruction format, where do operand values come from?