Download LC-3 Computer: Architecture, Memory Map, Instructions, and Addressing Modes and more Slides Electric Machines in PDF only on Docsity!
Chapters 5 - The LC-
LC-3 Computer
- Architecture
- Memory Map
- Machine Instructions
- Address Modes
- Operate Instructions
- Data Move Instructions
- Programming in Machine Code
The LC-3 Computer
a von Neumann machine
Memory
PSW (Program Status Word): Bits: 15 10 9 8 2 1 0 | S| |Priority| | N| Z| P|
PSW
Fetch: Next Instruction from Memory (PC) (points to) next instruction PC (PC) + 1
Decode: Fetched Instruction
Evaluate: Instr & Address (es) (find where the data is)
Fetch: Operand (s) (get data as specified)
Execute: Operation Store: Result (if specified)
The Instruction Cycle:
LC-3 Memory Map
(64K of 1 6 bit words )
256 words (We will get to theses later) 256 words (We will get to these later)
23.5 K words?
39.5 K words?
512 words
Computer Machine Instruction Formats
What is IN an instruction?
- Operation code – what to do
- Input Operand(s) – where to get input operands (memory, registers)
- Output Operand(s) – Where to put results (memory, registers)
What are the major instruction types?
- Data Movement (load, store, etc.)
- Operate (add, sub, mult, OR, AND, etc.)
- Control (branch, jump to subroutine, etc.)
Operate Instructions
- There are only three operate Instructions:
ADD, AND, NOT
• The Source and Destination operands are :
Registers
ADD/AND (Register)
ADD/AND (Immediate)
Note: Immediate field is
sign- extended to 16 bits.
Data Movement Instructions
- Load - read data from memory to a register
- LD: PC-relative mode [0010 DR PCoffset9]
- LDI: indirect mode [1010 DR PCoffset9]
- LDR: base+offset mode [0110 DR BaseR offset6]
- Store - write data from a register to memory
- ST: PC-relative mode [0011 DR PCoffset9]
- STI: indirect mode [1011 DR PCoffset9]
- STR: base+offset mode [0111 DR BaseR offset6]
- Load effective address – address saved in register
- LEA: PC-relative mode [1110 DR PCoffset9]
ST (STore PC-Relative Addressing)
LDI (LoaD Indirect Indirect Addressing)
LDR (LoaD Register Base+Offset Addressing)
STR (Store Register Base+Offset Addressing)
Programming in Machine Code
Write a program in machine code which:
- Adds two integers
- The program will be stored in the computer beginning in location x
- The integers, 26 and 67, will be stored in locations x3010 & x
- The result will be stored in location x
Programming in Machine Code
Modify the program to:
- Subtract two integers
- The program will be stored in the computer beginning in location x
- The integers, 26 and 67, will be stored in locations x3010 & x
- The result will be stored in location x