aboutsummaryrefslogtreecommitdiff
path: root/riscv/processor.cc
AgeCommit message (Collapse)AuthorFilesLines
5 hoursrefactor: Merge halt and halt_on_reset variables in processor_tYenHaoChen1-2/+0
6 hoursrefactor: Move halt out of dcsrYenHaoChen1-1/+1
Suggested in https://github.com/riscv-software-src/riscv-isa-sim/pull/1816#pullrequestreview-2331806142.
9 daysfix error in reading right sstatusVed Shanbhogue1-1/+1
2024-09-05Work if tcontrol doesn't exist.Tim Newsome1-1/+1
2024-08-07Add SmdbltrpVed Shanbhogue1-5/+19
2024-08-01Move CSR initialization to its own fileAndrew Waterman1-397/+3
2024-08-01Merge pull request #1721 from abejgonzalez/dts_parsingAndrew Waterman1-19/+20
Enable more configuration using the DTB
2024-08-01Merge pull request #1756 from riscv-software-src/clean-up-hpmAndrew Waterman1-11/+11
Avoid magic constants in hpmcounter implementation
2024-08-01Fix enabling hypervisor extensionAndrew Waterman1-1/+1
I introduced a regression in #1753. Resolves #1755
2024-08-01Avoid magic constants in hpmcounter implementationAndrew Waterman1-11/+11
2024-08-01Move isa property to a field of processor_t, not sim_tJerry Zhao1-19/+20
This incidentally makes it easier to support heterogeneous-hart configs in the future
2024-07-31Fix segfault accessing menvcfg when U-mode doesn't existAndrew Waterman1-26/+30
The simplest fix is to create the CSRs even if they don't need to exist, and just skip adding them to the CSR map to prevent the target machine from being able to access them. It looks like there are other place we should be following this pattern: e.g. why does sstatus exist if S-mode does not exist? But that's a matter for another day. Resolves #1752
2024-07-24svpbmt: don't reset [mh]envcfg.pbmt to 1Chih-Min Chao1-4/+2
The part is introducd by ea70a93 to keep backward compatiable but the behavior is not mentioned and defined in spec. The patch remove this initialization part of pbmt in [mh]envcfg Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2024-07-21Merge pull request #1729 from YenHaoChen/pr-require-vectorAndrew Waterman1-1/+2
Fix: Vector CSRs exist without any vector extension since a484f6e
2024-07-06Instantiate vector CSRs only if any_vector_extensions()YenHaoChen1-1/+2
2024-07-06Add SsdbltrpVed Shanbhogue1-5/+20
2024-07-06refactor: Add specialized hstatus_csr_tYenHaoChen1-5/+1
2024-07-06pointer masking: Let [sh]envcfg.PMM be WARL if with SsnpmYenHaoChen1-0/+2
2024-07-06pointer masking: Let menvcfg.PMM be WARL if with SmnpmYenHaoChen1-0/+1
2024-07-16excp: support hardware_error_exception delegationBinno1-1/+2
enable M -> S and HS -> VU/VS delegation
2024-06-21Remove all --varch parsingJerry Zhao1-61/+0
2024-06-21Switch to Zvl/Zve parsing from isa_parser, instead of varchJerry Zhao1-1/+4
2024-06-21Disallow any vector, not just V, when no __int128 type is presentJerry Zhao1-1/+1
2024-06-11Improve hit rate of opcode cache to compensate for not mutating insn listAndrew Waterman1-8/+13
2024-06-11Keep potentially overlapping instructions in order at head of listAndrew Waterman1-20/+32
2024-06-11Preserve the ordering of the instruction listAndrew Waterman1-22/+2
2024-06-11triggers: implement tcontrolYenHaoChen1-0/+4
Implement Debug spec Section 5.7.6. Trigger Control (tcontrol). This commit lets tcontrol be read-only 0 if number of triggers is 0.
2024-05-31Avoid checking ELP before every instruction fetchAndrew Waterman1-10/+6
Serialize after setting ELP. That way, we can hoist the check outside of the main simulation loop.
2024-05-31No need to check if Zicfilp is enabled before checking ELPAndrew Waterman1-3/+1
ELP will be zero if Zicfilp is not enabled.
2024-04-18Add Zicfiss extension from CFI extension, v0.4.0SuHsien Ho1-3/+11
1. Add EXT_ZICFISS for enable Zicfiss with zicfiss extension name. 2. Add new software exception with tval 3 for shadow stack. 3. Implement sspush_x1/sspush_x5/sspopchk_x1/sspopchk_x5/ssrdp/ssamoswap_w/ssamoswap_d. 4. Implement c_sspush_x1/c_sspopchk_x5 in c_lui.h which has same encoding. 5. Add new special access type ss_access in xlate_flags_t for checking special read/write permission in SS(Shadow Stack) page. 6. Add new ss_load/ss_store/ssamoswap to enable ss_access flag. 7. Check special pte(xwr=010) of SS page.
2024-03-25Narrow scontext.data length to 32YenHaoChen1-1/+1
The commit provdes the change between debug spec 1.0.0-rc1 and 1.0.0-rc2 Reference: https://github.com/riscv/riscv-debug-spec/pull/981
2024-03-21Merge pull request #1582 from mylai-mtk/zicfilp-upstreamAndrew Waterman1-5/+34
Support Zicfilp
2024-03-07workaround to support custom extensions that use standard prefixesAlexander Romanov1-24/+40
RISC-V ISA states (21.1): "A standard-compatible global encoding can also use standard prefixes for non-standard extensions if the associated standard extensions are not included in the global encoding." Currently all the instructions (either from standard or custom extensions) are all being inserted into a single std::vector which is then being sorted. An instruction matching process performs linear search on that vector. The problem is that when a custom extension uses the same opcode as standard one (i.e. match and mask are equal to the standard counterparts) it is undefined which instruction will be picked. That is because in std::sort "The order of equal elements is not guaranteed to be preserved". That being said it is impossible to define custom extension (via customext) that would use the prefix of a disabled standard extension. In this change I separate custom and standard extensions in two separate std::vector's. By default we report an error if they have common elements (There're an additional processor_t constructor's argument that skips this check). If this error is disabled during instruction matching we first trying to find it among custom instructions. If it has been found the search is stopped and custom instruction is executed, otherwise we look for it among standard instructions. Overall this change does not completely fix the problem but at least makes it possible to use the feature of RISC-V ISA.
2024-03-06Zicfilp: Support delegating software check exception handlingMing-Yi Lai1-1/+2
2024-03-06Zicfilp: Preserve expected landing pad state on trapsMing-Yi Lai1-1/+9
2024-03-06Zicfilp: Check that the next insn is a lpad if ELP is LP_EXPECTEDMing-Yi Lai1-0/+15
2024-03-06Zicfilp: Set ELP state when executing indirect jumpsMing-Yi Lai1-0/+2
2024-03-06Zicfilp: Add CSR fieldsMing-Yi Lai1-3/+6
2024-02-06Fix hvip.VSEIP and hvip.VSTIP, so they don't observe platform-specific ↵YenHaoChen1-10/+1
interrupts or CSR hgeip bits The H extension defines that bits VSEIP, VSTIP, and VSSIP of hvip are writable. (The other bits of hvip are read-only 0.) Only hip.VSSIP (mip.VSSIP) is an alias of hvip.VSSIP. The hip.VSEIP is the logical-OR of hvip.VSEIP, selected bit of hgeip by hstatus.VGEIN, and platform-specific external interrupt signals to VS-level, e.g., from AIA. The hip.VSTIP is the logical-OR of hvip.VSTIP and platform-specific timer interrupt signals to VS-level, e.g., from Sstc. Thus, the read values of hvip.VSEIP and hvip.VSTIP differ from the ones of hip.VSEIP and hip.VSTIP (mip.VSEIP and mip.VSTIP). In other words, the hvip isn't an alias (proxy) of mip. The current aliasing (proxy) implementation does not provide the desired behavior for hvip.VSEIP and hvip.VSTIP. An ISA-level behavior difference is that any platform-specific external and timer interrupt signals directed to VS-level should not be observable through the hvip. For instance, the hvip should not observe the virtual timer interrupt signal from the vstimecmp CSR (Sstc extension), which isn't true in the current implementation. Additionally, the hvip should not observe the virtual external interrupt signal from the IMSIC device (AIA extension). Another ISA-level behavior difference is that the hgeip and hstatus.VGEIN also should not affect hvip.VSEIP, which isn't true in the current implementation. This commit fixes the issue by giving the hvip a specialized class, hvip_csr_t. The hvip_csr_t aliases the hvip.VSSIP to the mip.VSSIP but decouples the hvip.VSEIP and hvip.VSTIP from mip.VSEIP and mip.VSTIP. Additionally, the commit updates the read value of mip to be the logical-OR of hvip.VSEIP, hvip.VSTIP, and other sources.
2024-01-11Fix vectored VS-level interruptsScott Johnson1-1/+1
They were going to the vector for cause 10 (VSEI) even though vscause had been correctly translated to 9 (SEI). Fixes #1340.
2024-01-11Introduce adjusted_cause which I will reuse nextScott Johnson1-1/+2
2024-01-11Introduce interrupt_bit which I will reuse nextScott Johnson1-1/+2
2023-12-30Add srmcfg CSRVed Shanbhogue1-1/+7
2023-12-22typo: correct sstateen CSR addressYenHaoChen1-1/+1
2023-12-08Remove cfg_arg_t from cfg_tJerry Zhao1-1/+1
Argument parsing should be scoped to the code which constucts cfg_t
2023-12-07refactor: single statement of declaration and initialization on miselect, ↵YenHaoChen1-6/+3
siselect, and vsiselect
2023-12-06miselect: support miselect when enabling smcsrindYenHaoChen1-0/+3
Signed-off-by: YenHaoChen <39526191+YenHaoChen@users.noreply.github.com>
2023-11-04expose pmp granularity as a cli option.Karthik B K1-1/+1
PMP Granularity is made available as a command line option. The default value is 4 Bytes. The value can be changed by passing the option --pmp-granularity=<value> to spike. Signed-off-by: Karthik B K <karthik.bk@incoresemi.com>
2023-08-14rename *envcfg.HADE to *envcfg.ADUEVed Shanbhogue1-2/+2
2023-07-26Add Smcntrpmf functionalityAtul Khare1-2/+21
If Smcntrpmf is enabled, mcycle / minstret increment only if counting for the privilege level isn't inhibited in mcyclecfg / minstretcfg.