MIPS code: Using Assembly Input: A predefined array. The size of the array is 10
ID: 3689768 • Letter: M
Question
MIPS code: Using Assembly Input: A predefined array. The size of the array is 100 Output: 1) The sum of all even digits 2) The sum of all odd digits Requirements: Please use “loop unrolling” & “rescheduling” to optimize your code. Use 5-stage pipeline to explain your rescheduling strategy. Array: 7 99 100 90 34 30 10 29 64 29 88 19 55 98 5 86 68 5 29 60 51 100 39 55 24 52 46 58 76 16 59 37 47 7 57 31 11 23 82 88 76 86 22 73 63 66 41 98 36 82 51 54 7 95 71 19 36 67 46 30 27 36 91 60 94 86 33 47 22 36 64 78 55 83 86 21 22 78 62 29 93 27 93 11 18 47 87 44 18 39 50 90 42 4 3 80 61 99 55 81
Explanation / Answer
DATA SEGMENT
A DW 1,2,3,4,5,6,7,8,9,10
i.e my_array:times
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,A
MOV DX,0000
MOV BL,02
MOV CL,10
L1:MOV AX,WORD PTR[SI]
DIV BL
CMP AH,00
JNZ L2
INC DH
JMP L3
L2:INC DL
L3:
ADD SI,2
DEC CL
CMP CL,00
JNZ L1
MOV AH,4CH
INT 21H
CODE ENDS
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.