riscv-bitmanip
riscv-bitmanip copied to clipboard
On Ternary Instructions
There are several Ternary instructions in Bitmanip. While compared to other Integer extensions, I consider it to be a big modification, for it takes an extra register file read port or extra clock cycle to read the third operand. This may implies big hardware differences between with and without B-ext.
- I would propose:
- Remain ternary instructions but with one operand being immediate. That is: fsri and fsriw.
- Initiate a new extension, true ternary extension, including cmix, cmov, fsl, fsr, and other general ternary operations, such as madd, msub, a&b | c, a&b ^ c, a+b+c, a&b&c, a|b|c, a^b^c, (a+b)>>c, (a+b)^c.
- Benifits of this solution:
- Most of b-ext instructions and all integar instructions are binary/unary operations, only four ternary instructions in b-ext introduce a significant hardware change and cost.
- Ternary operations are a huge instruction design space and maybe deserve a special extension.
- Ternary operations consume instruction coding space much, one OP7 space only leaves 32 instructions bit(26,25), bit(14,12). Can ternary operations occupy a dedicate OP7?