计算mips汇编控制指令的目标地址 [英] Calculate target address of mips assembly control instruction

查看:61
本文介绍了计算mips汇编控制指令的目标地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定汇编指令:

bne $s0, $s1, DONE

指令地址为500个字节.如果 offset 字段包含以下内容价值:

The address of the instruction is 500 bytes. If the offset field contains the following value:

1111111111110100

目标地址是什么?解释你的答案.

what is the target address? Explain your answer.

这个问题的答案是:494?我的理由是十进制的偏移字段是 -10 但我不确定:(此时pc的地址为500+4所以:

Is the answer to this question : 494? My reasoning is that the offset field in decimal is -10 but i am not sure about it :( and the address of pc at this point is 500+4 so:

target address = pc address + (offset)= 504+(-10) = 494.

我想知道我的做法是否正确.

I wanted to know if i am doing it correct or not.

谢谢

推荐答案

你是对的,除了 11111111111110100 不是十进制的 -10,而是 -12.因此,目标地址为 504-12 = 492.

You are correct, except that 1111111111110100 is not -10 in decimal, it's -12. Thus, the target address is 504-12 = 492.

这篇关于计算mips汇编控制指令的目标地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