Multiple choice

Consider a new instruction named branch-on-bit-set (mnemonic bbs). The instruction “bbs reg, pos, label” jumps to label if bit in position pos of register operand reg is one. A register is 32 bits wide and the bits are numbered 0 to 31, bit in position 0 being the least significant. Consider the following emulation of this instruction on a processor that does not have bbs implemented. temp$\leftarrow$reg & mask Branch to label if temp is non-zero. The variable temp is a temporary register. For correct emulation, the variable mask must be generated by

  1. mask $\leftarrow$ 0 ×l << pos
  2. musk $\leftarrow$ 0 × ffffffff >> pos
  3. mask $\leftarrow$pos
  4. masdk $\leftarrow$0×f
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation