일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- XML
- DB
- MIPS
- DoM
- instruction
- python
- DATAPATH
- Algorithm
- function
- react
- Java
- Class
- system
- mysql
- control
- Linux
- javascript
- data structure
- while
- php
- CSS
- computer
- DS
- html
- Pipelining
- github
- web
- for
- MacOS
- architecture
- Today
- Total
YYYEJI
[CS] Memory Structure of ARM and MIPS 본문
Assembly 언어로 아래와 같이 있을 때,
204 BEQ, $t0, $zero, Less
208 ADD, $s2, $s0, $s1
*** something ***
216 j Exit .
(위에 명렁어는 t0 == zero 이면 Less로 이동하라는 의미입니다.)
위에 있는 assembly code가 machine code로 바뀌면
000000 10001 10010 01000 00000 101010 /* slt
000100 01000 00000 00000 00000 00010 /* beq
000000 ............................................................. /* add
000010 ............................................................. /* j
000000 ............................................................. /* sub
이렇게 변환됩니다.
이때 BEQ 함수를 자세히 봅시다.
BEQ 함수를 실행했을 때 PC의 값은 다음 수행 Instuction의 주소인 208이 들어가 있습니다.
BEQ 함수의 값이 True라면 PC에는 216(PC+2*4)의 값이 들어갑니다.
그렇게 나온 공식은
PC(Address of next instruction) =
PC + (BEQ함수에서 else일 때 넘어가는 함수까지의 거리) * (현재 주소에서 다음 주소까지의 거리)
입니다.
◡̈
'Computer architectures' 카테고리의 다른 글
[MIPS] Register Model - 2 (2) | 2022.09.24 |
---|---|
[MIPS] Register Model - 1 (0) | 2022.09.24 |
[CS] Instruction Set Completeness (0) | 2022.09.22 |
[CS] CISC vs RISC (0) | 2022.09.22 |
[CS] Exercise for Addressing Modes (0) | 2022.09.22 |