OP instruction of nedoRISC Core:
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | REG0 | REG1 | REG2 | OPHI | OPLO |
It is arithmetic or logic operation with higher and lower bytes of two registers with storing result in destination register.
REG0 is destination register, REG1 is register for 1st argument, REG2 is register (or 4-bit data for ADI?/SBI?) for 2nd argument, OPHI and OPLO are operations over higher and lower bytes respectively:
- 0000 (0) - MOV1? (move byte from register 1 to destination register);
- 0001 (1) - MOV2? (move byte from register 2 to destination register);
- 0010 (2) - INV1? (move inverted byte from register 1 to destination register);
- 0011 (3) - INV2? (move inverted byte from register 2 to destination register);
- 0100 (4) - RRC1? (rotate byte of register 1 to the right through flags C?/H? and put result to destination register);
- 0101 (5) - RRC2? (rotate byte of register 2 to the right through flags C?/H? and put result to destination register);
- 0110 (6) - RLC1? (rotate byte of register 1 to the left through flags C?/H? and put result to destination register);
- 0111 (7) - RLC2? (rotate byte of register 2 to the left through flags C?/H? and put result to destination register);
- 1000 (8) - NAND? (bitwise NOT-AND of bytes from argument registers and put result to destination register);
- 1001 (9) - XOR? (bitwise EXCLUSIVE-OR of bytes from argument registers and put result to destination register);
- 1010 (A) - AND? (bitwise AND of bytes from argument registers and put result to destination register);
- 1011 (B) - OR? (bitwise OR of bytes from argument registers and put result to destination register);
- 1100 (C) - ADI? (add byte from registers 1 and 4-bit data 1..16 located in place of register 2 and put result to destination regiter and flags C?/H?);
- 1101 (D) - SBI? (subtruct 4-bit data 1..16 located in place of register 2 from byte of register 1 and put result to destination register and flags C?/H?);
- 1110 (E) - ADC? (add bytes from argument registers with flags C?/H? and put result to destination regiter and flags C?/H?);
- 1111 (F) - SBC? (subtruct byte of register 2 from byte of register 1 with flags C?/H? and put result to destination register and flags C?/H?).
If OPHI and OPLO are the same then operation is happening with 16-bit arguments and if not then as 2 separate operations with bytes. It's better to assume that bytes are processed from lower to higher (except when both operations are rotate to right RRC1? or RRC2? then it's higher to lower).