go to previous page   go to home page   go to next page hear noise highlighting

Answer:

An assembler.

An assembler uses bit manipulation to put together (to "assemble") the bit patterns of each machine instruction. This is a typical assignment in a systems programming course. Of course, you will likely write your assembler in C and will use its bitwise operators. But they ultimately become the processor's bitwise operations.


Handy ANDI Instruction

andi d,s,const     # register d loaded with
                   # bitwise AND of zero-extended immediate operand const
                   # and the contents of register $s.
                   # const is a 16-bit pattern, so
                   # 0x0000 ... const ... 0xFFFF

The andi instruction does a bitwise AND of two 32-bit patterns. At run time the 16-bit immediate operand is padded on the left with zero bits to make it a 32-bit operand.

The three operands of the instruction must appear in the correct order, and const must be within the specified range. The immediate operand in the source instruction always specifies sixteen bits although the zeros on the left can be omitted (such as 0x2).

AND Operation on Bits
first operand 0011
second operand 0101

result 0001

QUESTION 11:

Is the following instruction correct? What does it do?

andi $8,$0,0xFFFF

go to previous page   go to home page   go to next page