Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- homogenous
- 회전 복잡도
- 기구학
- 3dof
- sam2
- Coding
- 명령어
- MIPS
- 정렬
- sort
- ROS2
- 리눅스
- 합병
- homogeinous
- CentOS
- 네트워크 충돌
- 정보처리기사
- SQL
- segmentation
- Java
- 자격증
- AI
- 정처기
- humble
- robotics
- 맥케이브
- 알고리즘
- 컴퓨터구조
- Computer
- Linux
Archives
- Today
- Total
UTF-404
MIPS(3) 본문
728x90
💡 MIPS 프로그래밍 조건 사항
- The system uses byte-based address and an element in an array has 4-bytes length.
- Program followings.
1) f = -h + B[g];
2) f = A[B[h] + 1]; - Set the variables as follows :
A={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
B={1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - The output result from the program will be as follows :

- The submitted program will be tested by changing the values of g and h in your program and checked if the results are correct.
.data
arrayA: .word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
arrayB: .word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
typeg: .asciiz "Please, type a number for g: "
typeh: .asciiz "Please, type a number for h: "
result1st: .asciiz "The 1st result is "
result2nd: .asciiz "The 2nd result is "
enter: .asciiz "\n"
.text
main:
li $v0, 4
la $a0, typeg
syscall
li $v0, 5
syscall
add $s1, $zero, $v0
li $v0, 4
la $a0, typeh
syscall
li $v0, 5
syscall
add $s2, $zero, $v0
la $s6, arrayA
la $s7, arrayB
sll $t0, $s1, 2
add $t0, $s7, $t0
lw $t0, 0($t0)
sub $s0, $t0, $s2
li $v0, 4
la $a0, result1st
syscall
add $a0, $zero, $s0
li $v0, 1
syscall
li $v0, 4
la $a0, enter
syscall
sll $t0, $s2, 2
add $t0, $t0, $s7
lw $t0, 0($t0)
addi $t0, $t0, 1
sll $t0, $t0, 2
add $t0, $t0, $s6
lw $s0, 0($t0)
li $v0, 4
la $a0, result2nd
syscall
add $a0, $zero, $s0
li $v0, 1
syscall
li $v0, 4
la $a0, enter
syscall
li $v0, 10
syscall728x90