Question: This is using MARS (MIPS simulator) This is supposed to multiply two 4 bit numbers but everytime i enter an input the output is 0.

This is using MARS (MIPS simulator)

This is supposed to multiply two 4 bit numbers but everytime i enter an input the output is 0. HELP!

.data # Multiply 2 4-bit numbers! # s0 - input number one # t1 - input number two # s0 - return value

.text .globl main main: jal func move a0, s0 li v0, 1 syscall # program exit syscall: li v0, 10 syscall

func: # Get user first input li v0, 5 syscall move t0, s0 # Get user second input li v0, 5 syscall move t3, t1 li t4, 0 li t1, 1 li t2, 4 _func_do: and t9, t3, t1 beq t9, zero, _func_endif add t4, t4, t0 _func_endif: sll t0, t0, 1 sll t1, t1, 1 sub t2, t2, 1 bne t2, zero, _func_do move s0, t4 jr ra

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!