Using MIPS, make an array of 10 elements. loop so that it multiplies every element by 4 WITHOUT USING MULTIPLY INSTRUCTION.
USE SLL
MIPS PROGRAM :-
.data
Array:
.word 1,2,3,4,5,6,7,8,9,10
.text
.globl main
main:
addi $t0, $0, 0
la $t2, Array
LOOP:
lw $t1, 0($t2)
#retrieiving the value of each element in array
sll $t1, $t1, 2
#multiplying each element with 4
sw $t1, 0($t2) #storing the modified value
in array
addi $t0, $t0, 1 #counter++
addi $t3, $0, 10
bne $t0, $t3, LOOP
#program exit
addi $v0, $0, 10
syscall
Get Answers For Free
Most questions answered within 1 hours.