Encoding:

ANDI16

001011

rd

rs

Encoded

Immediate

6

3

3

4

Format:

ANDI16 rd, rs, decoded_immediate_value

microMIPS

And Immediate (16-bit instr size)

Purpose:

And Immediate (16-bit instr size)

To do a bitwise logical AND with a constant

Description:

GPR[rd] = GPR[rs] AND zero_extend(decoded immediate)

The encoded immediate field is decoded to obtain the actual immediate value

The decoded immediate is zero-extended to the left and combined with the contents of GPR rs in a bitwise logical

AND operation. The result is placed into GPR rd.

Table 5-2 Encoded and Decoded Values of Immediate Field

Encoded Value of

Instr3..0 (Decimal)

Encoded Value of

Instr3..0 (Hex)

Decoded Value of

Immediate (Decimal)

Decoded Value of

Immediate (Hex)

0

0x0

128

0x80

1

0x1

1

0x1

2

0x2

2

0x2

3

0x3

3

0x3

4

0x4

4

0x4

5

0x5

7

0x7

6

0x6

8

0x8

7

0x7

15

0xf

8

0x8

16

0x10

9

0x9

31

0x1f

10

0xa

32

0x20

11

0xb

63

0x3f

12

0xc

64

0x40

13

0xd

255

0xff

14

0xe

32768

0x8000

15

0xf

65535

0xffff

Restrictions:

The 3-bit register fields can only specify GPRs $2-$7, $16, $17.

Operation:

GPR[rd] = GPR[rs] and zero_extend(decoded immediate)

Exceptions:

None