The RISC Architecture - Revision 2018 [Niklaus Wirth] (2010)
The RISC Architecture - Revision 2018 [Niklaus Wirth] (2010)
2018
F0 00u0 a b op c
16
F1 01uv a b op im
0 MOV a, n R.a := n
1 LSL a, b, n R.a := R.b ← n (shift left by n bits)
2 ASR a, b, n R.a := R.b n (shift right by n bits with sign extension)
3 ROR a, b, n R.a := R.b rot n (rotate right by n bits)
4 AND a, b, n R.a := R.b & n logical operations
5 ANN a, b, n R.a := R.b & ~n
6 IOR a, b, n R.a := R.b or n
7 XOR a, b, n R.a := R.b xor n
8 ADD a, b, n R.a := R.b + n integer arithmetic
9 SUB a, b, n R.a := R.b – n
10 MUL a, b, n R.a := R.a х n
11 DIV a, b, n R.a := R.b div n
12 FAD a, b, c R.a := R.b + R.c floating-point arithmetic
13 FSB a, b, c R.a := R.b – R.c
14 FML a, b, c R.a := R.a х R.c
15 FDV a, b, c R.a := R.b / R.c
Immediate values are extended to 32 bits with 16 v-bits to the left. Apart from R.a these instructions also
affect the flag registers N (negative) and Z (zero). The ADD and SUB instructions also set the flags C (carry,
borrow) and V (overflow).
4 4 4 20
F2 10uv a b off
Bcond dest
If u = 0, the destination address is taken from register R.c. If u = 1, it is PC+1 + offset. If v = 1, the link
address PC+1 is deposited in register R15.
code cond condition code cond condition
0000 MI negative (minus) N 1000 PL positive (plus) ~N
0001 EQ equal (zero) Z 1001 NE positive (plus) ~Z
0010 CS carry set (lower) C 1010 CC carry clear ~C
0011 VS overflow set V 1011 VC overflow clear ~V
0100 LS lower or same ~C|Z 1100 HI higher ~(~C}Z)
0101 LT less than NV 1101 GE greater or equal ~(NV)
0110 LE less or equal (NV)|Z 1110 GT greater than ~((NV)|Z)
0111 always true 1111 never false
4. Special features
Modifier bit u = 1 changes the effect of certain instructions as follows:
ADD', SUB' add, subtract also carry C
MUL' unsigned multiplication
MOV' form 0, v = 0: R.a := H
MOV' form 0, v = 1: R.a := [N, Z, C, V]
MOV' form 1 R.a := [imm 16'b0] (imm left shifted 16 bits)
The MUL instruction deposits the high 32 bits of the product in the auxiliary register H. The DIV instruction
deposits the remainder in H.
5. Interrupts
The addition of an interrupt facility required the addition of two new instruction, as well as the status register
intenb (interrupt enable). The instructions are
RTI 1100 0111 xxxx xxxx xxxx xxxx 0001 Rn return from interrupt
STI/CLI 1100 1111 xxxx xxxx xxxx xxxx 0010 000e set / clear interrupt, intenb := e