aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.h
AgeCommit message (Collapse)AuthorFilesLines
2022-10-17Merge branch 'master' into plic_uart_v1plic_uart_v1Andrew Waterman1-1/+4
2022-10-16Add interactive mode commands to read clint mtime/mtimecmpJerry Zhao1-0/+2
2022-10-14Add dump memory command to interactive modeJerry Zhao1-0/+1
2022-08-04 Add support for freg command to read X regs when enable Zfinxliweiwei1-1/+1
Update README
2022-04-20Add ns16550 serial device emulationAnup Patel1-0/+1
The ns16550 is a widely use serial device so we add a simplified ns16550 device emulation which is good enough for Linux, OpenSBI, and hypervisors to use as console. Signed-off-by: Anup Patel <anup@brainfault.org>
2022-04-20Add PLIC emulationAnup Patel1-0/+1
We need an interrupt controller in Spike which will allow us to emulate more real-world devices such as UART, VirtIO net, VirtIO block, etc. The RISC-V PLIC (or SiFive PLIC) is the commonly used interrupt controller in existing RISC-V platforms so this patch adds PLIC emulation for Spike. Signed-off-by: Anup Patel <anup@brainfault.org>
2022-04-12Move real_time_clint into cfg_tRupert Swarbrick1-1/+1
2022-04-12Move varch into cfg_tRupert Swarbrick1-1/+1
2022-04-12Move hartids into cfg_tRupert Swarbrick1-1/+1
The only slightly difficult thing here is that hartids will always be considered "overridden" by the time we get to sim_t::sim_t (either overridden by a command line argument, or overridden when we set default hartids just before the constructor). To allow downstream code to distinguish between "I picked IDs 0, 1, 2, 3 because the user asked for 4 processors" and "The user explicitly asked for IDs 0, 1, 2, 3", we have an extra explicit_hartids field.
2022-04-12Move start_pc into cfg_tRupert Swarbrick1-2/+1
2022-03-18Fold priv parameter into cfg_tRupert Swarbrick1-2/+1
2022-03-18Fold isa parameter into cfg_tRupert Swarbrick1-2/+1
2022-03-18Fold nprocs parameter into cfg_tRupert Swarbrick1-1/+1
2022-03-18Fold bootargs parameter in the new cfg_t typeRupert Swarbrick1-2/+1
2022-03-18Initial step towards factoring out command line configurationRupert Swarbrick1-5/+6
This commit defines a "cfg_t" structure, which currently just holds the initrd address range. It will be augmented in future commits to hold other configuration arguments as well. To represent a configuration argument, we define an arg_t base class. This holds a current value, together with a flag that tells us whether the value has been updated from the default. The idea is that in future we're going to use that flag when reading a DTB file: if an argument has actually been specified on the command line, we need to take it into account; if not, we can ignore the default and use the DTB file's supplied value.
2022-03-12Construct an isa_parser_t and pass it to processor_t constructorRupert Swarbrick1-0/+1
This is a minor change, turning processor_t from a child class of isa_parser_t into a class that contains an isa_parser_t as a field. The point is that it is a step toward separating out "configuration" (and ISA string parsing) from processor state. This should be helpful for rejigging things so that we construct more from a supplied device tree.
2021-09-17Fix memory leakAndrew Waterman1-1/+1
2021-09-17Don't use "using"Andrew Waterman1-20/+6
2021-09-17Use RIAA pattern in manipulating ostream flagsAndrew Waterman1-1/+1
sout is renamed to sout_ to reduce likelihood programmers accidentally use it.
2021-09-14add option --cmd to read commands from file (#772)Elmar Melcher1-3/+5
2021-08-03declare socket properties in sim_tElmar Melcher1-1/+37
2020-11-07Implement support for big-endian targetsMarcus Comstedt1-0/+2
2020-09-29Adding symbol lookup when --enable-commitlog is enabled (#558)sthiruva1-0/+2
* Adding symbol lookup when --enable-commitlog is enabled * Removed the #ifdef RISCV_ENABLE_COMMITLOG for all get_symbol related function Only retained the in processor.cc where it is called. Co-authored-by: Shajid Thiruvathodi <sthiruva@valtrix.in>
2020-07-09Add bootargs command-line option to SpikeAnup Patel1-1/+2
We add bootargs command-line option to Spike which allows us to provide custom kernel parameters to Linux and Xvisor. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2020-06-16zfh: support register dump in interactive modeChih-Min Chao1-0/+1
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-04-27fdt: restructure dtb create and config flowChih-Min Chao1-9/+5
1. pass dtb option from constructor 2. separate dtb generation from rom initialization 3. setup clint base from dtb Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-04-27fdt: option: add --dtb option to specify dtb binary fileChih-Min Chao1-0/+5
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2020-03-27Write execution logs to a named log file (#409)Rupert Swarbrick1-7/+16
This patch adds a --log argument to spike. If not given, the behaviour is unchanged: messages logging execution of instructions and (if commit logging is enabled) commits go to stderr. If --log=P is given, Spike now writes these messages to a log file at the path P. This is nice, because they are no longer tangled up with other errors and warnings. The code is mostly plumbing: passing a FILE* object through to the functions that were using stderr. I've written a simple "log_file_t" class, which opens a log file if necessary and yields it or stderr.
2020-02-15Add optional support for real-time clintAnup Patel1-1/+2
This patch adds optional support clint timer incrementing at real-time rate. This can be enabled by passing command line parameter "--real-time-clint". This feature can be used for: 1. Checking whether any code addition to Spike is slowing down simulation too much 2. Comparing run-time for software on Spike with other functional simulators (such as QEMU) Signed-off-by: Anup Patel <anup.patel@wdc.com>
2020-02-14Make spike capable of booting LinuxAnup Patel1-1/+3
Latest Linux does not boot Spike mainly because: 1. Spike does not set bootargs in DTS 2. Spike does not provide mechanism to load initrd for Linux This patch addresses both above issues and we can now get latest Linux to prompt on Spike. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-11-12Add --priv option to control which privilege modes are availableAndrew Waterman1-1/+2
2019-09-18Adds --log-commits commandline option. (#323)dave-estes-syzexion1-0/+2
* Adds --log-commits commandline option. Similar to histogram support, the commit logging feature must be enabled with a configure option: --enable-commitlog. However, unlike that feature, there was no way to turn off the logging with a commandline option once the functionality was built in. This (git) commit provides that abilty. * Changes addressing review feedback.
2019-07-22Implement MMIO device plugins.Aaron Jones1-0/+2
2019-06-18rvv: extend interactive debugChih-Min Chao1-0/+1
add command to show vector register in debug mode Signed-off-by: Bruce Hoult <bruce@hoult.org>
2019-06-14rvv: add varch option parser and initialize vector unitChih-Min Chao1-2/+2
the default vector parameters are defined in configuration time but can be changed throught command-line option Signed-off-by: Dave Wen <dave.wen@sifive.com>
2019-05-14Clean up debug module options. (#299)Tim Newsome1-3/+1
* Clean up debug module options. 1. Instead of passing each one a few levels deep, create debug_module_config_t which contains them all. 2. Rename all those command line options so they start with --dm for debug module. 3. Add --dm-no-halt-groups to disable halt group support. * Update changelog.
2019-04-04Add --debug-no-abstract-csr (#267)Tim Newsome1-1/+1
This is used to make sure that OpenOCD can work on targets that don't support abstract access to CSR registers. It replaces a simpler hack, which caused #266.
2019-04-02Implement debug hasel support (#287)Tim Newsome1-1/+2
* Implement hasel/hawindow support. This should allow simultaneous resume and halt to work. * Fix anyrunning/anyhalted bits. * Add --without-hasel argument for testing. * Make halt/resume times more equal. Switching threads after every instruction executed in debug mode leads to a lot of extra instructions being executed on the "other" thread when both are really supposed to halt/resume near-simultaneously. Fixed that by adding wfi to debug_rom.S, and implementing it to switch to the other hart as well as check for JTAG input. When resuming, write the hart ID to the debug ROM so that the DM knows which hart actually resumed. (Before simultaneous resume it just assumed the current one.) Also got rid of resume symbol in debug_rom.S since it had no purpose. * Preserve Debug ROM entry points. * Make sure minstret is correct when wfi happens.
2019-03-12include sys/types.h for suseconds_t (#285)nmeum1-0/+1
This fixes the build on Alpine Linux (which uses musl libc).
2018-12-13Add --dmi-rti and --abstract-rti to test OpenOCD.Tim Newsome1-1/+2
Optionally make spike behave more like real hardware, to automatically test OpenOCD's handling of such hardware.
2018-10-18Provide a noisy until interactive commandHesham Almatary1-1/+3
This is useful for example when the trace until a PC value needs to be extracted (#246)
2018-08-23Add --disable-dtb option to suppress writing the DTB to memoryAndrew Waterman1-0/+4
2018-05-31Put simif_t declaration in its own file. (#209)Andy Wright1-13/+1
By separating the simif_t declaration from the sim_t declaration, the simif_t declaration no longer depends on fesvr header files. This simplifies compilation of custom sim class implementations that don't depend on fesvr.
2018-03-16Implement debug havereset bitsTim Newsome1-0/+5
2018-03-07Merge pull request #177 from riscv/debug_authTim Newsome1-1/+1
Add debug module authentication.
2018-03-06Narrow the interface used by the processors and memory to the top-level ↵Prashanth Mundkur1-1/+12
simulator/htif. This allows the implementation of an alternative top-level simulator class.
2018-02-27Add debug module authentication.Tim Newsome1-1/+1
Off by default, enabled with --debug-auth. The protocol is very simple (definitely not secure) to allow debuggers to test their authentication feature. To authenticate a debugger must: 1. Read authdata 2. Write to authdata the value that it just read, plus 1
2018-02-01Add --debug-sba optionTim Newsome1-1/+1
This lets the user control whether the system bus access implements bus mastering.
2018-01-18Support debug system bus access.Tim Newsome1-2/+7
2017-12-11Make progbuf a run-time option.Tim Newsome1-1/+2
Also add an implicit ebreak after the program buffer. This is not part of the spec, but hopefully it will be.