aboutsummaryrefslogtreecommitdiff
path: root/riscv
AgeCommit message (Collapse)AuthorFilesLines
2023-02-05Make clint tolerant of discontiguous hart IDsplic-clint-endianAndrew Waterman3-19/+26
2023-02-05Fix CLINT on big-endian machinesAndrew Waterman1-23/+55
This will also make it easier to support discontiguous hart IDs.
2023-02-04Fix PLIC on big-endian hostsAndrew Waterman1-0/+2
2023-02-04Correctly instantiate PLIC contexts for mixed-hart targetsAndrew Waterman3-11/+20
This commit started as an attempt to make the PLIC tolerant of discontiguous hart IDs, but it turns out it was already most of the way there: PLIC contexts can still be dense even if the hart IDs are not. Nevertheless, I wanted to avoid passing the procs vector directly to the plic_t constructor. In removing it, I realized I could also get rid of the smode parameter by querying whether each hart has S-mode. This is also more correct; previously, we were instantiating the PLIC as though all harts had S-mode, regardless of whether they actually did.
2023-02-04Simplify plic_context_t initializationAndrew Waterman1-9/+2
2023-02-04Remove unused plic_context_t::num fieldAndrew Waterman2-2/+0
2023-02-04Remove unused plic_t::procs fieldAndrew Waterman2-2/+1
2023-02-04Make debug module tolerant of discontiguous hart IDsAndrew Waterman2-48/+28
The general strategy is to avoid iterating over the ID space.
2023-02-04Add sim_t::get_harts accessorAndrew Waterman5-23/+29
2023-01-31Zicond: implement Zicond (conditional integer operations)Philipp Tomsich5-0/+12
This implements the Zicond (conditional integer operations) extension, as of version 1.0-draft-20230120. The Zicond extension acts as a building block for branchless sequences including conditional-arithmetic, conditional-logic and conditional-select/move. The following instructions constitute Zicond: - czero.eqz rd, rs1, rs2 => rd = (rs2 == 0) ? 0 : rs1 - czero.nez rd, rs1, rs2 => rd = (rs2 != 0) ? 0 : rs1 See https://github.com/riscv/riscv-zicond/releases/download/v1.0-draft-20230120/riscv-zicond_1.0-draft-20230120.pdf for the proposed specification and usage details.
2023-01-31Update encoding.h for Zicond opcodesAndrew Waterman1-2/+81
Note this encoding.h's history is unusual because riscv-opcodes master is currently incompatible with Spike. See the PR that contains its commit hash (https://github.com/riscv/riscv-opcodes/pull/157) and discussion at https://github.com/riscv-software-src/riscv-isa-sim/pull/1234#discussion_r1092243338
2023-01-30triggers: optimize icount_t::icount_check_needed()YenHaoChen1-1/+1
2023-01-30triggers: add detect_icount_match()YenHaoChen3-6/+65
2023-01-30triggers: force to slow path with icount triggersYenHaoChen4-2/+9
2023-01-30triggers: add icount_t and update tinfoYenHaoChen2-0/+52
2023-01-30triggers: if match triggers with both breakpoint exception and entering ↵YenHaoChen1-6/+8
D-mode, then enter D-mode and ignore breakpoint exception
2023-01-30triggers: refactor: use CSR_TDATA1_TYPE_MCONTROL6 instead of number 6YenHaoChen1-1/+1
2023-01-27Remove dirty_enabled from cfg_tAaron Durbin2-5/+0
The addition of Svadu support and removal of --mmu-dirty command line flag results in the dirty_enabled configuration state no longer being used. Remove the remnants of this state.
2023-01-27Use Svadu control bits to drive A/D updatesAaron Durbin1-2/+4
The Svadu (https://github.com/riscv/riscv-svadu) extension updates the A/D bits of PTEs: 1. In S/HS mode when menvcfg.hade=1 2. In G-stage page tables when menvcfg.hade=1 3. In VS mode when henvcfg.hade=1 To enable this behavior the 'svadu' ISA string is needed. This newly added behavior supplants the --mmu-dirty flag. However, that flag is not yet removed.
2023-01-27Enable Svadu control bits in menvcfg and henvcfgAaron Durbin2-1/+4
Add in the support for the HADE fields in menvcfg and henvcfg based off of the svadu ISA string. This only allows for the writable HADE bits being exposed when the svadu ISA string is employed. No other behavior is implemented.
2023-01-27Add Svadu CSR bit definitionsAaron Durbin1-2/+6
The Svadu extension adds a HADE field (bit 61) to both menvcfg and henvcfg. Add the definitions so they can be utilized.
2023-01-27Add Svadu Extension Parsing to ISA ParserAaron Durbin2-0/+3
Make the ISA parser understand the Svadu extension.
2023-01-19Improve PMP number/granularity error messagesAndrew Waterman1-3/+4
2023-01-19Perform pmpregions input validation in only one placeAndrew Waterman1-14/+4
No reason to check it both in sim_t::sim_t and in processor_t::set_pmp_num.
2023-01-19Support all 64 PMP registersAndrew Waterman1-1/+1
2023-01-18Instantiate tdata/tinfo as const csrs when trigger_count == 0Jerry Zhao3-8/+12
2023-01-18Add trigger_count field to cfg_tJerry Zhao2-3/+6
2023-01-13Simplify isa_parser_t::extension_enabledAndrew Waterman1-4/+1
Now that we guarantee that max_isa and extension_table are synchronized, we only need to check the latter.
2023-01-13Keep max_isa and extension_table in sync in exactly one placeAndrew Waterman1-22/+18
This fixes a bug where --isa=rv64imafdc would fail to set extension_table['F'] because of the ad hoc manner in which we were synchronizing max_isa and extension_table.
2023-01-13Use more appropriate data structure for extension_tableAndrew Waterman2-3/+2
We know its size at compile time.
2023-01-13Lift artificial limit of 191 extensionsAndrew Waterman3-1/+11
Add new accessors that accept the isa_extension_t enum. Retain the original ones that accept unsigned char to avoid churn.
2023-01-13Merge pull request #1214 from YenHaoChen/pr-legalize-timingScott Johnson2-16/+22
Add legalize_timing() for tdata1.timing
2023-01-13triggers: refactor: use static and remove const for legalize_action()YenHaoChen2-2/+2
Since this method does not use 'this', we turn this method into static.
2023-01-13triggers: refactor: use static and remove const for legalize_match()YenHaoChen2-2/+2
Since this method no longer use 'this', we turn this method into static.
2023-01-13triggers: refactor: remove legalization_action()'s dependency on dmodeYenHaoChen2-7/+8
avoid breaking functionality by reordering statements in tdata1.write()
2023-01-13triggers: legalize timing=1(after) for load data triggerYenHaoChen2-4/+7
As recommended in the debug spec table "Suggested Trigger Timings", to avoid the footgun of replaying a load (which may have side effects) when the breakpoint trap handler returns. reference: https://github.com/riscv-software-src/riscv-isa-sim/pull/1208#issuecomment-1373035906 ----------------------------------------------------------------------- The legalize_timing() depends on select, execution, load, and store, which are updated in the same function tdata1_write(). As a result, reordering statements in the tdata1_write() may break the functionality. Passing those variables as parameters to legalize_timing() does not solve the problem. Thus, we give the original write value and the masks of the variables to the legalize_timing(). This makes the legalization function independent of the updating variables and resolves the issue. reference: https://github.com/riscv-software-src/riscv-isa-sim/pull/1214
2023-01-12Merge pull request #1225 from riscv-software-src/no-threadsAndrew Waterman2-31/+14
Run Spike and HTIF in a single thread, rather than two
2023-01-12triggers: refactor: remove an outdated commentYenHaoChen1-1/+0
2023-01-12triggers: refactor: add mcontrol_common_t::legalize_timing() functionYenHaoChen2-6/+9
2023-01-11Run Spike and HTIF in a single thread, rather than twoAndrew Waterman2-31/+14
The two-thread approach was originally motivated by making Spike look as similar as possible to other HTIF targets. But we can get the same semantics without threading by running the simulator inside of the HTIF host's idle loop instead of performing a context switch. This was motivated by speeding up the simulator on Mac OS (it's worth around 20% because using pthread condition variables to force strict alternation is very slow). But I think it also simplifies the control flow enough to justify it on that basis, too.
2023-01-11For NS16550 UART, poll stdin less oftenAndrew Waterman2-1/+12
On my Mac Mini, calling `poll()` on stdin takes around 10 us, and we are invoking it every 20 us or so. Reduce the frequency of polling by 16x when not actively receiving data, thereby reducing the fraction of time spent in `poll()` to a trivial amount.
2023-01-10change mem_cfg_t to accept cases when (base + size) is at 64-bit address ↵Parshintsev Anatoly1-1/+5
space border
2023-01-09get_inclusive_end implementation for mem_cfg_tParshintsev Anatoly1-0/+4
The method can simplify proper processing of sitiations when (base + size) overflows 64-bit interger.
2023-01-09implement get_size() getter for mem_cfg_t objectParshintsev Anatoly1-0/+5
NFT. We also mark `base` and `size` fields as private.
2023-01-09implement get_base() getter for mem_cfg_t objectParshintsev Anatoly1-0/+4
NFC. The intention is for `base` and `size` fields of mem_cfg_t to be private members. This is the fist part of this commit.
2023-01-05Remove vestigial UNUSED annotationAndrew Waterman1-1/+1
It dates back to when this code was ifdef'd.
2023-01-05Only update histogram when histogrammingAndrew Waterman1-1/+2
This is worth a 1.4x speedup on the slow path (when not histogramming).
2023-01-04Remove --enable-dirty compile optionJerry Zhao1-5/+0
2023-01-04Respect --mmu-dirty flag instead of --enable-dirtyJerry Zhao2-24/+19
2023-01-04Add cfg_t field to enable PTE dirtyingJerry Zhao1-0/+3