The RISC-V Instruction Set Manual introduces that the conditional branches were designed to include arithmetic comparison operations between two registers, rather than use condition codes.Are there any possible adding condition codes in the future?
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/54735f86-5cc5-4086-844e-85718451878bn%40groups.riscv.org.
It is possible to do many things using custom instructions which is part of the value of the architecture, being able to adapt to particular circumstances. But I do not see condition codes being adopted on a large scale. Are these condition code beyond the norm? If they are I/O state they could be reached with load / store instructions to a dedicated address.
What I have wondered is if it is possible to incorporate more arithmetic / logic operations in branch instructions. A couple I have used is branch-and, and branch-or in addition to the relational operations to take care of cases like “if (a && b)” or “if (a || b)” and absorb them into a single instruction. This does require branch-nand and branch-nor as the if conditions are inverted. I also miss branch-on-bit-set / clear instructions.
What I have wondered is if it is possible to incorporate more arithmetic / logic operations in branch instructions. A couple I have used is branch-and, and branch-or in addition to the relational operations to take care of cases like “if (a && b)” or “if (a || b)” and absorb them into a single instruction. This does require branch-nand and branch-nor as the if conditions are inverted. I also miss branch-on-bit-set / clear instructions.
Given the two inputs and the result it is possible to compute what the carry is. One instruction I have added in the past is to compute the carry for an add or substract (GAC generate add carry). It can then be added in the next instruction using a three input add instruction. So, it saves an instruction over the 3*ADD + 1 SLTU, requiring 2*Add (1 3 input though) and a GAC. But the architecture must have support for 3R operations.
That is a very cool idea, and no worries about patents too. I am a little confused as to the use of R16 in the examples though. Is it an intermediary register for each following instruction? Is it effectively as if there were an extra target register R16 and extra operand register R16 for each following instruction?
Are the instructions effectively like:
ADD R16,R12,R4,R8 // carry Out only
ADD R16,R13,R5,R9,R16 // Carry In and Out
ADD R16,R14,R6,R10,R16 // Carry In and Out
ADD R15,R7,R11,R16 // Carry In only
Or am I missing something?
This seems to require two register write ports.
It looks like the same thing could be accomplished with an intermediate pipeline register, so that two write ports on the register file are not needed.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/6946e3ed-8b79-403d-8e49-57b6583a3327n%40groups.riscv.org.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CABfYdSqKPzJgZmHZjeJsM%2B5bM4hJeQRw9h%2BeLgBJ%3DoXEMjQmjQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAF4tt%3DD92NK6%3D97ZefcDurY13w1-nyuO_v2AHxNQr3LePphXwg%40mail.gmail.com.
" Perhaps one implementation technique is to widen the registers by one bit."
How does this solve the multiply, divide, shift problems which are not a single bit ?
Perhaps one implementation technique is to widen the registers by one bit. So, in effect, each GPR has its own carry bit. So, on an RV32 implementation, all X registers are secretly 33 bits wide, even though you're only given architectural access to 32 of them. A CSR would reflect the carry bits of all the GPRs, allowing them to be saved and restored during context switches.