aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-06-02Remove Duff's Device in main simulation loop (#721)Andrew Waterman3-58/+12
With recent compilers on recent computers, the much simpler version of the code is actually slightly faster. I suspect, but haven't proven, that more accurate indirect jump prediction is the main explanation. Reduced I$ pressure might be a secondary factor.
2021-06-02Accept Zba, Zbb, Zbc, Zbs ISA stringsAndrew Waterman46-45/+85
The B extension still implies the presence of Zba/Zbb/Zbc/Zbs.
2021-06-02Fix ambiguous if/else warningAndrew Waterman1-1/+1
2021-06-02Fix CSR read-only check regression introduced in 463001198Andrew Waterman1-1/+5
2021-05-25Add alignment check for lr instruction (#713)sven3-3/+6
Co-authored-by: zhongcy <zhongcy93@gmail.com>
2021-05-20Don't raise virtual instruction exceptions writes to read-only registersAndrew Waterman1-2/+1
This is a bug in the spec that will be changed in the next few days.
2021-05-17Implement satp/vsatp WARLness correctlyAndrew Waterman2-33/+36
For V=0 or V=1 writes to satp, the entire write is suppressed if the MODE is not supported. For V=0 writes to vsatp, only normal WARLness applies.
2021-05-17Enforce hgatp WARLness in concordance with the specAndrew Waterman1-9/+15
hgatp.PPN should be writable even if the new MODE is invalid. Additionally, mask off the two LSBs, as the spec allows.
2021-05-10Support RISC-V p-ext-proposal v0.9.2 (#637)ChunPing Chung334-1/+4228
* 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-05-08in get_csr, use ret macro instead of return statementAndrew Waterman1-2/+2
2021-05-01Improve coding style of logging printfsAndrew Waterman4-21/+16
2021-05-01Fix compiler warning (#706)jmonesti1-2/+2
At compile time, gcc complains with: ../riscv/processor.cc:787:94: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=] The variable 'bits' is an uint64_t, so that PRIx64 should be used to print it out.
2021-04-27Implement JTAG BYPASS register. (#697)Tim Newsome2-11/+15
* Implement JTAG BYPASS register. This allows spike to put into a virtual scan chain with other remote_bitbang JTAG devices. * Initialize bypass to 0. Also change what we do on what edge. In theory that's more correct but in practice it doesn't make a difference.
2021-04-13Display 32 bits (#693)emelcher3-11/+39
* make value display depend on max_xlen * try to make spike look for correct pk * PRIx64 instead of PRIx32, TARGET_ARCH back to 64 * 32 bit memory data, exception epc and tval
2021-04-05replace old compliance name with new arch-test name in spike target README ↵Allen Baum1-6/+6
(#690)
2021-03-26Add missing require_rv64 for rv64-only insns. (#684)marcfedorow6-0/+6
2021-03-25Merge pull request #683 from huaixv/masterAndrew Waterman0-0/+0
Fix `stx_ino` member name in commit b65ead8
2021-03-25Fix statx configure checkAndrew Waterman2-3/+3
2021-03-26Fix `stx_ino` member name in commit b65ead8huaixv2-3/+3
2021-03-25Fix xperm.[bhn] on RV32Andrew Waterman3-3/+3
Need to sign-extend result.
2021-03-25Fix Ubuntu 16.04 buildAndrew Waterman3-0/+22
Was broken by #681.
2021-03-25Merge pull request #681 from huaixv/masterAndrew Waterman4-0/+166
Add `statx` syscall to Spike
2021-03-25Add `statx` syscallhuaixv4-0/+166
2021-03-24Merge pull request #680 from scottj97/fix-vs-interruptsAndrew Waterman1-1/+1
HS-level interrupts should always be enabled when in VS-mode
2021-03-24HS-level interrupts should always be enabled when in VS-modeScott Johnson1-1/+1
See https://github.com/riscv/riscv-isa-manual/issues/633
2021-03-10Fix and refactor RV32-only and RV64-only instruction handlingAndrew Waterman2-16/+14
We can use the nullness of pointers to indicate RV32-only or RV64-only instructions, rather than a new field dedicated to that purpsoe. The bug fix is that the new field wasn't always initialized; now, it doesn't need to be. Resolves #673
2021-03-10Stylistic changesAndrew Waterman2-11/+10
2021-03-08When disabling hypervisor via misa, clear hypervisor stateScott Johnson1-2/+8
Otherwise, mstatus.MPV and hstatus.SPV could remain 1, and executing mret/sret would then set state.v=1, which would be bad since hypervisor's supposed to be disabled.
2021-03-08Extract hypervisor_exceptions variableScott Johnson1-7/+8
Which I will reuse next.
2021-03-08Merge pull request #649 from ben-marshall/scalar-crypto-fixAndrew Waterman23-262/+296
Scalar crypto fixes
2021-03-07Forbid `csrw vsstatus` from modifying the UXL field (#671)Scott Johnson1-0/+1
Since this is not modifiable in the real sstatus, so it should not be in the virtualized version either.
2021-03-05Fix vsstatus.FS misbehavior (#661)Scott Johnson2-35/+10
* Simplify Boolean logic No functional change intended. * Apply same logic to virtualize sstatus.XS as used for VS and FS Though this macro does not seem to be used anywhere today. * Extract common macro to DRY up code * Dirty both mstatus and vsstatus FP fields Fixes https://github.com/riscv/riscv-isa-sim/issues/660
2021-03-05Fix bug where hstatus.SPVP was being changed when it should not be (#667)Scott Johnson1-1/+2
2021-03-05Don't make MPRV load/store virtual if MPV=1, MPP=3 (#666)jameshippisley1-1/+1
* Don't make MPRV load/store virtual if MPV=1, MPP=3 * Use PRV_M instead of the value "3"
2021-03-05Fix hedeleg to match Privileged Spec requirements (#669)Scott Johnson1-0/+2
Table 5.2 requires certain bits to be writable in hedeleg: https://github.com/riscv/riscv-isa-manual/blob/0453d462a180927169656e6e3f7faf3042b23e5b/src/hypervisor.tex#L386-L409
2021-03-04Fix bug where CSRW to vsstatus would not set SD correctly (#665)Scott Johnson1-1/+1
The priv spec says: "For example, the value of the HS-level sstatus.FS [aka mstatus.FS] does not affect vsstatus.SD."
2021-03-02Hard-wire VSXL field in RV64 hstatus (#664)Scott Johnson1-0/+2
It was reading as 0, which is not a legal value.
2021-03-02Fix AMO guest page fault as store guest fault (#663)francis40961-0/+3
2021-03-01Correct RV64 vsstatus.UXL field (#659)Scott Johnson1-0/+1
It was reading as 0, which is not a legal value. In mstatus, UXL gets initialized by the call to set_csr(CSR_MSTATUS) here in processor_t::reset().
2021-02-25Merge pull request #655 from chihminchao/rvv-v0.10Andrew Waterman28-48/+64
Rvv v0.10
2021-02-25Reindent to match style of surrounding codeScott Johnson1-2/+2
2021-02-25Update comment to match misa capabilitiesScott Johnson1-1/+1
2021-02-24rvv: update readmeChih-Min Chao1-1/+1
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-24rvv: add vsetivliChih-Min Chao5-1/+9
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-24rvv: totally remove edivChih-Min Chao2-4/+1
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-24rvv: add vse1/vle1Chih-Min Chao22-28/+43
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-23rvv: rename sqrt/reciprocal instructionsChih-Min Chao5-11/+11
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-23rvv: disas: reserved sew >= 128Chih-Min Chao1-4/+0
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-02-18scalar-crypto: Fix decoding of RV64 AES instructions.Ben Marshall17-238/+272
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-18scalar-crypto: Fix RV32 sha512 instructions.Ben Marshall6-24/+24
These instructions are RV32 only. Previously, they zero-extended their 32-bit result to 64-bits, to match the Spike implementation detail that the X registers are always 64-bits long. This exposed a data dependant problem when the instruction results fed into the add and sltu instructions. The lack of sign extension on the sha512*, combined with the presence of sign extension on the add, meant sltu would (as it is currently implemented) produce the wrong result. There were two potential fixes: 1) Sign extend from 32-bits to XLEN the result of the SHA512 instructions. 2) Change the SLTU implementation to truncate RS1/RS2 to be XLEN bits before it does the comparison. This patch implements option 1, because I didn't want to mess with a base ISA instruction. However, this leaves the implementation detail open to cause problems for people in the future. Fixing this is outside the scope of this commit. On branch scalar-crypto-fix Changes to be committed: modified: riscv/insns/sha512sig0h.h modified: riscv/insns/sha512sig0l.h modified: riscv/insns/sha512sig1h.h modified: riscv/insns/sha512sig1l.h modified: riscv/insns/sha512sum0r.h modified: riscv/insns/sha512sum1r.h