diff options
author | Markku-Juhani O. Saarinen <mjos@iki.fi> | 2024-07-15 11:06:24 +0300 |
---|---|---|
committer | Markku-Juhani O. Saarinen <mjos@iki.fi> | 2024-07-15 11:06:24 +0300 |
commit | ebab7e2ca2c3213513fc4a5171715cc1101ac12b (patch) | |
tree | ea1e296770bee0da5c562b7fecca36664774f65e /src | |
parent | 568e50adbfbaab478153807e0efed6f3bc908671 (diff) | |
download | riscv-isa-manual-ebab7e2ca2c3213513fc4a5171715cc1101ac12b.zip riscv-isa-manual-ebab7e2ca2c3213513fc4a5171715cc1101ac12b.tar.gz riscv-isa-manual-ebab7e2ca2c3213513fc4a5171715cc1101ac12b.tar.bz2 |
cleanups for https://github.com/riscv/riscv-isa-manual/issues/1518
Diffstat (limited to 'src')
-rw-r--r-- | src/b-st-ext.adoc | 28 | ||||
-rw-r--r-- | src/scalar-crypto.adoc | 120 |
2 files changed, 73 insertions, 75 deletions
diff --git a/src/b-st-ext.adoc b/src/b-st-ext.adoc index 9605aa8..fa26a78 100644 --- a/src/b-st-ext.adoc +++ b/src/b-st-ext.adoc @@ -913,7 +913,7 @@ common operations in cryptographic workloads. | ✓ | ✓ | brev8 -| <<insns-revb>> +| <<insns-brev8>> | ✓ | ✓ @@ -985,12 +985,12 @@ latency does not depend on the (secret) data being operated on. |✓ |✓ |xperm4 _rd_, _rs1_, _rs2_ -|<<#insns-xpermn>> +|<<#insns-xperm4>> |✓ |✓ |xperm8 _rd_, _rs1_, _rs2_ -|<<#insns-xpermb>> +|<<#insns-xperm8>> |=== @@ -2568,7 +2568,7 @@ Included in:: |=== <<< -[#insns-revb,reftext="Reverse bits in bytes"] +[#insns-brev8,reftext="Reverse bits in bytes"] ==== brev8 Synopsis:: @@ -3471,7 +3471,7 @@ Included in:: |=== <<< -[#insns-xpermb,reftext="Crossbar permutation (bytes)"] +[#insns-xperm8,reftext="Crossbar permutation (bytes)"] ==== xperm8 Synopsis:: @@ -3504,15 +3504,15 @@ or zero if the index into _rs2_ is out of bounds. Operation:: [source,sail] -- -val xpermb_lookup : (bits(8), xlenbits) -> bits(8) -function xpermb_lookup (idx, lut) = { +val xperm8_lookup : (bits(8), xlenbits) -> bits(8) +function xperm8_lookup (idx, lut) = { (lut >> (idx @ 0b000))[7..0] } -function clause execute ( XPERM_B (rs2,rs1,rd)) = { +function clause execute ( XPERM8 (rs2,rs1,rd)) = { result : xlenbits = EXTZ(0b0); foreach(i from 0 to xlen by 8) { - result[i+7..i] = xpermn_lookup(X(rs2)[i+7..i], X(rs1)); + result[i+7..i] = xperm8_lookup(X(rs2)[i+7..i], X(rs1)); }; X(rd) = result; RETIRE_SUCCESS @@ -3532,7 +3532,7 @@ Included in:: |=== <<< -[#insns-xpermn,reftext="Crossbar permutation (nibbles)"] +[#insns-xperm4,reftext="Crossbar permutation (nibbles)"] ==== xperm4 Synopsis:: @@ -3565,15 +3565,15 @@ or zero if the index into _rs2_ is out of bounds. Operation:: [source,sail] -- -val xpermn_lookup : (bits(4), xlenbits) -> bits(4) -function xpermn_lookup (idx, lut) = { +val xperm4_lookup : (bits(4), xlenbits) -> bits(4) +function xperm4_lookup (idx, lut) = { (lut >> (idx @ 0b00))[3..0] } -function clause execute ( XPERM_N (rs2,rs1,rd)) = { +function clause execute ( XPERM4 (rs2,rs1,rd)) = { result : xlenbits = EXTZ(0b0); foreach(i from 0 to xlen by 4) { - result[i+3..i] = xpermn_lookup(X(rs2)[i+3..i], X(rs1)); + result[i+3..i] = xperm4_lookup(X(rs2)[i+3..i], X(rs1)); }; X(rd) = result; RETIRE_SUCCESS diff --git a/src/scalar-crypto.adoc b/src/scalar-crypto.adoc index da503fa..63064dc 100644 --- a/src/scalar-crypto.adoc +++ b/src/scalar-crypto.adoc @@ -1231,14 +1231,14 @@ Included in:: <<< -[#insns-brev8,reftext="Reverse bits in bytes"] +[#insns-brev8-sc,reftext="Reverse bits in bytes"] ==== brev8 Synopsis:: Reverse the bits in each byte of a source register. Mnemonic:: -brev8, _rd_, _rs_ +brev8 _rd_, _rs_ Encoding:: [wavedrom, , svg] @@ -1246,29 +1246,21 @@ Encoding:: {reg:[ { bits: 7, name: 0x13, attr: ['OP-IMM'] }, { bits: 5, name: 'rd' }, - { bits: 3, name: 0x65 }, + { bits: 3, name: 0x5 }, { bits: 5, name: 'rs' }, - { bits: 12, name: 0x687 }, + { bits: 12, name: 0x687 } ]} .... Description:: This instruction reverses the order of the bits in every byte of a register. -[NOTE] -==== -This instruction is a specific encoding of a more generic instruction which was originally -proposed as part of the RISC-V Bitmanip extension (grevi). Eventually, the more generic -instruction may be standardised. Until then, only the most common instances of it, such as -this, are being included in specifications. -==== - Operation:: [source,sail] -- result : xlenbits = EXTZ(0b0); foreach (i from 0 to sizeof(xlen) by 8) { -result[i+7..i] = reverse_bits_in_byte(X(rs1)[i+7..i]); + result[i+7..i] = reverse_bits_in_byte(X(rs1)[i+7..i]); }; X(rd) = result; -- @@ -3346,48 +3338,51 @@ Included in:: |=== <<< -[#insns-xperm8,reftext="Crossbar permutation (bytes)"] +[#insns-xperm8-sc,reftext="Crossbar permutation (bytes)"] ==== xperm8 Synopsis:: -Byte-wise lookup of indicies into a vector. +Byte-wise lookup of indices into a vector in registers. Mnemonic:: -xprem8 _rd_, _rs1_, _rs2_ +xperm8 _rd_, _rs1_, _rs2_ Encoding:: [wavedrom, , svg] .... {reg:[ - { bits: 2, name: 0x3 }, - { bits: 5, name: 0xC }, - { bits: 5, name: 'rd'}, - { bits: 3, name: 0x4 }, - { bits: 5, name: 'rs1' }, - { bits: 5, name: 'rs2' }, - { bits: 7, name: 0x14 }, +{bits: 2, name: 0x3}, +{bits: 5, name: 0xc}, +{bits: 5, name: 'rd'}, +{bits: 3, name: 0x4}, +{bits: 5, name: 'rs1'}, +{bits: 5, name: 'rs2'}, +{bits: 7, name: 0x14}, ]} .... Description:: -The xperm8 instruction operates on bytes. The rs1 register contains a vector of XLEN/8 8-bit elements. The -rs2 register contains a vector of XLEN/8 8-bit indexes. The result is each element in rs2 replaced by the -indexed element in rs1, or zero if the index into rs2 is out of bounds. +The xperm8 instruction operates on bytes. +The _rs1_ register contains a vector of XLEN/8 8-bit elements. +The _rs2_ register contains a vector of XLEN/8 8-bit indexes. +The result is each element in _rs2_ replaced by the indexed element in _rs1_, +or zero if the index into _rs2_ is out of bounds. Operation:: [source,sail] -- val xperm8_lookup : (bits(8), xlenbits) -> bits(8) function xperm8_lookup (idx, lut) = { -(lut >> (idx @ 0b000))[7..0] + (lut >> (idx @ 0b000))[7..0] } -function clause execute ( XPERM_8 (rs2,rs1,rd)) = { -result : xlenbits = EXTZ(0b0); -foreach(i from 0 to xlen by 8) { -result[i+7..i] = xperm8_lookup(X(rs2)[i+7..i], X(rs1)); -}; -X(rd) = result; -RETIRE_SUCCESS + +function clause execute ( XPERM8 (rs2,rs1,rd)) = { + result : xlenbits = EXTZ(0b0); + foreach(i from 0 to xlen by 8) { + result[i+7..i] = xperm8_lookup(X(rs2)[i+7..i], X(rs1)); + }; + X(rd) = result; + RETIRE_SUCCESS } -- @@ -3398,18 +3393,18 @@ Included in:: |Minimum version |Lifecycle state -|Zbkx (<<#zbkx-sc>>) -|v1.0.0-rc4 +|Zbkx (<<#zbkx>>) +|v1.0 |Ratified |=== <<< -[#insns-xperm4,reftext="Crossbar permutation (nibbles)"] +[#insns-xperm4-sc,reftext="Crossbar permutation (nibbles)"] ==== xperm4 Synopsis:: -Nibble-wise lookup of indicies into a vector. +Nibble-wise lookup of indices into a vector. Mnemonic:: xperm4 _rd_, _rs1_, _rs2_ @@ -3418,35 +3413,38 @@ Encoding:: [wavedrom, , svg] .... {reg:[ - { bits: 2, name: 0x3 }, - { bits: 5, name: 0xC }, - { bits: 5, name: 'rd'}, - { bits: 3, name: 0x2 }, - { bits: 5, name: 'rs1' }, - { bits: 5, name: 'rs2' }, - { bits: 7, name: 0x14 }, +{bits: 2, name: 0x3}, +{bits: 5, name: 0xc}, +{bits: 5, name: 'rd'}, +{bits: 3, name: 0x2}, +{bits: 5, name: 'rs1'}, +{bits: 5, name: 'rs2'}, +{bits: 7, name: 0x14}, ]} .... Description:: -The xperm4 instruction operates on nibbles. The rs1 register contains a vector of XLEN/4 4-bit elements. -The rs2 register contains a vector of XLEN/4 4-bit indexes. The result is each element in rs2 replaced by the -indexed element in rs1, or zero if the index into rs2 is out of bounds. +The xperm4 instruction operates on nibbles. +The _rs1_ register contains a vector of XLEN/4 4-bit elements. +The _rs2_ register contains a vector of XLEN/4 4-bit indexes. +The result is each element in _rs2_ replaced by the indexed element in _rs1_, +or zero if the index into _rs2_ is out of bounds. Operation:: [source,sail] -- val xperm4_lookup : (bits(4), xlenbits) -> bits(4) function xperm4_lookup (idx, lut) = { -(lut >> (idx @ 0b00))[3..0] + (lut >> (idx @ 0b00))[3..0] } -function clause execute ( XPERM_4 (rs2,rs1,rd)) = { -result : xlenbits = EXTZ(0b0); -foreach(i from 0 to xlen by 4) { -result[i+3..i] = xperm4_lookup(X(rs2)[i+3..i], X(rs1)); -}; -X(rd) = result; -RETIRE_SUCCESS + +function clause execute ( XPERM4 (rs2,rs1,rd)) = { + result : xlenbits = EXTZ(0b0); + foreach(i from 0 to xlen by 4) { + result[i+3..i] = xperm4_lookup(X(rs2)[i+3..i], X(rs1)); + }; + X(rd) = result; + RETIRE_SUCCESS } -- @@ -3457,8 +3455,8 @@ Included in:: |Minimum version |Lifecycle state -|Zbkx (<<#zbkx-sc>>) -|v1.0.0-rc4 +|Zbkx (<<#zbkx>>) +|v1.0 |Ratified |=== @@ -4179,8 +4177,8 @@ specific instances of `grevi`, `shfli` and `unshfli` respectively. | ✓ | ✓ | clmul | <<insns-clmul-sc>> | ✓ | ✓ | clmulh | <<insns-clmulh-sc>> -| ✓ | ✓ | xperm4 | <<insns-xperm4>> -| ✓ | ✓ | xperm8 | <<insns-xperm8>> +| ✓ | ✓ | xperm4 | <<insns-xperm4-sc>> +| ✓ | ✓ | xperm8 | <<insns-xperm8-sc>> | ✓ | ✓ | ror | <<insns-ror-sc>> | ✓ | ✓ | rol | <<insns-rol-sc>> | ✓ | ✓ | rori | <<insns-rori-sc>> @@ -4193,7 +4191,7 @@ specific instances of `grevi`, `shfli` and `unshfli` respectively. | ✓ | ✓ | pack | <<insns-pack-sc>> | ✓ | ✓ | packh | <<insns-packh-sc>> | | ✓ | packw | <<insns-packw-sc>> -| ✓ | ✓ | brev8 | <<insns-brev8>> +| ✓ | ✓ | brev8 | <<insns-brev8-sc>> | ✓ | ✓ | rev8 | <<insns-rev8-sc>> | ✓ | | zip | <<insns-zip-sc>> | ✓ | | unzip | <<insns-unzip-sc>> |