lecture3.pptx
Memory Address Space
We can directly memory map peripherals into the address space (e.g. a mouse).
Ex: LD r0 0xFFFE
(if the mouse is at the bus on 0xFFFE).
What’s included in an ISA?
- Registers
- Instructions
- Privileged vs Unprivileged
- Instruction format
- Data types
- 32, 64-bit
- Integers, floating-point
- Addressing modes
- Immediate
- Operand directly embedded in the instruction
- Register
- Direct
- Memory operand directly embedded within the instruction
LD r0, #5
- Cons: memory latency, limited range (due to instruction size), no dynamic offsets
- Indirect
- Specifies register that contains address of operand
ADD r0, (r1)
- Cons: indirection (complex execution)
- Displacement
- Add index to offset
ADD r0, #5(r1)
- Indexed
- Add index to offset but from another register
ADD r0, r1(r2)
- Relative
- Operand is a memory address relative to program counter
JMP +4
- Stack
- Operands implicitly located on some stack
PUSH r0
POP r0
- Memory alignment
- Restrict to accesses that are multiples of some fixed value (or else would need to access multiple)
- Endianness
- Control/status regs
- Extensions
Example: 6502 8-bit CPU
Popular in 80’s. Variable length instructions 1-3 bytes. 1 byte opcode. 1-2 bytes operands.
5 registers: A, X, Y, SP, SR.
Accumulator: used for immediate operations. LDA 0x10
.