在大会增加两个64位的数 [英] Adding two 64 bit numbers in Assembly

查看:119
本文介绍了在大会增加两个64位的数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用的SPIM模拟器和IM停留在这个问题学习MIPS。

So I am learning MIPS using the SPIM simulator and im stuck on this problem.

我要添加它们存储在4个32位寄存器两个64位数字。所以我添加了LO字节,然后进和HI字节。但没有ADC / ADDC指令,即进位加。

I want to add two 64 bit numbers which are stored in four 32 bit registers. So I add the LO bytes and then the carry and the HI bytes. But there is no adc/addc command i.e. add with carry.

所以,我要补充进位在状态寄存器。但是,究竟如何我读这登记?

So I would have to add the carry bit in the status register. But, how exactly do I read this register?

如果$ t0为临时寄存器1,那么什么是保持进位标志状态寄存器的相同呢?

If $t0 is temporary register 1, then what is the equivalent of the status register which holds the carry flag?

我用Google搜索了很多我仍然无法找到,即使使用状态寄存器的例子。

I have googled a lot I still can't find any examples that even use the status register.

推荐答案

添加$ T2 T3 $ + $ T4 T5 $,导致$ T0 $ T1

Add $t2 $t3 + $t4 $t5, result in $t0 $t1

addu  $t1, $t3, $t5    # add least significant word
sltu  $t0, $t1, $t5    # set carry-in bit 
addu  $t0, $t0, $t2    # add in first most significant word
addu  $t0, $t0, $t4    # add in second most significant word

有关你问题的第二部分,不存在状态寄存器。一个都没有。纳达。

For the second part of your question, there is no status register. None at all. Nada.

这篇关于在大会增加两个64位的数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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