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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started