ISA

The ISA specifies all the information about the computer that the software has to be aware of.
The ISA specifies the memory organization, register set, and instrction set, including the opcodes, data types, and addressing modes of the instructions in the instruction set.

Memory Organization

For LC-3, its address space is 2**16, its addressabilily is 16-bits**. We say LC-3 is word-addressable. Similarly, if we say something is byte-addressable, then its addressabilily is 8-bits.

:::info

Registers

General Purpose Register (GPR)

The number of bits stored in each register is usually one word.
Register must be uniquely identifiable.
For LC-3, there are EIGHT GPRs.

Condition Code Register (CC)

LC-3 has three 1-bit registers which are individually set or cleared each time one of the 8 GPRs is stored as a result of execution of one of the operate instruction or one of the load instructions.
They are called N, Z, _and _P. :::

The Instruction Set

It’s defined by its set of opcodes, data types and addressing modes.

Opcodes

15 instructions, each identified by its unique opcode which is specifided in bits [15:12] of the instruction.

Data Types

Every opcode will interpret the bit patterns of its operands according to the data type it is designed to support.

Addressing modes

A mechanism for specifying where the operand is located. An operand can generally be found in memory or register or as a part of the instruction. If the operand is a part of the instruction, we refer to it as a literal _or as an _immediate _operand. LC-3 supports FIVE addressing modes : immediate ( or literal ), register, and 3 memory addressing modes : PC-relative, indirect and Base+offset_..

Operate Instructions

ADD

AND

NOT

Opcode Chapter 5 The LC-3 - 图1 Operand

  • Chapter 5 The LC-3 - 图2 DR
  • Chapter 5 The LC-3 - 图3 SR
  • Chapter 5 The LC-3 - 图4 1 11111

FUNTION Chapter 5 The LC-3 - 图5 Condition Codes ✓ based on whether the result is negative, zero, or positive. image.png

Data Movement Instructions

LEA

for Load Effective Address Opcode Chapter 5 The LC-3 - 图7 Operand

  • Chapter 5 The LC-3 - 图8 DR
  • Chapter 5 The LC-3 - 图9 PCoffset PC-Relative Mode

FUNTION Chapter 5 The LC-3 - 图10 Condition Codes ✗ image.png

LD

ST

Opcode Chapter 5 The LC-3 - 图12 Operand

  • Chapter 5 The LC-3 - 图13 SR
  • Chapter 5 The LC-3 - 图14 PCoffset PC-Relative Mode

FUNTION
Chapter 5 The LC-3 - 图15 Condition Codes ✗ image.png

LDI

Opcode Chapter 5 The LC-3 - 图17 Operand

  • Chapter 5 The LC-3 - 图18 DR
  • Chapter 5 The LC-3 - 图19 PCoffset Indirect Mode

FUNTION
Chapter 5 The LC-3 - 图20 Condition Codes ✓ based on whether the value loaded is negative, zero, or positive. image.png

STI

Opcode Chapter 5 The LC-3 - 图22 Operand

  • Chapter 5 The LC-3 - 图23 SR
  • Chapter 5 The LC-3 - 图24 PCoffset PC-Relative Mode

FUNTION
Chapter 5 The LC-3 - 图25 Condition Codes ✗ image.png

LDR

Opcode Chapter 5 The LC-3 - 图27 Operand

  • Chapter 5 The LC-3 - 图28 DR
  • Chapter 5 The LC-3 - 图29 BaseR
  • Chapter 5 The LC-3 - 图30 offset Base+offset Mode

FUNTION
Chapter 5 The LC-3 - 图31 Condition Codes ✓ based on whether the value loaded is negative, zero, or positive. image.png

STR

Opcode Chapter 5 The LC-3 - 图33 Operand

  • Chapter 5 The LC-3 - 图34 SR
  • Chapter 5 The LC-3 - 图35 BaseR
  • Chapter 5 The LC-3 - 图36 offset Base+offset Mode

FUNTION
Chapter 5 The LC-3 - 图37 Condition Codes ✗ image.png

Control Instructions

BR

JMP

Opcode Chapter 5 The LC-3 - 图39 Operand

  • Chapter 5 The LC-3 - 图40 SR
  • Chapter 5 The LC-3 - 图41 BaseR
  • Chapter 5 The LC-3 - 图42 000000

FUNTION
Chapter 5 The LC-3 - 图43 Condition Codes ✗ image.png

TRAP

or say service call Opcode Chapter 5 The LC-3 - 图45 Operand

  • Chapter 5 The LC-3 - 图46 0000
  • Chapter 5 The LC-3 - 图47 trapvector

FUNTION
Chapter 5 The LC-3 - 图48 Condition Codes ✗ image.png

The Data Path of the LC-3

image.png

Basic Components

The Global Bus

It consists of 16 wires and associated eletronics. Tristate Device Each structure which supplies values to the bus has a triangle called a tristate device behind its input arrow to th bus. Function To enable exactly one supplier to provide infomation to the bus at any one time. LD.x ( load enable) signal If it’s asserted, the corresponding structure will obtain the value supplied.

:::warning

Memory

To perform a load MAR -> Memory -> MDR
To perform a store MAR, MDR -> Memory with WE signal :::

The ALU and the Register File

Inputs of ALU

  • Source 1 from a register
  • Source 2 from either a register or the sign-extended immediate value

Outputs of ALU

  • A result stored in one of the registers
  • The THREE single-bit condition codes

:::warning

The PC and the PCMUX

PCMUX selects the changed input of PC

  • Incremented PC
  • PC + PCoffset
  • From the global bus ( stack of memory ) :::

    The MARMUX

    It selects which of two sources will supply the MAR with appropriate addressing during the execution of a load, a store, or a TRAP instruction.

    • Incremented PC / A base register / literal value
    • zero-extened trapvector, which is needed to invoke service calls

The Instruction Cycle Specific to the LC-3