mips number of clock cycles and how improving code
- by Hooman
I'm really new in MIPS and I have these questions which I found so many dissimil answers for them ... if someone can help, it would be great. Thanks
How many clock cycles does this code take?
#Macro Instructions
li $t0, 32 # 1 or 2 cycles ?
# lui $at, Upper 16-bits of value
# ori Rd, $at, Lower 16-bits of value
# -----------------------------------
# ori Rt, $0, value
#
# Which set of instructions will be executed?
div $t2, $t2, $t0 # 41 cycles?
# bne Rt, $0,
# break $0
# ok: div Rs, Rt
# mflo Rd
#Integer Instruction
lw $t2, 0($t13) # 1 cycles?
sw $t2, 0($t3) # 1 cycles?
How those 4 lines of codes can be significantly improved? by avoiding to use Macros or ... ?