MIPS 汇编中的 nand 位运算
我一直试图弄清楚如何在汇编中进行 nand 按位运算,但没有成功。我试图编写一个逻辑门模拟器,它本质上会为输入 A 和 B 生成这个真值表,
A | B || F ----------------- lo | lo || hi lo | hi || hi hi | lo || hi hi | hi || lo
我已经尝试了一切。
and $t3,$t1,$t not $t4,$t3
无法产生正确的输出
I've been trying to figure out how to do a nand bitwise operation in assembly but have been unsuccessful. I'm tried to write a logic gate simulator that will essentially produce this truth table for inputs A and B
A | B || F ----------------- lo | lo || hi lo | hi || hi hi | lo || hi hi | hi || lo
I've tried everything.
and $t3,$t1,$t not $t4,$t3
Does not produce the correct output
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然是这样,看看真值表:
如您所见,您可以通过否定先前的与值来获得 nand 值。但您可能忘记了
and
和not
对寄存器的每一位进行操作。我认为您对布尔值感到困惑,其中(通常)任何非零值都被假定为真。因此,因为
下次您也应该发布预期结果和实际结果,这样我们就更容易理解出了什么问题。
OF course it does, look at the truth table:
As you can see, you can get nand values by negating previously anded values. But you may have forgotten that
and
andnot
operate on each bit of the registers. I think you confused with boolean values, where (usually) any non-zero value is assumed to be true. Therefore,because
Next time you should post both expected and actual results too, this way it is easier for us to understand what went wrong.