Computers/Computer Architecture

lecture 4. Addressing Modes

emzei 2014. 1. 29. 15:48

MIPS Addressing for 32-bit Immediate and Addresses

32-Bit Immediate Operands

- Load upper immediate(lui) instruction


Addressing in Branches and Jumps

▶ J Type instruction format

opcode

(word) address

6bits

26bits

▶ Direct addressing mode

j 10000  // branch address = 10000

▶ Word addressing

* Addressing in jump instruction

Alignment restriction -> instruction address = 4n -> LS 2 bits = 00

* word address 

branch address = 4 * address

ex)  j 10000  // branch address = 40000


MIPS Addressing Mode summary

▶ Pseudo-Direct Addressing mode

- 명령어 내의 26비트를 PC의 상위 비트들과 연접하여 점프 주소를 구한다.

- PC의 상위 4비트는 변하지 않음

- 주소 범위 : 2^28 = 256MB

- Jump address

from PC

from instruction

00

4bits

26bits

2bits


▶ PC-relative Addressing mode

- PC값과 명령어 내 상수의 합을 더해서 주소를 구한다.

- Branch target address = (PC+4) + branch offset

- new PC ~ (PC + 4) ± 2^15 words = (PC+4) ± 2^17 bytes

- PC - 131068 ≤ new PC (=branch target address) ≤ PC + 131072


▶ Immediate Addressing mode : I Type / 피연산자는 명령어 내에 있는 상수

▶ Register Addressing mode : 피연산자는 레지스터이다

▶ Base Addressing mode : 메모리 내용이 피현산자이다. 메모리 주소는 레지스터와 명령어 내에 있는 상수이다.

▶ 레지스터 간접 주소 지정 : 데이터가 저장된 주소값을 레지스터에 저장하여 이 레지스터를 이용하여 연산.


Decodig Machine Language

ex) 00AF8020 hex

ans) 

0000 00

00 1010 1111 1000 0000 0010 0000

     OP code -> 0 -> R type


000000

00101

01111

10000

00000

100000

op

rs

rt

rd

shamt

funct


funct = 100000 -> add


'Computers > Computer Architecture' 카테고리의 다른 글

lecture 5. History of ISA  (0) 2014.01.29
lecture3. Machine instructions  (0) 2014.01.29
lecture2. MIPS Instruction  (0) 2014.01.29