The or instruction takes the 32-bit data value in register source1 and performs a logical-or operation
between it and the 32-bit value in register source2 , then puts the result in register destination register.
The operation iscarried out between corresponding bits of the two operands. The ori instruction is similar, except that the second operand is the 16-bit unsigned immediate value Kuns, zero-extended to 32 bits.
Source 1 and Source 2 =Destination register
Example:
r1=Source1
r2=Source2
r3=Source3
r1 | r2 | r3 |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Example to make last 4 digits to 1 and leave the remaining to original values
r1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
r2 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
r3 | 1 | 1 | 0 | 0 | 1 | 1 | 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 followed from source and last 4 digits set to 1
DLX And and ORI Instrunction
or r3,r1,r2
if r1 or r2 or equal to 1 then 1 else 0
ori r3,r1,1
r3 will be 1
ori r3,r1,0
r3 =r1
r3=first 4 digits are followed from source and last 4 digits set to 1
DLX And and ORI Instrunction
or r3,r1,r2
if r1 or r2 or equal to 1 then 1 else 0
ori r3,r1,1
r3 will be 1
ori r3,r1,0
r3 =r1
Tags:OR instruction, OR-immediate instructions,DLX or instruction, DLX ORI instruction
0 comments:
Post a Comment