title: ISA
date: 2023-11-20
author:
- AllenYGY
status: DONE
tags:
- NOTE
- CO
- Lec9
created: 2023-11-20T21:25
updated: 2024-05-31T01:01
publish: True
ISA
The ISA specifies all the information about the computer that the software has to know.
features:
Special storaqge devices that are inside the GPU.
Fast to access 1 clock cycle
General Purpose Register GPR: accessible instructions
Register is store element
Register File
Other special purpose registers:
In Lc-3
'Immediate' addressing mode
ADD 0001
AND 0101
---- --- --- --- ---
ADD DST SR1 000 SR2
0001 xxx xxx 000 xxx
---- --- --- --- ---
AND DST SR1 000 SR2
0001 xxx xxx 000 xxx
When string bit is 0 the addressing mode is "register mode"
Otherwise is "immediate mode"
---- --- --- - -----
ADD DST SR1 1 Imm5
0001 xxx xxx 1 Imm5
---- --- --- - -----
AND DST SR1 1 Imm5
0001 xxx xxx 1 Imm5
Imm5 is a const integer and imm5 will be extend to 16 bits when it be calcuted.
---- --- --- -------
NOT DST SRC 111111
1001 Reg Reg 111111
Load read data from memory to register
Store write data from register to memory
Load effectively address compute address
---- --- ----------
LEA DR/SR addr.gen.bits
1110 DR/SR addr.gen.bits
5 addressing modes
---- --- ---------
LD Dst
0010 Reg
---- --- ----------
ST Dst
0011 Reg
operand must be within 256 locations of the instruction
---- --- --- ------
LDR Dst BaseR offset
0110 Reg Reg
Base+offset can address any location in memory
---- --- --- ------
STR Dst BaseR offset
0111 Reg Reg
An address is first formed exactly the same way as with LD and ST
This address contains the address of the operand.
Just like base+offset, indirect mode can also address any location in the memory.
Memory has to be accessed twice in order to get the address of the operand
LDI
---- --- ---------
LDI Dst Addr.Gen.bits
1010 Reg Addr.Gen.bits
Lc-3 has 3 conditional code registers
set by any instruction that stores a value to a register
BR
---- --- ---------
BR NZP offset
0000 NZP offset
when condition is satisfied PC=PC+offset
---- --- --- ------
JMP 000 BaseR 000000
1100 000 Reg 000000
unconditional jump
PC jump to Reg
---- ---- --------
TRAP 0000 trapvec
1111 0000
PC is set to the instruction TRAP