aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.h
AgeCommit message (Collapse)AuthorFilesLines
2024-04-30Support per-device arguments and device factory reuseLIU Yu1-1/+4
As proposed in #1652, we made the following changes to MMIO device (factory) plugin API, to mitigate current limitations and facilitate factory reuse. - removed `sargs` from `device_factory_t`, and introduced a new type alias `device_factory_sargs_t` to capture `<device_factory_t *, sargs>` pairs, this is used to instantiate sim_t instances; - changed the signature of `device_factory_t::generate_fdt` and `device_factory_t::parse_from_fdt` to take on an extra `sargs` argument, for instantiating devices with per-device arguments; - made `device_factory_t` const and potentially resuable across multiple `sim_t` instances.
2023-12-08Fix Spike --device option to pass on args to downstream pluginsjoey03201-1/+1
2023-07-20Introduce `abstract_mem_t` to allow custom implementationsMichal Terepeta1-2/+2
This change allows to create custom implementations of `abstract_mem_t` and inject them when constructing `sim_t`. The current `mem_t` implementation remains unchanged. Fixes #1408.
2023-07-02sim_t: Add sim_t::add_device() APIJerry Zhao1-0/+1
This is public so libspike users can precisely configure the device bus without going through the DTS interface
2023-06-20devices: Switch plugin device interface to use device_factory_tJerry Zhao1-1/+1
Plugins should now implement and register a device_factory_t to configure how that device should be parsed from a FDT, and an optional default DTS string. This drops support for command-line flag-based device configuration
2023-06-20sim_t: Add sim_t::get_intctrlJerry Zhao1-0/+1
2023-06-20Inline make_dtb into sim_t constructorJerry Zhao1-1/+0
make_dtb is only called here, this simplifies later work towards refactoring device DTS node generation
2023-06-20sim_t: Make static consts public membersJerry Zhao1-3/+4
2023-06-20sim_t: Merge sim_t::plugin_devices with sim_t::devicesJerry Zhao1-1/+0
2023-06-20sim_t: change plugin_devices to a vec of shared_ptrsJerry Zhao1-2/+2
2023-06-20sim_t: Remove boot_rom/ns16550 members of sim_tJerry Zhao1-2/+0
These are redundant with sim_t::devices
2023-06-20sim_t: Add list of ptrs to devices to sim_tJerry Zhao1-0/+1
2023-06-20sim_t: change devices to shared_ptrsJerry Zhao1-4/+4
2023-03-09Move debug_mmu used by debug_module up to simif_tScott Johnson1-2/+0
2023-03-09Move methods used by debug_module/clint/plic up to simif_tScott Johnson1-3/+2
So we can soon convert those classes to use simif_t instead of sim_t.
2023-03-08Add virtual/override to sim_t declarationsScott Johnson1-12/+12
To be explicit about which methods of simif_t and htif_t we implement.
2023-02-28Merge pull request #1246 from riscv-software-src/hartidsAndrew Waterman1-0/+5
Support discontiguous hart IDs in debug module
2023-02-27Add sim_t::get_harts and sim_t::get_cfg accessorsAndrew Waterman1-0/+5
2023-02-27Add ability to partially complete and resume interactive routinesAndrew Waterman1-0/+1
This facility will allow interactive routines to loop without starving the HTIF.
2023-02-06Don't reset sim_t if there is no dts for get_dtsJerry Zhao1-1/+1
Before 3b26740, the reset was necessary because sim_t::get_dts would be called before sim_t::make_dtb was called in reset(). This is no longer necessary since now `make_dtb` is called in the constructor of sim_t
2023-02-06Pass dtb_file directly to make_dtbJerry Zhao1-2/+1
2023-01-11Run Spike and HTIF in a single thread, rather than twoAndrew Waterman1-6/+0
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-03Specify addresses are physical for simif_t member functionsJerry Zhao1-4/+4
2022-12-20Always build with commit logging supportJerry Zhao1-3/+1
2022-12-16Remove processor.h/sim.h -> config.h dependenciesJerry Zhao1-1/+0
2022-12-15Rename memif_endianness_t to endianness_tJerry Zhao1-1/+1
2022-12-13Move boost asio socket interface to socketif_tJerry Zhao1-18/+3
This reduces dependencies on config.h in sim.h
2022-10-25Remove set_target_endianness | add --big-endian flagJerry Zhao1-1/+0
Set target endianess in constructors
2022-10-17Add command to display privilege level in interactive modeJerry Zhao1-0/+1
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