X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=simple_v_extension%2Fsv_prefix_proposal.rst;h=8260fee9e3630bbe5758c6fad7066a0ee960c24c;hb=bbf4595b10f52632907dcb6a9a168e6c240c0d36;hp=20b90744b92b6386d12f0ce54088a417f225cc52;hpb=5440d07584e64bdd5f42d408c35df3e224bab946;p=libreriscv.git diff --git a/simple_v_extension/sv_prefix_proposal.rst b/simple_v_extension/sv_prefix_proposal.rst index 20b90744b..8260fee9e 100644 --- a/simple_v_extension/sv_prefix_proposal.rst +++ b/simple_v_extension/sv_prefix_proposal.rst @@ -1,3 +1,5 @@ +[[!tag standards]] + SimpleV Prefix (SVprefix) Proposal v0.3 ======================================= @@ -12,6 +14,7 @@ into 32, 48 and 64 bit RV formats, to provide Vectorisation context on a per-instruction basis. .. _Specification: http://libre-riscv.org/simple_v_extension/specification/ +.. _Appendix: http://libre-riscv.org/simple_v_extension/appendix/ .. contents:: @@ -215,7 +218,10 @@ prefix as well. VLtyp encodes how (whether) to set SVPSTATE.VL and SVPSTATE.MAX VLtyp field encoding ==================== -NOTE: VL and MVL below are local to SVPregix and, if non-default, are tracked through SVPSTATE, not the main Specification_ STATE. If default (all zeros) then STATE VL and MVL apply to this instruction. +NOTE: VL and MVL below are local to SVPrefix and, if non-default, +will update the src and dest element offsets in SVPSTATE, not the main +Specification_ STATE. If default (all zeros) then STATE VL and MVL apply +to this instruction, and STATE.srcoffs (etc) will be used. +-----------+-------------+--------------+----------+----------------------+ | VLtyp[11] | VLtyp[10:6] | VLtyp[5:1] | VLtyp[0] | comment | @@ -229,7 +235,9 @@ NOTE: VL and MVL below are local to SVPregix and, if non-default, are tracked th | 1 | VLdest | MVL-immed | 1 | MVL immed mode | +-----------+-------------+--------------+----------+----------------------+ -Note: when VLtyp is all zeros, the main Specification_ VL and MVL apply to this instruction. If called outside of a VBLOCK or if sv.setvl has not set VL, the operation is "scalar". +Note: when VLtyp is all zeros, the main Specification_ VL and MVL apply +to this instruction. If called outside of a VBLOCK or if sv.setvl has +not set VL, the operation is "scalar". Just as in the VBLOCK format, when bit 11 of VLtyp is zero: @@ -258,8 +266,38 @@ Note that VLtyp's VL and MVL are not the same as the main Specification_ VL or MVL, and that loops will alter srcoffs and destoffs in SVPSTATE in VLtype nondefault mode, but the srcoffs and destoffs in STATE, if VLtype=0. Furthermore, the execution order and exception handling must be exactly -the same as in the main spec -(Program Order must be preserved) +the same as in the main spec (Program Order must be preserved) + +Pseudocode for SVPSTATE.VL: + +.. parsed-literal:: + + # pseudocode + + regs = [0u64; 128]; + vl = 0; + + // instruction fields: + rd = get_rd_field(); + vlmax = get_immed_field(); + + // handle illegal instruction decoding + if vlmax > XLEN { + trap() + } + + // calculate VL + if rs1 == 0 { // rs1 is x0 + vl = vlmax + } else { + vl = min(regs[rs1], vlmax) + } + + // write rd + if rd != 0 { + // rd is not x0 + regs[rd] = vl + } vs#/vd Fields' Encoding ======================= @@ -399,6 +437,13 @@ Predication (pred) Field Encoding Twin-predication (tpred) Field Encoding ======================================= +Twin-predication (ability to associate two predicate registers with an +instruction) applies to MV, FCLASS, LD and ST. The same format also +applies to integer-branch-compare operations although it is **not** to be +considered "twin" predication. In the case of integer-branch-compare +operations, the second register (if enabled) stores the results of the +element comparisons. See Appendix_ for details. + +-------+------------+--------------------+----------------------------------------------+ | tpred | Mnemonic | Predicate Register | Meaning | +=======+============+====================+==============================================+