Instruction set architecture
Введено| English | Значение |
|---|---|
| computer architecture | The organisation and programmer-visible behaviour of computer hardware. |
| instruction set architecture | The programmer-visible instructions, registers, data formats and rules a processor implements. |
| RISC/rɪsk/ | Reduced instruction set computer: an instruction-set design approach emphasising comparatively simple operations. |
| load-store | An instruction-set organisation in which memory data is accessed through load and store instructions. |
| byte-addressable | Having a distinct memory address for each byte. |
The contract
- Computer architecture is the machine below the program. The instruction set architecture (ISA) is its contract with software: everything a compiler may rely on, nothing about the wires. Two machines with one ISA run the same binaries.
- Our teaching ISA is RISC in spirit: fixed 32-bit instructions, load-store (only
lw/swtouch memory), 16 registers with R0 hardwired to zero.
R-type: opcode(4) | rd(4) | rs(4) | rt(4) | shift(4) | funct(8) — 28 bits used, zero-padded to 32. I-type: opcode(4) | rt(4) | rs(4) | immediate(16).
{exercise:uni-cs0601-isa}
The ISA is best described as —
Сложность 1/5 · 100 монет + небольшой бонус за первое завершение сегодня
It states everything software may rely on and nothing about implementation.
Encode and decode
- Encode
add R3, R1, R2with opcode 1: fields $0001\,0011\,0001\,0010\,0000\,00000001$. Decode opcode 2, rt 4, rs 1, immediate $127$:addi R4, R1, 127. - A 16-bit two's complement immediate spans $-32\,768$ to $32\,767$;
addi R2, R0, 40000cannot encode and needs two instructions.

{exercise:uni-cs0601-encode}
A 16-bit signed immediate can hold —
Сложность 1/5 · 100 монет + небольшой бонус за первое завершение сегодня
The range is −32 768 to 32 767; 40 000 needs two instructions.
What R0 buys
- With byte-addressable memory and 32-bit words,
lwoffsets are multiples of 4 — a 16-bit offset reaches $2^{16}$ bytes = 64 KiB from the base register. addi R0, R0, 0is the canonical no-op;add R5, R0, R0zeroes R5 in one cycle;beq R1, R0, loopcompares to zero with no constant operand — a dedicated zero register removes a whole class of move instructions.
{exercise:uni-cs0601-zero}
R0 hardwired to zero lets a program —
Сложность 1/5 · 100 монет + небольшой бонус за первое завершение сегодня
add R5, R0, R0 zeroes R5 in one cycle — no move-immediate needed.