일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- for
- Java
- DATAPATH
- DS
- Algorithm
- Class
- while
- MacOS
- html
- architecture
- php
- computer
- react
- Linux
- XML
- javascript
- mysql
- DoM
- function
- data structure
- DB
- web
- system
- github
- CSS
- control
- python
- MIPS
- instruction
- Pipelining
- Today
- Total
목록system (66)
YYYEJI

Spim 이란? MIPS chip이 아니여도 assembly 코드를 읽고 실행시켜 주는 simulator입니다. 여러 OS(window, mac os, linux)에서 코드를 한 줄씩 실행시켜 줍니다. (interface) (앞에 붙은 Ot는 최신 버전을 뜻합니다.) ↓↓↓ 아래 링크를 클릭해 주세요 ↓↓↓ https://sourceforge.net/projects/spimsimulator/files/ spim mips simulator - Browse Files at SourceForge.net This directory contains compiled, installable copies of Spim for various operating systems: QtSpim: QtSpim_*_Windows...

① BEQ / BNE 16-bit Offset ② J 26-bit address ③ JR 32-bit address 많은 거리를 jump하고 싶을 땐 많은 address를 가지고 있는 ③을 이용해라. ↓↓↓ BEQ / BNE ↓↓↓ https://yyyeji.tistory.com/120 [CS] MIPS Conditional branch Instruction (BEQ, BNE) ① BEQ - Branch if Equal Ex) BEQ $s1, $s2, label # if($s1 == $s2) PC op = 4 rs = 17 rt = 18 offset (word count) $s1의 값과 $s2의 값이 같으면 label의 값이 계산되어서 PC에 들어갑니다. ② BNE - Br.. yyyeji.tistory..

JUMP - 16bits 새로운 target 주소(PC)로 점프하는 instruction입니다. Ex) J label → PC = target address (Memory addressing mode와 굉장히 밀접한 관련이 있다.) op = 2 word address (Jump instruction의 op code는 2) Jump Register - 26bits JR $ra # PC ← $ra ( $ra → 31 register) op = 0 rs = 31 rt = 0 rd = 0 shamt = 0 func = 8 (R type 이기 때문에 op code는 0) (function code가 8이면 JR instruction) ($ra가 31번째 있기 때문에 rs가 31번) (나머지는 0으로 채워줌) Ju..

BEQ와 BNE로 같다(==)와 다르다(!=)라는 수식을 사용할 수 있지만 작다() 등은 어떻게 표현할 수 있을까요 ? 그렇게 MIPS에서 특별하게 만들어진 새로운 instruction이 있습니다. 바로 slt instruction 입니다. (Set less than) Ex 1) slt $t0, $s1, $s2 # if $s1

① BEQ - Branch if Equal Ex) BEQ $s1, $s2, label # if($s1 == $s2) PC op = 4 rs = 17 rt = 18 offset (word count) $s1의 값과 $s2의 값이 같으면 label의 값이 계산되어서 PC에 들어갑니다. ② BNE - Branch if Not Equal Ex) BNE $s1, $s2, label # if($s1 != $s2) PC op = 5 rs = 17 rt = 18 offset (word count) $s1의 값과 $s2의 값이 다르면 label의 값이 계산되어서 PC에 들어갑니다. ◡̈

① Load Memory → Register Ex) LW $s1, 8($s0) # $s1 ← Memory[$s0 + 8] ② Store Register → Memory Ex) SW $s1, 12($s0) # Memory[$s0 + 12] ← $s1 C code를 assembly code로 바꾸는 예제를 살펴보겠습니다. C code A[8] = a + A[8] Assembly code # A[0]의 주소가 $s3에 있다고 가정 # a의 값은 $s2에 있다고 가정 lw $t0, 32($s3) # A[8]은 array의 8번째 이면서 4bytes씩 할당되어 있기 때문에 4*8위치에 있는 $s3가 됩니다. # $t0 ← A[8] add $t0, $s2, $t0 # $t0 ← $s0 + $t0 sw $t0, 32..

① Arithmetic Instruction ADD $s0, $s1, $s2 # $s0 ← $s1 + $s2 ADDI $s0, $s1, 100 # $s0 ← $s1 + 100 SUB $ s0, $s1, $s2 # $s0 ← $s1 - $s2 MULT $s1, $s2 # Hi, Lo ← $s1 * $s2 DIV $s1, $s2 # Hi, Lo ← $s1 / $s2 MFHI $s1 # $s1 ← Hi MFLO $s1 # $s1 ← Lo ( MFHI → Move From High, MFLO → Move From Low ) ② Logical Instructions AND $s0, $s1, $s2 # $s0 ← $s1 bitwise-AND $s2 OR $s0, $s1, $s2 # $s0 ← $s1 bitwise-..

Mips에서 컴퓨터 구조가 만들어질 때 사용된 4가지 원칙에 대해서 알아보아요. $ - register MPIS는 ① Maximize performance (최대화된 기능) ② Minimize cose (최소화된 비용) ③ Reduce design time (디자인 시간 감소) 를 목표로 하고 있습니다. 이 목표에 따른 4가지 원칙이 있는데 같이 알아보아요. ① To be simple, it should be regular. 심플하기 위해서는, 규칙적이여야 한다. (규칙적 → 심플, 심플 → 목표) Ex) 3개의 Operand가 있고 destination이 앞으로 오도록 한다. ADD C, A, B ② Smaller is faster. ( MIPS - register addressing mode ) re..