Instruction Set Architecture

Instruction Set Architecture (ISA)

Instruction Set Architecture: The machine language the CPU implements.

Note: Everything you need to know to program a computer

Machine Instructions

Machine Instruction: An instruction that is executed directly by the CPU.

Special Instruction Fields: Other special fields may be used under certain circumstances.

Note: How instructions fit on 32-bit MIPS.

General Purpose Registers (GPR)

Register File: Consists of all registers in the CPU that are accessible to the programmer.

One, Two Three-Address Machines (Instruction Formats)

Instruction Formats: Refer to the way instructions are encoded and represented in machine language.

Examples: Instruction formats in the real world

One, Two Three-Address Machines:

Note: Because we are working with registers, we need to break complex expressions down and handle the order of operations ourselves!

Computing the Number of Memory Accesses

The more memory accesses you do, the slower your code is.

How-To Count Memory Accesses for One Instruction:

  1. The instruction itself +1 to instruction count.
  2. Rewrite in register transfer notation.

Note: Assumptions
We (usually) make the following assumptions when computing the number of memory accesses:

  1. Each memory address requires one memory word
  2. Opcode, mode, immediate value, number of shifts, and any number of register addresses require only one memory word

Example: Three register-memory address machine with two registers

InstructionRTNDataInstruction
ADD R1,A,BR1 <- A + B23
ADD R2,C,DR2 <- C + D23
MUL X,R1,R2X <- R1 * R212

Example: Three-register address machine with three registers

InstructionRTNDataInstruction
LD R1, AR1 <- A12
LD R2, BR2 <- B12
ADD R3, R1, R2R3 <- R1 + R201
LD R1, CR1 <- C12
LD R2, DR2 <- D12
ADD R1, R1, R2R1 <- R1 + R201
MUL R1, R1, R3R1 <- R1 * R301
ST X, R1X <- R112

Example: Zero-register address machine

InstructionRTNDataInstruction
PUSH ATOS <- A12
PUSH BTOS <- B12
ADDTOS <- TOS + TOS-101
PUSH CTOS <- C12
PUSH DTOS <- D12
ADDTOS <- TOS + TOS-101
MULTOS <- TOS * TOS-101
POP XX <- TOS12