Title: Overview
1Overview
The LC-3 Computer - A limited 3 address
machine Computer machine instructions - the
basic instructions that all programs use on that
computer The Instruction Cycle - the
steps in the execution of a machine language
instruction The Operate Instructions - ADD,
AND, NOT The Data Movement Instructions -
Load, Load Address, Store
2LC-3 Data Path
Combinational Logic
Storage
State Machine
3Computer Machine Instruction Formats
- What is contained IN an instruction?
- Specifies the operation to be performed
- Where to get the operands
- Where to put the result
- What are the major instruction types?
- Operate (add, sub, mult,OR, AND, etc.)
- Data Movement (Load, Store)
- Control (branch, jump to subroutine, etc.)
4The LC-3 Instruction
- ADDRESSING MODES
- Immediate
- (Operand is in the instruction)
- Register
- (Operand is in one of the 8 registers)
- PC-relative
- (Operand is offset from the (PC) )
- Base Offset (Base relative)
- (Operand is offset from the contents of a
register) - Indirect
- (The Operand actually points to the real
address - rather than being the operand)
5The Instruction Cycle
- Steps (or phases)
- Fetch Next Instruction from Memory
- (PC) ? (points to) next instruction
- PC ?(PC) 1
- Decode Fetched Instruction
- Evaluate Address (es)
- Fetch Operand (s)
- Execute Operation
- Store Result (if specified)
6LC-3 Memory Layout
X000 x2FFF Operating System programs, tables,
and data Generally off limits to applications
programmer (Program run in Supervisor
mode) X3000 xFDFF User Program Area Area
shared by users like you (Run in non-Supervisor
mode) xFE00 xFFFF Device Register
Addresses Mapped memory used for
input/output R0-R7 Registers
7Operate Instructions
- Only three operations ADD, AND, NOT
- Source and Destination operands are registers
8LC-3 Instructions (Fig 5.3 Appendix a)
9ADD/AND (Register)
10NOT (Register)
Note Src and Dstcould be the same register.
11ADD/AND (Immediate)
Note Immediate field issign-extended.
12Data Movement Instructions
- Load -- read data from memory to register
- LD PC-relative mode 0010 DR PCoffset9
- LDI indirect mode 1010 DR PCoffset9
- LDR baseoffset mode 0110 DR BaseR offset6
- Store -- write data from register to memory
- ST PC-relative mode 0011 DR PCoffset9
- STI indirect mode 1011 DR PCoffset9
- STR baseoffset mode 0111 DR BaseR offset6
- Load effective address address saved in
register - LEA immediate mode 1110 DR PCoffset9
13LD (PC-Relative)
14ST (PC-Relative)
15LDI (Indirect)
16STI (Indirect)
17LDR (BaseOffset)
18STR (BaseOffset)
19LEA (Immediate)