我将如何在C语言中编码此特定MIPS运算符?

时间:2019-05-14 23:27:17

标签: c

我正在使用C创建一个MIPS仿真器,并且正在尝试为BEQ和BNE创建方法,但是这些操作使我感到困惑。下面是在MIPS中执行的操作,然后是我对它们的解释方式,这显然是错误的。

BEQ if(rs == rt)pc + = offset * 4

//beq
            else if(opCodeType == 4)
            {
                if(registers[rsVariable] = registers[rtVariable])
                {
                    pc = pc + offset*4;
                }
            } 

BNE if(rs!= rt)pc + = offset * 4

//bne 
            else if(opCodeType == 5)
            {
                if(registers[rsVariable] != registers[rtVariable])
                {
                    pc = pc + offset*4;
                }
            } 

非常感谢所有帮助,因为这是难题的最后一部分!

0 个答案:

没有答案