Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 445 CS1251 Computer Organization Carl Hamacher

Similar presentations


Presentation on theme: "ECE 445 CS1251 Computer Organization Carl Hamacher"— Presentation transcript:

1 ECE 445 CS1251 Computer Organization Carl Hamacher
Addressing Modes CS1251 Computer Organization Carl Hamacher 11/7/2018 Department of Information Technology RJH

2 Department of Information Technology
ECE 445 Addressing Modes Name Syntax Addressing Function Immediate #Value Operand = Value Register Ri EA = Ri Absolute (Direct) LOC EA = LOC Indirect (Ri) (LOC) EA = [Ri] EA = [LOC] Index X(Ri) EA = [Ri] + X Relative X(PC) EA = [PC] + X Autoincrement (Ri)+ EA = [Ri]; Ri  [Ri] + 1 Autodecrement –(Ri) Ri  [Ri] – 1; EA = [Ri] EA = Effective Address 11/7/2018 Department of Information Technology RJH

3 Absolute, Register, Immediate
ECE 445 Absolute, Register, Immediate Assembly Language MOVE NUM1,R1 MOVE #1,R2 ADD #1,R1 ADD R1,R2 Register Transfer Notation R1  [NUM1] R2  1 R1  1 + [R1] R2  [R1] + [R2] 11/7/2018 Department of Information Technology RJH

4 Department of Information Technology
ECE 445 Instruction Results MOVE #NUM2,R0 MOVE NUM1,R1 MOVE #5,R2 ADD #-1,R2 MEM REGS Label Addr Contents 0B NUM1 0C X"000A" NUM2 0D X"0007" 0E Addr Contents 1 2 3 X"000D" X"000A" X"0005" X"0004" 11/7/2018 Department of Information Technology RJH

5 Department of Information Technology
ECE 445 Indirect Addressing Assembly Language MOVE (R0),R2 MOVE (R1),NUM1 ADD (R3),R1 ADD #1,(R3) Register Transfer Notation R2  [MEM([R0])] MEM(NUM1)  [MEM([R1])] R1  [MEM([R3])] + [R1] MEM([R3])  1 + [MEM([R3])] 11/7/2018 Department of Information Technology RJH

6 Department of Information Technology
ECE 445 Instruction Results MOVE (R0),R2 MOVE (R1),NUM1 ADD #1,(R3) MEM REGS Label Addr Contents 12 NUM1 13 NUM2 14 X"0007" 15 X"0009" Addr Contents 1 2 3 X"0012" X"0003" X"0004" X"0014" X"0009" X"0015" X"0007" 11/7/2018 Department of Information Technology RJH

7 Loop to Add n Numbers MOVE N,R1 Counter CLEAR R0 Accumulator LOOP
ECE 445 Loop to Add n Numbers MOVE N,R1 Counter CLEAR R0 Accumulator LOOP Determine address of "Next" number and add "Next" number to R0 Program loop DECREMENT R1 BRANCH>0 LOOP PC  [PC] + Offset (CC>0) MOVE R0,SUM . . . SUM N n NUM1 . . . NUMn 11/7/2018 Department of Information Technology RJH

8 Use of Indirect Addressing
ECE 445 Use of Indirect Addressing MOVE N,R1 MOVE #NUM1,R2 CLEAR R0 LOOP ADD (R2),R0 ADD #1,R2 DECREMENT R1 BRANCH>0 LOOP MOVE R0,SUM R0 Accumulator R1 n Counter R2 NUM1 Pointer R3 SUM N n NUM1 . . . NUMn 11/7/2018 Department of Information Technology RJH

9 Indexed Addressing (Arrays)
ECE 445 Indexed Addressing (Arrays) Assembly Language MOVE X(R0),R1 MOVE R2,Y(R3) ADD Z(R1),R2 Register Transfer Notation R1  [MEM(X + [R0])] MEM(Y + [R3])  [R2] R2  [MEM(Z + [R1])] + [R2] 11/7/2018 Department of Information Technology RJH

