Consider this C
code:
int A,B,C,D; //no ASM equivalent bc A = r8, B = r9, C = r10, D = r11
A = 1;
B = 8;
C = A+B;
D = B-A;
Translate into Nios II Assembly:
movi r8,1
movi r9, 8
add r10, r8, r9
sub r11, r9, r8
iloop: br iloop
i
):
andi r1, r2, 0xF
- Perform bitwise AND between the contents of r2
and the immediate value 0xF
, store the result in r1
.ori r1, r2, 0xFF
- Perform bitwise OR between the contents of r2
and the immediate value 0xFF
, store the result in r1
.and r1, r2, r3
- Perform bitwise AND between the contents of r2
and r3
, store the result in r1
.or r1, r2, r3
- Perform bitwise OR between the contents of r2
and r3
, store the result in r1
.Each byte has its own address