일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- DoM
- web
- python
- DS
- react
- Linux
- Class
- mysql
- data structure
- MIPS
- Algorithm
- while
- control
- DATAPATH
- MacOS
- DB
- php
- system
- computer
- architecture
- function
- for
- javascript
- CSS
- XML
- github
- instruction
- Java
- Pipelining
- html
- Today
- Total
YYYEJI
[MIPS] RTL 이란? 본문
RTL은
Register Transfer Language의 줄임말로써,
Register와 register 간에 데이터가 이동하는 흐름 방향을 자세하게 보여줄 수 있는 수준의 언어입니다.
예제를 살펴보겠습니다.
① add operation
op code | rs | rt | rd | shamt | function code |
add rd, rs, rt
↓↓↓ RTL Description ↓↓↓
IR ← mem[PC]; # Fetch instruction from memory
R[rd] ← R[rs] + R[rt]; # ADD operation
PC ← PC + 4; # Calculate next address
② sub operation
op code | rs | rt | rd | shamt | function code |
sub rd, rs, rt
↓↓↓ RTL Description ↓↓↓
IR ← mem[PC]; # Fetch instruction from memory
R[rd] ← R[rs] + ~R[rt] + 1; # SUB operation
PC ← PC + 4; # Calculate next address
~는 invet를 의미하고, +1은 2' complement를 의미합니다.
③ lw operation
op code | rs | rt | immediate |
lw rt, rs, imm16
↓↓↓ RTL Description ↓↓↓
IR ← mem[PC]; # Fetch instruction from memory
Addr ← R[rs] + SignExt(imm 16); # Compute memory address
R[rt] ← Mem[Addr]; # Load data into register
PC ← PC + 4; # Calculate next address
SignExt은 sign bit을 기준으로 빈 공간을 채우는 것을 의미하는데,
Sign bit이 1이면 1로, sign bit이 0이면 0으로 채웁니다.
④ sw operation
op code | rs | rt | immediate |
sw rt, rs, imm16
↓↓↓ RTL Description ↓↓↓
IR ← mem[PC]; # Fetch instruction from memory
Addr ← R[rs] + SignExt(imm 16); # Compute memory address
Mem[Addr] ← R[rt]; # Store data into memory
PC ← PC + 4; # Calculate next address
⑤ beq operation
op code | rs | rt | immediate |
beq rt, rs, imm16
↓↓↓ RTL Description ↓↓↓
IR ← mem[PC]; # Fetch instruction from memory
Cond ← R[rs] + ~R[rt] + 1; # Compute conditonal Cond
PC ← Cond ? PC + 4; # Fall through if non-zero Cond : PC + 4 + (SignExt(imm 16) << 2;
# Branch if zero Cond
rt와 rs가 같으면 zero가 Cond에 들어가고, 다르면 non-zero가 Cond에 들어갑니다.
◡̈
'Computer architectures' 카테고리의 다른 글
[MIPS] Instruction에 따른 Functional units (0) | 2022.10.31 |
---|---|
[MIPS] Register File Design (2) | 2022.10.31 |
[MIPS] Instruction 실행하는 기본 순서 (0) | 2022.10.31 |
[MIPS] Single clock cycle 이란? (0) | 2022.10.31 |
[MIPS] CPU의 Edge Triggered (0) | 2022.10.30 |