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 |
31 |
Tags
- segmentation
- AI
- 리눅스
- 회전 복잡도
- sort
- 네트워크 충돌
- ROS2
- Java
- 컴퓨터구조
- humble
- homogenous
- 정보처리기사
- 정처기
- homogeinous
- 3dof
- 합병
- 맥케이브
- SQL
- robotics
- CentOS
- 소스 코드 품질 분석
- Computer
- 기구학
- Coding
- 알고리즘
- Linux
- 명령어
- sam2
- 정렬
- MIPS
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
syscall
728x90