Title: The LC3 Part I
1The LC-3 Part I
2Outline
- The ISA Overview
- Memory, Registers, Instruction Set, Opcodes,
Datatypes, Addressing Modes, Condition Codes - Operate Instructions
- ADD, AND, NOT
- Data Movement Instructions
- PC-Relative Mode, Indirect Mode, BaseOffset
Mode, Immediate Mode, Examples
3ISA
- The ISA specifies all the information about the
computer that the software needs to be aware of. - Who uses an ISA?
- What is specified?
4LC-3 Memory Organization
- Address space
- Addressability
- Word Addressable/Byte Addressable?
5LC-3 Registers
- General Purpose Registers
- Is the PC considered to be a GPR?
- Conventions
6LC-3 Instruction Set
- Instruction
- Op Code
- Operands
- Instruction Set
- Op Codes
- Operate
- Data movement
- Control
- Data Types
- Addressing Modes
7How Many Instructions?
8 Indicates instructions that modify condition
codes
9 Indicates instructions that modify condition
codes
10Addressing Modes
- Where can operands be found?
- 1
- 2
- 3
11Addressing Modes
- Immediate or Literal
- Register
- PC-relative
- Indirect
- Base Offset
12Condition Codes
- N - Negative
- Z - Zero
- P - Positive
- When are condition code registers set?
13Operate Instructions
14Operate Instructions
- ADD, AND
- Addressing Mode?
15gateMARMUX
gatePC
3
REG FILE SR2 SR1 OUT OUT
DR
PC
MARMUX
LD.PC
1
16
PCMUX
LD.REG
2
3
3
16
SR1
SR2
ZEXT
ADDR2MUX
70
2
ADDR1MUX
16
16
16
16
SEXT
100
0
16
SEXT
40
SEXT
80
FINITE STATE MACHINE
SR2MUX
SEXT
50
LD.CC
A
B
2
R
IR
LD.IR
LOGIC
gateALU
16
16
GateMDR
16
16
MDR
MAR
MEMORY
INPUT
OUTPUT
LD.MDR
LD.MAR
MEM.EN, R.W
16Data Movement Instructions
- GPR ? Memory
- GPR ? I/O Devices
- GPR ? Memory ???
- Memory ? GPR ???
17Data Movement Instructions
18Basic Format
These encode information on how to form a 16 bit
address
19Data Movement Instructions
20gateMARMUX
gatePC
3
REG FILE SR2 SR1 OUT OUT
DR
PC
MARMUX
LD.PC
1
16
PCMUX
LD.REG
2
3
3
16
SR1
SR2
ZEXT
ADDR2MUX
70
2
ADDR1MUX
16
16
16
16
SEXT
100
0
16
SEXT
40
SEXT
80
FINITE STATE MACHINE
SR2MUX
SEXT
50
LD.CC
A
B
2
R
IR
LD.IR
LOGIC
gateALU
16
16
GateMDR
16
16
MDR
MAR
MEMORY
INPUT
OUTPUT
LD.MDR
LD.MAR
MEM.EN, R.W
21Data Movement Instructions
22gateMARMUX
gatePC
3
REG FILE SR2 SR1 OUT OUT
DR
PC
MARMUX
LD.PC
1
16
PCMUX
LD.REG
2
3
3
16
SR1
SR2
ZEXT
ADDR2MUX
70
2
ADDR1MUX
16
16
16
16
SEXT
100
0
16
SEXT
40
SEXT
80
FINITE STATE MACHINE
SR2MUX
SEXT
50
LD.CC
A
B
2
R
IR
LD.IR
LOGIC
gateALU
16
16
GateMDR
16
16
MDR
MAR
MEMORY
INPUT
OUTPUT
LD.MDR
LD.MAR
MEM.EN, R.W
23Data Movement Instructions
24gateMARMUX
gatePC
3
REG FILE SR2 SR1 OUT OUT
DR
PC
MARMUX
LD.PC
1
16
PCMUX
LD.REG
2
3
3
16
SR1
SR2
ZEXT
ADDR2MUX
70
2
ADDR1MUX
16
16
16
16
SEXT
100
0
16
SEXT
40
SEXT
80
FINITE STATE MACHINE
SR2MUX
SEXT
50
LD.CC
A
B
2
R
IR
LD.IR
LOGIC
gateALU
16
16
GateMDR
16
16
MDR
MAR
MEMORY
INPUT
OUTPUT
LD.MDR
LD.MAR
MEM.EN, R.W
25Data Movement Instructions
No memory access!
26Example
GPR's
x0000
x1000
x2000
x3000
x4000
x5000
x3000 0010 010 000000111 x3008 0000 0000 0000
0001
x6000
x7000
27Example
GPR's
x0000
x1000
x2000
x3000
x4000
x5000
x3000 1010 011 000000111 x3008 0011 0000 0001
0000 x3010 0000 0000 0010 1010
x6000
x7000
28Example
GPR's
x0000
x1000
x2000
x3010
x4000
x5000
x3000 0111 110 011 000011 x3010 0000 0000
0010 1010 x3011 0000 0000 0000 0000 x3012 0000
0000 0000 1111 x3013 0000 0000 1111 0000
x6000
x7000
29Example
GPR's
x0000
x1000
x2000
x0000
x4000
x5000
x3000 1110 011 0 0000 1111 x3010 0000 0000
0010 1010 x3011 0000 0000 0000 0000 x3012 0000
0000 0000 1111 x3013 0000 0000 1111 0000
x6000
x7000
30(No Transcript)