最低有效位mips [英] Least significant bit mips

查看:74
本文介绍了最低有效位mips的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Mips 中更改寄存器中的最低有效位?
在另一篇文章如何在 MIPS 中获得 LSB 位?,它看到了如何得到它,但我想改变它.

How can i change least significant bit in a register in Mips?
In another post How to get LSB bit in MIPS? it saws how to get it but i want to change it.

推荐答案

下面一行应该做:

xori $t0, $s0, 1

解释:$s0 中的内容包含 0 和 1,而立即数在 LSB 中包含 0 和 1.当 LSB 为 0 时,与 1 异或输出 1.每当为 1 时,与 1 异或输出 0.其余位如果为 1,则输出 1,如果为 0,则输出 0,因为它们与 0 异或,从而保持它们的状态.

Explained: the contents in $s0 contains zeros and ones, while the immediate value has zeros and a one in the LSB. Whenever the LSB is 0, it is xored with 1 and outputs a 1. Whenever it is 1, it is xored with 1 and outputs a 0. The remaining bits will output a 1 if they are 1 and a 0 if they are 0 because they are being xored with 0, thus preserving their state.

这篇关于最低有效位mips的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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