Home » Computer Organization and Architecture » Computer organization and architecture miscellaneous » Question

Computer organization and architecture miscellaneous

Computer Organization and Architecture

  1. 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 bit wide and the bits are numbered 0 to 32, bit in position 0 being the least significant. Consider the following emulation of this instruction on a processor that does not have bbs implemented. tem ← reg and mask Branch to lable if temp is non-zero The variable temp is a temporary register. For correct emulation, the variable mask must be generated by
    1. mask ← 0 × 1 << pos
    2. mask ← 0 × ffffffff << pos
    3. mask ← pos
    4. mask ← 0 × f
Correct Option: A

From the given conditions it can be determined that we have to set all the other bits to 0 in temp, as the position pos is the only deciding factor in jumping to the label. If the left shift over 1 is done by the pos number then the mask register can have 1 in pos place, which is required. Thus, is the option mask ← 0 × 1 << pos is correct.



Your comments will be displayed only after manual approval.