between it and the 32-bit value in register source2, then puts the result in register destination register. The and operation is carried out between corresponding bits of the two operands.
Source 1 and Source 2 =Destination register
Example:
r1=Source1
r2=Source2
r3=Source3
r1 | r2 | r3 |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
And instruction can be used for masking to allow only certain bits
Example
If we are interested in last 4 digits of r1 register then create marking like below
r1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
r2 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
r3 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
r2=We are interested in last 4 bits so we make last 4 digits to one and rest of them to zero
r3=first 4 digits are zero and last 4 digits followed r1 last 4 digits
DLX And and ANDI Instrunction
and r3,r1,r2
if r1 and r2 or equal then r3 will be 1 else r3 will be 0
andi r3,r1,1
if r1 is 1 then r3 will be 1 else r3 will be 0
Tags:And instruction, And-immediate instructions,DLX and instruction, DLX Andi instruction
0 comments:
Post a Comment