From: Luke Kenneth Casson Leighton Date: Tue, 12 Jun 2018 11:56:57 +0000 (+0100) Subject: add mv etc. X-Git-Tag: convert-csv-opcode-to-binary~5224 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e42745c78789d0153ca7a254dac43fb90ae071c7;p=libreriscv.git add mv etc. --- diff --git a/simple_v_extension.mdwn b/simple_v_extension.mdwn index 22a8c3fa4..bd99c92cc 100644 --- a/simple_v_extension.mdwn +++ b/simple_v_extension.mdwn @@ -945,6 +945,115 @@ of detecting early page / segmentation faults and adjusting the TLB in advance, accordingly: other strategies are explored in the Appendix Section "Virtual Memory Page Faults". +## Vectorised Copy/Move instructions + +There is a series of 2-operand instructions involving copying (and +alteration): C.MV, FMV, FNEG, FABS, FCVT, FSGNJ. These operations all +follow the same pattern, as it is *both* the source *and* destination +predication masks that are taken into account. This is different from +the three-operand arithmetic instructions, where the predication mask +is taken from the *destination* register, and applied uniformly to the +elements of the source register(s), element-for-element. + +### C.MV Instruction + +There is no MV instruction in RV however there is a C.MV instruction. +It is used for copying integer-to-integer registers (vectorised FMV +is used for copying floating-point). + +If either the source or the destination register are marked as vectors +C.MV is reinterpreted to be a vectorised (multi-register) predicated +move operation. The actual instruction's format does not change: + +[[!table data=""" +15 12 | 11 7 | 6 2 | 1 0 | +funct4 | rd | rs | op | +4 | 5 | 5 | 2 | +C.MV | dest | src | C0 | +"""]] + +A simplified version of the pseudocode for this operation is as follows: + + function op_mv(rd, rs) # MV not VMV! +  rd = int_vec[rd].isvector ? int_vec[rd].regidx : rd; +  rs = int_vec[rs].isvector ? int_vec[rs].regidx : rs; +  ps = get_pred_val(FALSE, rs); # predication on src +  pd = get_pred_val(FALSE, rd); # ... AND on dest +  for (int i = 0, int j = 0; i < VL && j < VL;): + if (int_vec[rs].isvec) while (!(ps & 1< What does an ADD of two different-sized vectors do in simple-V? diff --git a/simple_v_extension/simple_v_chennai_2018.tex b/simple_v_extension/simple_v_chennai_2018.tex index 315d0b6b8..a83740bb3 100644 --- a/simple_v_extension/simple_v_chennai_2018.tex +++ b/simple_v_extension/simple_v_chennai_2018.tex @@ -556,7 +556,7 @@ function op\_add(rd, rs1, rs2) # add not VADD! Notes: \begin{itemize} \item Surprisingly powerful! Zero-predication even more so - \item Same arrangement for FVCT, FMV, FSGNJ etc. + \item Same arrangement for FCVT, FMV, FSGNJ etc. \end{itemize} }