The LC-3
An introduction to the ISA through the LC-3
The ISA: Overview #
The ISA describes all the information needed for software to communicate with or instruct the underlying hardware of the computer system.
It also specifies the memory organization, register set, and instruction set, including opcodes, data types, and addressing modes in the instruction.
Memory Organization #
The memory organization describes the computer memory's address size and space.
For the LC-3 has an address space of locations and an address size of 16 bits, making it's total memory capacity equal to exactly bits (or roughly ).
The unit of data (a word) that the LC-3 can process is the same as it's address size ( bits), meaning it is word-addressable.
There is also byte-addressing which most computer systems use.
Register Set #
Registers are a storage unit that's colocated near the CPU to make it faster to access temporary data when working on operations.
In most cases it makes it so that temporary data can be accessed at a single clock cycle instead of at least two when accessing data from the memory.
The LC-3 has registers, each of which can store one word ( bits) and are uniquely identified by a -bit register number.
The Instruction Set #
An instruction is made up of two components: the opcode and the operand.
The instruction set is described by its opcodes, data types, and addressing mode of the ISA.
- The opcode defines the operators that can be performed.
- The data type describes what the data is represented as (ie. a 2's complement integer, a floating number, or ASCII).
- The addressing mode describes where the data/operand is located (ie. on the registers, in memory, or within the instruction itself).
The LC-3 has usable instructions, each identified by its unique opcode (found in bits [:]):
Note that the opcodes with the sign denotes instructions that modify condition codes.
Image is from fig. 5.3, p. 148, ch. 5 of Introduction to Computing Systems (3rd Ed., Yale Patt etal.)
Addressing Modes #
The addressing mode defines where the data/operand is accessed or located.
Generally an operand can be found within the registers, in memory, or within the instruction itself (this is called a literal or immediate operand).
The LC-3 supports five addressing modes: literal, register, and three memory addressing modes: PC-relative, indirect, and base + offset.
Condition Codes #
Condition codes (or status codes) are single-bit registers that denote a condition (or some status) when an operation occurs.
In the case of the LC-3 there is the , , and condition codes that represent negative, zero, and positive results respectively.
These are set whenever data is written onto a register, ie. if an add results in a negative value and is written onto the registers, then the status register is set to and the and status registers are set to .
This can be used for example to change the sequence of execution of the instructions in a computer program.