Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- web
- html
- Class
- Java
- Pipelining
- while
- DATAPATH
- github
- function
- for
- control
- instruction
- Linux
- DS
- system
- php
- architecture
- javascript
- MIPS
- Algorithm
- mysql
- XML
- react
- CSS
- MacOS
- python
- computer
- data structure
- DB
- DoM
Archives
- Today
- Total
목록C (1)
YYYEJI
[MIPS] Array에서 값을 가져오고 저장하는 Assembly code
** C code를 기준 ** array에서 값을 가져오고 싶을 때 a = A[1]라고 작성을 하고, array에 저장하고 싶을 땐 A[1] = a라고 작성을 하게 됩니다. c 코드를 assembly code로 변환을 해보겠습니다. A[4] = A[8] + 4 lw $t0, 32($s0) # t0 = A[8] addi $t0, $t0, 4 # t0 = t0 + 4 = A[8] + 4 sw $t0, 16($s0) # A[4] = t0 $s0는 A[0]를 가르킵니다. 한 줄씩 살펴보면 lw $t0, 32($s0) # t0 = A[8] $t0에 A[8]의 값을 가져와서 저장하는데 32 값은 4*8입니다. (1 word가 4bytes이기 때문입니다.) addi $t0, $t0, 4 # t0 = t0 + 4 = ..
Computer architectures
2022. 10. 19. 01:57