riscv-bitmanip icon indicating copy to clipboard operation
riscv-bitmanip copied to clipboard

On Ternary Instructions

Open davidmlw opened this issue 4 years ago • 0 comments

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:
  1. Remain ternary instructions but with one operand being immediate. That is: fsri and fsriw.
  2. 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:
  1. 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.
  2. Ternary operations are a huge instruction design space and maybe deserve a special extension.
  3. 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?

davidmlw avatar Jun 30 '20 02:06 davidmlw