Skip to content

Memory Reference Instructions

In Computer System Architecture, Memory Reference Instructions are a fundamental part of the instruction set architecture (ISA). These instructions interact with memoryβ€”either by reading data from memory or writing data to memory. They commonly use the Accumulator (AC) register for processing.


πŸ”· Definition

Memory Reference Instructions are instructions that involve accessing main memory for either fetching operands or storing results, typically using an address field in the instruction.


πŸ“Œ Instruction Format (16-bit)

Most basic computers follow a 16-bit instruction format:

| 15 | 14-12 | 11 - 0 |
| I | Opcode | Address |
  • I (1 bit): Addressing Mode
    • 0 = Direct Addressing
    • 1 = Indirect Addressing
  • Opcode (3 bits): Specifies the operation (e.g., ADD, LDA)
  • Address (12 bits): Specifies memory location (0–4095)

🧠 Types of Memory Reference Instructions

1. LDA (Load Accumulator)

  • Syntax: LDA address
  • Operation: AC ← M[address]
  • Purpose: Loads the content from a memory location into the accumulator.

2. STA (Store Accumulator)

  • Syntax: STA address
  • Operation: M[address] ← AC
  • Purpose: Stores the content of the accumulator into a memory location.

3. ADD

  • Syntax: ADD address
  • Operation: AC ← AC + M[address]
  • Purpose: Adds content of memory to accumulator.

4. SUB

  • Syntax: SUB address
  • Operation: AC ← AC – M[address]
  • Purpose: Subtracts memory content from accumulator.

5. AND

  • Syntax: AND address
  • Operation: AC ← AC ∧ M[address]
  • Purpose: Performs bitwise AND between accumulator and memory content.

6. OR

  • Syntax: OR address
  • Operation: AC ← AC ∨ M[address]`
  • Purpose: Performs bitwise OR between accumulator and memory content.

7. BUN (Branch Unconditionally)

  • Syntax: BUN address
  • Operation: PC ← address
  • Purpose: Alters the program flow unconditionally (jump).

8. BSA (Branch and Save Address)

  • Syntax: BSA address
  • Operation: M[address] ← PC; PC ← address + 1
  • Purpose: Used for subroutine call; saves return address.

9. ISZ (Increment and Skip if Zero)

  • Syntax: ISZ address
  • Operation: M[address] ← M[address] + 1
    if M[address] == 0 then PC ← PC + 1
  • Purpose: Useful in looping and counter mechanisms.

πŸ” Direct vs. Indirect Addressing

Addressing ModeI BitDescription
Direct0Address field directly specifies memory location
Indirect1Address field points to memory location containing the effective address

πŸ“Œ Example (LDA Instruction)

Assume instruction:
0001 0100 0011 1100 (binary)

  • I = 0 (Direct)
  • Opcode = 001 (LDA)
  • Address = 043C (Hex) = 1084 (Decimal)

πŸ”Έ Operation:
AC ← M[1084]


πŸ“˜ Use in Computer Architecture

  • Forms the core instruction set of a basic computer.
  • Teaches how CPU, memory, and ALU interact.
  • Helps understand data path design, control logic, and instruction cycle.

βœ… Conclusion

Memory Reference Instructions are essential to:

  • Access and manipulate data in memory.
  • Perform arithmetic/logical operations.
  • Control program flow (branching and subroutines).

They are foundational in understanding CPU operations, instruction decoding, and microprogramming in Computer System Architecture.