0

I wonder if anyone knows if beq looks only at a specific bit (LSB) when branching to lable or does it look at the value of the entire register?

I am trying to implement multiplication routine register t1 has 5(0x0000 0101) i am loading only a byte. this instruction: beq $t1,1, label -does not work for some reason.

when I go through the code step by step (i am using xspim -bare mode) it goes through the instruction and then just go to the next line of code when it should be skipping it because the lsb of $t1 is 1

Thanks !

gps
  • 61
  • 1
  • 2
  • 4
  • I suggest that you download _MIPS32™ Architecture For Programmers Volume II: The MIPS32™ Instruction Set_. For `BEQ` is says _"If the contents of GPR rs and GPR rt are equal, branch to the effective target address after the instruction in the delay slot is executed."_, so all bits are compared (the part about delay slots is not relevant if you're using SPIM). Note that `beq $t1,1, label` is a pseudo-instruction, i.e. there's no such form of `BEQ` in the actual MIPS32 instruction set. – Michael Oct 19 '15 at 11:48
  • first, thank you! Second, beq is not a pseudo instruction may be you mean the way I have typed it to compare register with constant instead of another register. Or may be you mean that instead of 'label' I should have the address. But according to the textbook I am using :beq rs,rt,label is not pseudo (the book is "Computer organization and design " 5th edition Dabvid Paterson and John Hennesy. ) – gps Oct 19 '15 at 17:09
  • `beq rs, rt, label` is an actual MIPS32 instruction (well, in the instruction word, the address of `label` would be encoded as a PC-relative offset, but let's ignore that detail). `beq rs, imm, label` is a pseudo-instruction. Depending on the value of `imm` it will be converted by the assembler into 1-3 actual instructions. – Michael Oct 19 '15 at 17:19

0 Answers0