Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bitmanip] Add ZBT Instruction Group
This commits implements the Bit Manipulateion Extension ZBT instruction group: cmix, cmov, fsr[i] and fsl. Those are instructions depend on three ALU operands. Completeion of these instructions takes 2 clock cycles. Additionally, the rotation shifts rol and ror are made multicycle instructions. All multicycle instructions take exactly two cycles to complete. Architectural additions: * Multicycle Stage Register in ID stage. multicycle_op_stage_reg * Decoder generates alu_multicycle signal, to stall pipeline * For all ternary instructions: 1. cycle: connect alu operands a and b to rs1 and rs2 respectively 2. cycle: connect operands a and be to rs3 and rs2 respectively * Reduce the physical size of the shifter from 64 bit to 63 bit: 32-bit operand + 1 bit for arithmetic / one-shift * Make rotation shifts multicycle instructions. Instruction Details: * cmov: 1. store operand a (rs1) in stage reg. 2. return stage reg output (rs2) or rs3. if rs2 != 0 the output (rs1) is already known in the first cycle. -> variable latency implementation is possible. * cmix: 1. store rs1 & rs2 in stage reg 2. return stage_reg_q | (rs2 & ~rs3) reusing bwlogic from zbb * rol/ror: (here: ror) shift_amt = rs2 & 31; shift_amt_compl = (32 - shift_amt) & 31 1. store (rs1 >> shift_amt) in stage reg 2. return (rs1 << shift_amt_compl) | stage_reg_q * fsl/fsr: For funnel shifts, the order of applying the shift amount or its complement is determined by bit [5] of shift_amt. Pseudocode for fsr: shift_amt = rs2 & 63 shift_amt_compl = (32 - shift_amt[4:0]) 1. if (shift_amt >= 33): store (rs1 >> shift_amt_compl[4:0]) in stage reg else if (shift_amt <0 && shift_amt <= 31): store (rs1 << shift_amt[4:0]) in stage reg else if (shift_amt == 32 || shift_amt == 0): store rs1 in stage reg 2. if (shift_amt >= 33): return stage_reg_q | (rs3 << shift_amt[4:0]) else if (shift_amt <0 && shift_amt <= 31): return stage_reg_q | (rs3 >> shift_amt_compl[4:0]) else if (shift_amt == 32): return rs3 else if (shift_amt == 0): return rs1 Signed-off-by: ganoam <[email protected]>
- Loading branch information