An introduction to the ISA through the LC-3

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 216=65,5362^{16} = 65,536 locations and an address size of 16 bits, making it's total memory capacity equal to exactly 1,048,5761,048,576 bits (or roughly 131KB131\text{KB}).

The unit of data (a word) that the LC-3 can process is the same as it's address size (1616 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 88 registers, each of which can store one word (1616 bits) and are uniquely identified by a 33-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 1515 usable instructions, each identified by its unique opcode (found in bits [1515:1212]):

LC-3 Opcodes

  1. Note that the opcodes with the ++ sign denotes instructions that modify condition codes.

  2. 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 NN, ZZ, and PP 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 88 registers, then the NN status register is set to 11 and the ZZ and PP status registers are set to 00.

This can be used for example to change the sequence of execution of the instructions in a computer program.