I am not sure if my answers are correct A) I feel that the oppcode 0000 (BR)is an NOP because nothing changes (I think) complete line is 0000 000 000001100
B) fails as a NOP because the opcode 1110 (LEA) sets the condition code. 1110 000 000000000
Am I correct? enter image description here
You are correct: the first one is a branch instruction,
BR, with no conditions selected — meaning it will never branch. Any offset (PCoffset9) can be used and will still result in a no-operation (NOP) instruction. You can have 0000 000x xxxx xxxx and they will all be no-operation.The second one is an
LEAinstruction, and while you are correct that lea sets the condition codes (for some unknown reason1), however, you missed that the lea also sets a CPU register, in this case,R0— and each of these two reasons means it cannot be used as a no-operation.1
LEAloads an address given a PCoffset9. It computes PCoffset9 + PC and loads that into the designated destination register,DR. I can't think of how this might be useful to a programmer to set the condition codes based on the address computed as negative, positive, and zero. Addresses are unsigned and so never negative, so that being set would only mean differentiating high addresses from low addresses; while zero would typically be interpreted as null, lea does not load a pointer from memory but rather from a pc-relative computation. You would have trouble computing null with a simple lea instruction alone. The only thing that I can think of is that it is grouped into the "load" set and all the other loads do set the condition codes (but the other ones have meaningful usages).BR,ST,STIalso uses a PCoffset9 but don't set the condition codes, which counters the argument that setting the condition codes for lea is easier for the hardware to do and would cost more hardware to avoid.