From: Luke Kenneth Casson Leighton Date: Sun, 17 Jan 2021 21:29:30 +0000 (+0000) Subject: whitespace X-Git-Tag: convert-csv-opcode-to-binary~426 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f52e2206c387376c5bead8a458f65a04761fd0e5;p=libreriscv.git whitespace --- diff --git a/openpower/sv/svp64/appendix.mdwn b/openpower/sv/svp64/appendix.mdwn index c97688080..7878b7523 100644 --- a/openpower/sv/svp64/appendix.mdwn +++ b/openpower/sv/svp64/appendix.mdwn @@ -4,7 +4,8 @@ * This is the appendix to [[sv/svp64]], providing explanations of modes -etc. leaving the main svp64 page's primary purpose as outlining the instruction format. +etc. leaving the main svp64 page's primary purpose as outlining the +instruction format. Table of contents: @@ -18,28 +19,61 @@ independent. XER SO and other global "accumulation" flags (CR.OV) cause Read-Write Hazards on single-bit global resources, having a significant detrimental effect. -Consequently in SV, XER.SO and CR.OV behaviour is disregarded (including in `cmp` instructions). XER is -simply neither read nor written. This includes when `scalar identity behaviour` occurs. If precise OpenPOWER v3.0/1 scalar behaviour is desired then OpenPOWER v3.0/1 instructions should be used without an SV Prefix. +Consequently in SV, XER.SO and CR.OV behaviour is disregarded (including +in `cmp` instructions). XER is simply neither read nor written. +This includes when `scalar identity behaviour` occurs. If precise +OpenPOWER v3.0/1 scalar behaviour is desired then OpenPOWER v3.0/1 +instructions should be used without an SV Prefix. -An interesting side-effect of this decision is that the OE flag is now free for other uses when SV Prefixing is used. +An interesting side-effect of this decision is that the OE flag is now +free for other uses when SV Prefixing is used. -Regarding XER.CA: this does not fit either: it was designed for a scalar ISA. Instead, both carry-in and carry-out go into the CR.so bit of a given Vector element. This provides a means to perform large parallel batches of Vectorised carry-capable additions. crweird instructions can be used to transfer the CRs in and out of an integer, where bitmanipulation may be performed to analyse the carry bits (including carry lookahead propagation) before continuing with further parallel additions. +Regarding XER.CA: this does not fit either: it was designed for a scalar +ISA. Instead, both carry-in and carry-out go into the CR.so bit of a given +Vector element. This provides a means to perform large parallel batches +of Vectorised carry-capable additions. crweird instructions can be used +to transfer the CRs in and out of an integer, where bitmanipulation +may be performed to analyse the carry bits (including carry lookahead +propagation) before continuing with further parallel additions. # v3.0B/v3.1B relevant instructions -SV is primarily designed for use as an efficient hybrid 3D GPU / VPU / CPU ISA. - -As mentioned above, OE=1 is not applicable in SV, freeing this bit for alternative uses. Additionally, Vectorisation of the VSX SIMD system likewise makes no sense whatsoever. SV *replaces* VSX and provides, at the very minimum, predication (which VSX was designed without). Thus all VSX Major Opcodes - all of them - are "unused" and must raise illegal instruction exceptions in SV Prefix Mode. - -Likewise, `lq` (Load Quad), and Load/Store Multiple make no sense to have because they are not only provided by SV, the SV alternatives may be predicated as well, making them far better suited to use in function calls and context-switching. - -Additionally, some v3.0/1 instructions simply make no sense at all in a Vector context: `twi` and `tdi` fall into this category, as do branch operations as well as `sc` and `scv`. Here there is simply no point trying to Vectorise them: the standard OpenPOWER v3.0/1 instructions should be called instead. - -Fortuitously this leaves several Major Opcodes free for use by SV to fit alternative future instructions. In a 3D context this means Vector Product, Vector Normalise, [[sv/mv.swizzle]], Texture LD/ST operations, and others critical to an efficient, effective 3D GPU and VPU ISA. With such instructions being included as standard in other commercially-successful GPU ISAs it is likewise critical that a 3D GPU/VPU based on svp64 also have such instructions. - -Note however that svp64 is stand-alone and is in no way critically dependent on the existence or provision of 3D GPU or VPU instructions. These should be considered extensions, and their discussion and specification is out of scope for this document. - -Note, again: this is *only* under svp64 prefixing. Standard v3.0B / v3.1B is *not* altered by svp64 in any way. +SV is primarily designed for use as an efficient hybrid 3D GPU / VPU / +CPU ISA. + +As mentioned above, OE=1 is not applicable in SV, freeing this bit for +alternative uses. Additionally, Vectorisation of the VSX SIMD system +likewise makes no sense whatsoever. SV *replaces* VSX and provides, +at the very minimum, predication (which VSX was designed without). +Thus all VSX Major Opcodes - all of them - are "unused" and must raise +illegal instruction exceptions in SV Prefix Mode. + +Likewise, `lq` (Load Quad), and Load/Store Multiple make no sense to +have because they are not only provided by SV, the SV alternatives may +be predicated as well, making them far better suited to use in function +calls and context-switching. + +Additionally, some v3.0/1 instructions simply make no sense at all in a +Vector context: `twi` and `tdi` fall into this category, as do branch +operations as well as `sc` and `scv`. Here there is simply no point +trying to Vectorise them: the standard OpenPOWER v3.0/1 instructions +should be called instead. + +Fortuitously this leaves several Major Opcodes free for use by SV +to fit alternative future instructions. In a 3D context this means +Vector Product, Vector Normalise, [[sv/mv.swizzle]], Texture LD/ST +operations, and others critical to an efficient, effective 3D GPU and +VPU ISA. With such instructions being included as standard in other +commercially-successful GPU ISAs it is likewise critical that a 3D +GPU/VPU based on svp64 also have such instructions. + +Note however that svp64 is stand-alone and is in no way +critically dependent on the existence or provision of 3D GPU or VPU +instructions. These should be considered extensions, and their discussion +and specification is out of scope for this document. + +Note, again: this is *only* under svp64 prefixing. Standard v3.0B / +v3.1B is *not* altered by svp64 in any way. ## Major opcode map (v3.0B) @@ -59,9 +93,14 @@ Table 9: Primary Opcode Map (opcode bits 0:5) ## Suitable for svp64 -This is the same table containing v3.0B Primary Opcodes except those that make no sense in a Vectorisation Context have been removed. These removed POs can, *in the SV Vector Context only*, be assigned to alternative (Vectorised-only) instructions, including future extensions. +This is the same table containing v3.0B Primary Opcodes except those that +make no sense in a Vectorisation Context have been removed. These removed +POs can, *in the SV Vector Context only*, be assigned to alternative +(Vectorised-only) instructions, including future extensions. -Note, again, to emphasise: outside of svp64 these opcodes **do not** change. When not prefixed with svp64 these opcodes **specifically** retain their v3.0B / v3.1B OpenPOWER Standard compliant meaning. +Note, again, to emphasise: outside of svp64 these opcodes **do not** +change. When not prefixed with svp64 these opcodes **specifically** +retain their v3.0B / v3.1B OpenPOWER Standard compliant meaning. | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 000 | | | | | | | | mulli | 000 @@ -102,9 +141,10 @@ This is a huge list that creates extremely powerful combinations, particularly given that one of the predicate options is `(1< 0 - ... etc + # calculate the vector result of an add iregs[RT+i] = iregs[RA+i] + + iregs[RB+i] # now calculate CR bits CRs{8+i}.eq = iregs[RT+i] + == 0 CRs{8+i}.gt = iregs[RT+i] > 0 ... etc If a "cumulated" CR based analysis of results is desired (a la VSX CR6) then a followup instruction must be performed, setting "reduce" mode on @@ -475,10 +544,15 @@ hindrance, regardless of the length of VL. ## Rc=1 when SUBVL!=1 -sub-vectors are effectively a form of SIMD (length 2 to 4). Only 1 bit of predicate is allocated per subvector; likewise only one CR is allocated +sub-vectors are effectively a form of SIMD (length 2 to 4). Only 1 bit of +predicate is allocated per subvector; likewise only one CR is allocated per subvector. -This leaves a conundrum as to how to apply CR computation per subvector, when normally Rc=1 is exclusively applied to scalar elements. A solution is to perform a bitwise OR or AND of the subvector tests. Given that OE is ignored, rhis field may (when available) be used to select OR or AND behavior. +This leaves a conundrum as to how to apply CR computation per subvector, +when normally Rc=1 is exclusively applied to scalar elements. A solution +is to perform a bitwise OR or AND of the subvector tests. Given that +OE is ignored, rhis field may (when available) be used to select OR or +AND behavior. ### Table of CR fields @@ -487,7 +561,9 @@ so FP instructions with Rc=1 write to CR[1] aka SVCR1_000. CRs are not stored in SPRs: they are registers in their own right. Therefore context-switching the full set of CRs involves a Vectorised -mfcr or mtcr, using VL=64, elwidth=8 to do so. This is exactly as how scalar OpenPOWER context-switches CRs: it is just that there are now more of them. +mfcr or mtcr, using VL=64, elwidth=8 to do so. This is exactly as how +scalar OpenPOWER context-switches CRs: it is just that there are now +more of them. The 64 SV CRs are arranged similarly to the way the 128 integer registers are arranged. TODO a python program that auto-generates a CSV file @@ -510,37 +586,37 @@ TODO generate table which will be here [[svp64/reg_profiles]] ## Single-predicated Instruction -illustration of normal mode add operation: zeroing not included, elwidth overrides not included. if there is no predicate, it is set to all 1s +illustration of normal mode add operation: zeroing not included, elwidth +overrides not included. if there is no predicate, it is set to all 1s function op_add(rd, rs1, rs2) # add not VADD! - int i, id=0, irs1=0, irs2=0; - predval = get_pred_val(FALSE, rd); + int i, id=0, irs1=0, irs2=0; predval = get_pred_val(FALSE, rd); for (i = 0; i < VL; i++) - STATE.srcoffs = i # save context - if (predval & 1<