aboutsummaryrefslogtreecommitdiff
path: root/riscv/encoding.h
AgeCommit message (Collapse)AuthorFilesLines
2022-07-07update encoding.hWeiwei Li1-3381/+3444
2022-03-30Implement Sv57 and Sv57x4 translation modesAndrew Waterman1-0/+1
2022-01-19Fix HINVAL.VVMA and HINVAL.GVMA opcodesAndrew Waterman1-27/+204
The opcodes were incorrect in riscv-opcodes; now they match the spec.
2021-12-27Update instruction vmandnot.mm, vmornot.mm -> vmandn.mm, vmorn.mm (#896)Yueh-Ting (eop) Chen1-6/+6
Refer to rvv-spec v1.0-rc2
2021-11-02Zbkx renames xperm.n and xperm.b as xperm4 and xperm8. (#846)Markku-Juhani O. Saarinen1-15/+15
Krypto 1.0 changes: Entropy source CSR, name. List scalar crypto instruction groupings, as there is no single K extension. Co-authored-by: Markku-Juhani O. Saarinen <mjos@mjos.fi>
2021-11-02Regenerate encoding.h from riscv-opcodes (#848)Scott Johnson1-22/+3
This will enable the Krypto changes in #846 to apply cleanly. This removes the encodings for N-extension (user interrupts) which were never implemented in Spike; also fixes the encoding of sfence.w.inval and sfence.inval.ir, confirmed by @daniellustig: https://github.com/riscv-software-src/riscv-isa-sim/pull/846#discussion_r741437419 This was generated from https://github.com/riscv/riscv-opcodes/commit/70c120b5464d0a77491f07e5d66c4523d63a86a4 which I created to get the generated encoding.h to most closely match what Spike already had; see https://github.com/riscv/riscv-opcodes/pull/87
2021-09-27Allow `csrr mstatush` to see MPV and GVA bits tooScott Johnson1-0/+2
But it doesn't help much, because `csrw mstatush` doesn't do anything.
2021-09-08Move SSTATUS_VS_MASK into vsstatus_csr_tScott Johnson1-4/+0
Since that's the last place it was being used.
2021-08-08Removed SWAP16 encoding and implementation header. (#766)marcfedorow1-3/+0
SWAP16 is an alias to PKBT16 since p-spec v0.9.3.
2021-07-30scalar-crypto: v0.9.4/arch-review entropy source updates.Ben Marshall1-10/+2
- Post arch review updates to the entropy source: - New address is 0x546 - Removed old references to mentropy and mnoise. - Throw invalid opcode exception when reading without writing. - Missing: mseccfg register with SKES bit. Waiting for rest of register to be implemented. On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: modified: riscv/encoding.h modified: riscv/entropy_source.h modified: riscv/processor.cc
2021-07-28Update encoding.hAndrew Waterman1-146/+168
2021-07-28scalar-crypto: Remove DECLARE_RV*_ONLY macros from encoding.hBen Marshall1-21/+0
- These are no longer needed since none of the scalar crypto instructions overlap their encodings any more. - There is more code to be removed in relation to letting Spike handle overlapped RV32/64 instructions, but this will be done in subsequent commits and PRs so that the downstream scalar-crypto work can be un-gated. On branch scalar-crypto Changes to be committed: modified: riscv/encoding.h
2021-07-28scalar-crypto: AES32 encoding changes post arch-reviewBen Marshall1-4/+4
- AES32 encodings nolonger overlap AES64 encodings On branch scalar-crypto Changes to be committed: modified: riscv/encoding.h
2021-07-26Merge pull request #754 from chihminchao/clean-vqmac-vdotAndrew Waterman1-18/+0
decode: op: remove quad related macro and define
2021-07-26decode: op: remove quad related macro and defineChih-Min Chao1-18/+0
Let git keep the legacy code Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-07-20Priv virtual memory updates (#750)Daniel Lustig1-0/+18
* Priv virtual memory updates * Priv 1.12 requires page faults when the address translation process reaches a PTE with any reserved bit set * Svpbmt uses two PTE bits, but otherwise has no effect on Spike (since Spike is sequentially consistent and does not model PMAs) * Add Svinval instructions Even though I updated riscv-opcodes separately, I merged the new defines into riscv/encoding.h manually, because riscv-opcodes seems to be a step ahead of riscv-isa-sim for a few vector opcodes, causing conflicts when regenerating encoding.h... If that gets fixed, and encoding.h gets regenerated automatically, I can remove it from this PR to avoid conflicts. * Svinval: use #include rather than copying code ..for the Svinval functions that are implemented in ways that just mimic SFENCE/HFENCE instructions Thanks to @aswaterman for the suggestion
2021-06-07PTE N bit moved from bit 62 to bit 63 (#724)Daniel Lustig1-1/+1
2021-06-04scalar-crypto: Encoding fixes for v0.9.2Ben Marshall1-6/+6
- Reverts the AES32 and SM4 instruction encodings back to a normal R-type encoding, per the advice of the architecture reviewers. On branch scalar-crypto-v0.9.2 Changes to be committed: modified: riscv/encoding.h modified: riscv/insns/aes32dsi.h modified: riscv/insns/aes32dsmi.h modified: riscv/insns/aes32esi.h modified: riscv/insns/aes32esmi.h modified: riscv/insns/sm4ed.h modified: riscv/insns/sm4ks.h
2021-06-04encoding: udpate and move platform-related define outChih-Min Chao1-7/+1
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-05-10Support RISC-V p-ext-proposal v0.9.2 (#637)ChunPing Chung1-0/+981
* rvp: add 8/16 bits add/sub simd instructions * rvp: add 8/16 bits shift simd instructions * rvp: add 8/16 bits compare simd instructions * rvp: add 8/16 bits multiply simd instructions * rvp: add 8/16 bits misc simd instructions * rvp: add 8 bits unpacking simd instructions * rvp: update suppported extention and add restriction * rvp: update encoding.h and riscv.mk.in * rvp: disasm: add simd instruction support * rvp: update readme for p-ext simd instructions * rvp: fix rvp support version * rvp: update encoding.h generated from riscv-opcode p-ext branch * rvp: rename some macro argument * rvp: add pk[bb,bt,tt,tb][16,32] instructions * rvp: add kadd32, [su]maqa[_su] instructions * rvp: fix missing initial value of pd * rvp: add msw 32x32 multiply & add instructions * rvp: change to use extract64 * rvp: add msw 32x16 multiply & add instructions * rvp: fix some style * rvp: change reduction marcro definition * rvp: add signed 16x32 add/subtract instructions * rvp: use stdint to replace hardcode max/minimum * rvp: refactor some p-ext macro code * rvp: add partial simd miscellaneous instructions * rvp: add signed 16 x 64 add/subtract Instructions * rvp: add 64-bit add & sub instructions * rvp: add 32-bit mul with 64-bit add/sub instructions * rvp: add 16-bit mul with 64-bit add/sub instructions * rvp: disasm: add 64 bit profile instruction support * rvp: add Q15 saturation instructions * rvp: fix kmar64/kmsr64 saturation behavior * rvp: add 32-bit computation instructions * rvp: add rdov/clrov and fix khm16 behavior of setting OV flag * rvp: add non simd miscellaneous instructions * rvp: add Q31 saturation instructions * rvp: disasm: add non-simd instruction support * rvp: add 32 bits add/sub simd instructions * rvp: fix left shift saturation bug * rvp: add 32 bits shift simd instructions * rvp: add rv64 only Q15 simd instructions * rvp: add rv64 only 32-bit multiply instructions * rvp: add rv64 only 32-bit miscellaneous instructions * rvp: add rv64 only 32-bit mul & add instructions * rvp: add rv64 only 32-bit parallel mul & add instructions * rvp: add rv64 only non-simd 32-bit shift instructions * rvp: disasm: remove redundant tab * rvp: disasm: add rv64 only instructions support * rvp: change ov csr to ucode to match v0.5.2 spec * rvp: update readme for p-ext 0.5.2 * rvp: update to p-ext v0.9.1 * rvp: update to p-ext v0.9.2 * rvp: update readme for p-ext 0.9.2 * rvp: fix macro for PKxx16 & PKxx32 commands. * rvp: fix missing for in PKxxdd macro * Sign-extension for p-ext insns * * Fixed uclipNN insns while sh >> 64 is an UB. * Added missing OV * Added missing sext_xlen * Remove unused macroses * Sign extension for RD_PAIR macro * rvp: remove lost tab Co-authored-by: Mark Fedorov <mark.fedorov@cloudbear.ru>
2021-03-08Merge pull request #649 from ben-marshall/scalar-crypto-fixAndrew Waterman1-12/+51
Scalar crypto fixes
2021-02-24rvv: add vsetivliChih-Min Chao1-1/+4
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-24rvv: add vse1/vle1Chih-Min Chao1-0/+6
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-23rvv: rename sqrt/reciprocal instructionsChih-Min Chao1-7/+7
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-18scalar-crypto: Fix decoding of RV64 AES instructions.Ben Marshall1-12/+51
Historically, one could uniquely decode any RISC-V instruction based on the instruciton to decode, plus a MATCH and MASK pair. The scalar crypto extension adds instructions for accelerating the AES algorithm which work very differently on RV32 and RV64. However, they overlap in terms of opcodes. The instructions are always mutually exclusive, and so it makes sense to overlap them this way to save encoding space. This exposed a problem, where previously Spike assumed the decoder function was something like: > decode(instr_word, MATCH, MASK) Now it needed to be > decode(instr_word, MATCH, MASK, current_xlen) To get around this in the initial implementation, the instructions which shared opcodes were implemented in the same *.h file - e.g. aesds.h contained an implementation of aes32dsi, and aes64ds. We detected xlen in the file, and executed the appropriate instruction logic. This worked fine for our limited set of benchmarks. After more extensive testing, we found that Spike has an optimisation which changes the order in which it tries to decode instructions based on past instructions. Running more extensive tests exposed the fact that the decoding logic could still not unambiguously decode the instructions. Hence, more substantial changes were needed to tell spike that an instruction is RV32 or RV64 only. These changes have been implemented as part of - riscv/encoding.h - disasm/disasm.cc - riscv/processor.cc/h Basically, every instr_desc_t has an extra field which marks which base architecture the instruction can be exectuted on. This bitfield can be altered for particular instructions. The changes to riscv/insns/* simply split out the previously combined instructions into a separate header files. On branch scalar-crypto-fix Changes to be committed: modified: disasm/disasm.cc modified: riscv/encoding.h new file: riscv/insns/aes32dsi.h new file: riscv/insns/aes32dsmi.h new file: riscv/insns/aes32esi.h new file: riscv/insns/aes32esmi.h new file: riscv/insns/aes64ds.h new file: riscv/insns/aes64dsm.h new file: riscv/insns/aes64es.h new file: riscv/insns/aes64esm.h deleted: riscv/insns/aesds.h deleted: riscv/insns/aesdsm.h deleted: riscv/insns/aeses.h deleted: riscv/insns/aesesm.h modified: riscv/processor.cc modified: riscv/processor.h modified: riscv/riscv.mk.in
2021-02-08Zsn has been renamed Svnapot (#641)Daniel Lustig1-1/+1
2021-01-22scalar-crypto: Initial spike support for v0.8.1 (#635)Ben Marshall1-0/+87
Brief: - This commit adds spike support for the scalar cryptography extension. See the riscv-crypto repository (https://github.com/riscv/riscv-crypto) for more information on this extension. - It is based on the experimental patch which has so far been kept in the riscv-crypto repository. Now that scalar crypto is nearly at the "freeze" stage and entering opcode consistency review, it makes sense to start upstreaming our experimental version. - In terms of compiler support - we are using an experimental patch in the riscv-crypto repository at the moment, others are working on an upstream appropriate version. Details: - Add support for dedicated scalar crypto instructions. - Add very basic support for the entropy source (entropy_source.h). Much of the behaviour of this is implementation specific. This model aims to provide the bare minimum of functionality which can be used to quickly develop software. It uses /dev/urandom as its entropy source for now. - Scalar crypto is unique in that it _borrows_ instructions from the Bitmanipulation extension. This is currently _not_ encoded in the patch, as I didn't want to damage anything in Bitmanip which is currently under review. However, I've added a macro in riscv/decode.h called "require_either_extension(A,B)", which allows instructions to be valid opcodes iff they are in one or both extensions. On branch scalar-crypto Changes to be committed: modified: README.md modified: riscv/decode.h modified: riscv/encoding.h new file: riscv/entropy_source.h new file: riscv/insns/aes64im.h new file: riscv/insns/aes64ks1i.h new file: riscv/insns/aes64ks2.h new file: riscv/insns/aes_common.h new file: riscv/insns/aesds.h new file: riscv/insns/aesdsm.h new file: riscv/insns/aeses.h new file: riscv/insns/aesesm.h new file: riscv/insns/sha256sig0.h new file: riscv/insns/sha256sig1.h new file: riscv/insns/sha256sum0.h new file: riscv/insns/sha256sum1.h new file: riscv/insns/sha512sig0.h new file: riscv/insns/sha512sig0h.h new file: riscv/insns/sha512sig0l.h new file: riscv/insns/sha512sig1.h new file: riscv/insns/sha512sig1h.h new file: riscv/insns/sha512sig1l.h new file: riscv/insns/sha512sum0.h new file: riscv/insns/sha512sum0r.h new file: riscv/insns/sha512sum1.h new file: riscv/insns/sha512sum1r.h new file: riscv/insns/sm3p0.h new file: riscv/insns/sm3p1.h new file: riscv/insns/sm4_common.h new file: riscv/insns/sm4ed.h new file: riscv/insns/sm4ks.h modified: riscv/processor.cc modified: riscv/processor.h modified: riscv/riscv.mk.in
2021-01-17rvb: add xperm.[nbhw] (#629)Chih-Min Chao1-1/+13
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-01-08Update Zba/Zbb/Zbc to v0.93; Zbs/Zbe to v0.94-draftAndrew Waterman1-378/+352
2020-12-02rvv: index load/store have benn separated into ordered and unordered parts ↵Chih-Min Chao1-72/+96
(#611) ref: https://github.com/riscv/riscv-v-spec/commit/511d0b84a3848de437fd01990d078feaa2871b11 Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-11-23Fix VSSTATUS bits updation (#568)Anup Patel1-1/+1
This patch fixes VSSTATUS bits updations as follows: 1. set_csr() should not allow writs to VSSTATUS.SD bit instead VSSTATUS.SD bit should be derived again after VSSTATUS is updated 2. set_virt() should copy FS, VS and XS bits when transitioning from virt=on (VS/VU-mode) to virt=off (HS/M-mode) Signed-off-by: Anup Patel <anup.patel@wdc.com>
2020-11-18Add Zsn extensionAndrew Waterman1-0/+1
h/t @daniellustig
2020-11-07Allow fixed endianness to be observed through MBE/SBE/UBEMarcus Comstedt1-1/+7
2020-10-22Swap MAX and MINU encodingsAndrew Waterman1-3/+3
2020-10-22[riscv-bitmanip] Add sh[123]add[u.w] instructionClifford Wolf1-0/+18
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2020-10-22[riscv-bitmanip] Changes for RISC-V Bitmanip Spec 0.92Clifford Wolf1-8/+23
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2020-10-22[riscv-bitmanip] Changes for RISC-V Bitmanip Spec 0.91Clifford Wolf1-25/+43
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2020-10-22[riscv-bitmanip] Fix [un]shfl shamt lengthClifford Wolf1-2/+2
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2020-10-22[riscv-bitmanip] Add bitmanip instructionsClifford Wolf1-0/+267
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2020-08-31rvv: add reciprocal instructionsChih-Min Chao1-0/+6
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-08-27rvv: remove quad instructionsChih-Min Chao1-12/+0
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-08-04Merge pull request #521 from chihminchao/op-hypvervisorAndrew Waterman1-48/+48
Op hypvervisor
2020-08-03op: hyperviosr: fix exception code and nameChih-Min Chao1-3/+3
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-08-03op: rearrange hypbervisor op/csr/causeChih-Min Chao1-46/+46
The change comes from the generation order in riscv-opcodes. The original definition is placed in opcode-system but the new one is placed in separated opcode-rv64h and opcode-rv32h. Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-08-03op: rvv: fix pesudo code instructionsChih-Min Chao1-3/+3
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-07-29rvv: add vrgatherei16.vvChih-Min Chao1-0/+3
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-07-29rvv: add new whole reg load/store instructionsChih-Min Chao1-3/+69
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-07-29rvv: op: rearrange some instruction since generation order changeChih-Min Chao1-36/+36
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-07-29rvv: op: fix amo namingChih-Min Chao1-108/+108
The original name misses the 'i' in instruction mae vamoswape8 -> vamoswapei8 Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-07-09Implement hypervisor CSRs read/writeAnup Patel1-3/+14
We add newly defined hypervisor CSRs and allow M/HS-mode to access these CSRs. The MRET, SRET, ECALL and WFI instructions have also been updated so that virt-to-novirt switch and exception cause is based on HART virtualization state. Subsequent patches will implement two-stage page tables, HFENCE instructions and HSV/HLV instructions. Signed-off-by: Anup Patel <anup.patel@wdc.com>