10 Assembly Language to Machine Instructions
ECE 445 Assembly Language to Machine Instructions Assembler (Program) Source Program (Assembly Language) Object Program (Machine Instructions) Assembler Directives (Commands) How to Interpret Names Where to Place Instructions in Memory Where to Place Data in Memory 11/7/2018 Department of Information Technology RJH

11 Department of Information Technology
ECE 445 Assembler Directives START 100 MOVE N,R1 SUM EQU ORIGIN 201 N DATAWORD 300 NUM1 RESERVE 300 ORIGIN 100 START MOVE N,R1 MOVE #NUM1,R2 CLR R0 LOOP ADD (R2),R0 ADD #1,R2 DEC R1 BGTZ LOOP MOVE R0,SUM RETURN END START 101 MOVE #NUM1,R2 102 CLEAR R0 LOOP 103 ADD (R2),R0 104 ADD #1,R2 105 DECREMENT R1 106 BRANCH>0 LOOP 107 MOVE R0,SUM . . . SUM 200 N 201 300 NUM1 202 11/7/2018 Department of Information Technology RJH

12 Department of Information Technology
ECE 445 Two-Pass Assembler First Pass Create Symbol Table Names Assigned Numerical Values Second Pass Translates Assembly Language to Machine Code Substitutes Values for Names Computes Branch Offsets 11/7/2018 Department of Information Technology RJH

13 Encoding of Machine Instructions
ECE 445 Encoding of Machine Instructions Opcode Source Dest Other Info One-Word Instruction Opcode Source Dest Other Info Two-Word Instruction Memory Address / Immediate Operand Opcode Ri Other Info Three-Operand Instruction Rj Rk 11/7/2018 Department of Information Technology RJH

14 HW2 Instruction Encoding
ECE 445 HW2 Instruction Encoding OP SRC DST VALUE IR Assembly Language OP SRC, DST Example MOVE R1,R2 Register Transfer Notation DST  [SRC] OP [DST] Example R2  [R1] 11/7/2018 Department of Information Technology RJH

15 Department of Information Technology
ECE 445 HW2 Addressing Modes Mode REG # Name Syntax Addr Fn SRC 00 00-11 Register Direct Rn EA = Rn 01 Register Indirect (Rn) EA = [Rn] 10 XX Immediate #Value Operand = Value 11 Absolute Value EA = Value Mode REG # Name Syntax Addr Fn DST 00-11 Register Direct Rn EA = Rn 1 XX Absolute Value EA = Value EA = Effective Address 11/7/2018 Department of Information Technology RJH

16 Single-Bus Architecture
ECE 445 Single-Bus Architecture BUS A 6 6 MAR 3 PC ROM MEM 1 MDR 2 IR 1 1 2 6 MUX MUX 2 Y 1 1 REGS A B ALU R Z 11/7/2018 Department of Information Technology RJH

17 SRC Control Flowchart Reg Direct 00 Reg Indir 01 Y  [REGS([SRC_REG])]
ECE 445 SRC Control Flowchart Reg Direct 00 Reg Indir 01 N N Y Y Y  [REGS([SRC_REG])] MAR  [REGS([SRC_REG])] MDR  [MEM([MAR])] Y  [MDR] 11/7/2018 Department of Information Technology RJH

18 Department of Information Technology
ECE 445 SRC Control Flowchart Immediate 10 Absolute 11 N N Y Y Y  Value MAR  Value MDR  [MEM([MAR])] Y  [MDR] 11/7/2018 Department of Information Technology RJH

19 Department of Information Technology
ECE 445 DST Control Flowchart Reg Direct Absolute 1 N N Y Y REGS([DST_REG])  [Z] MAR  Value MDR  [Z] MEM([MAR])  [MDR] 11/7/2018 Department of Information Technology RJH

20 Department of Information Technology
ECE 445 Questions? 11/7/2018 Department of Information Technology RJH


Download ppt "ECE 445 CS1251 Computer Organization Carl Hamacher"

Similar presentations


Ads by Google