这些四条指令需要多少个时钟周期?
#Macro Instructions
li $t0, 32 # 1 or 2 cycles ?
#
# Based on MIPS Assembly Language Programming by Robert Britton :
#
# lui $at, Upper 16-bits of value
# ori Rd, $at, Lower 16-bits of value
# ***OR***
# ori Rt, $0, value
#
#
# But when I run it on Mars4_3 it showed the assembler
# converted it to addiu, $8, $0, 0x00000020
div $t2, $t2, $t0 # 41 cycles?
# bne Rt, $0,
# break $0
# ok: div Rs, Rt
# mflo Rd
#Integer Instruction
lw $t2, 0($t1) # 1 cycles?
sw $t2, 0($t3) # 1 cycles?
答案 0 :(得分:2)
好吧,我可以肯定地告诉你lw
和sw
肯定不会在1个周期内执行。事实上,没有办法说这些指令执行需要多长时间,因为这些指令将有多个级别的缓存,每个指令都要点击或丢失。对于访问内存的指令,您可以做的最好是给出平均访问时间。