Sim_t - Gink3/riscv-isa-sim GitHub Wiki
The files contain the following data structures (with descriptions):
- class sim_t - "Driver" of the program that launches all the necessary things, and handles coordinating multiple processors
- vector<processor_t*> procs - vector of pointers to all instantiated processors
- bool histogram_enabled - Enables the PC histogram to be logged and printed by spike
- bool debug - enables debug mode
- bool log - enables saving to a log file
- const size_t INTERLEAVE - Size of memory block
- const size_t INSNS_PER_RTC_TICK - Instructions per Real Time Clock tick
- const size_t CPU_HZ - CPU clock speed
Functions are all member functions of the sim_t class, which inherits publicly from htif_t and simif_t
Argument list:
- const char* isa - string specifying the Instruction Set Architecture
- const char* priv - string specifying the privileges
- const char* varch - string specifying the Virtual Architecture
- size_t _nprocs - number of processors
- bool halted
- bool real_time_clint
- reg_t initrd_start
- reg_t initrd_end
- const char* bootargs
- reg_t start_pc
- std::vector<std::pair<reg_t, mem_t*>> mems
- std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices
- const std::vectorstd::string& args
- const std::vector hartids
- const debug_module_config_t &dm_config
- const char *log_path
- bool dtb_enabled
- const char *dtb_file
- Sets debug outputs to stderr
- Adds all necessary devices to the bus
- Instantiates procs vector with processor_t objects
- Runs make_dtb() - Elaborate later
- Adds clint devices to the bus - Elaborate later
- Sets per core attributes
- Handles pmp -- Elaborate later
- Instantiates requested type of memory
- Validates number of processors.
No arguments
Deallocates all processors and debug memory port.
No arguments
Argument list:
- size_t n
- Calculates position to step to
- Oscillates through all processors in processor vector, and runs step function for each proc
- Iterates and keeps going
No arguments
Redirects ^C signal to enter debug mode on first press, and exit on second.
No arguments
- Loops infinitely until processor is done
- Enters interactive mode if ^C is pressed or debug mode enabled
- Calls step function defined above
No arguments In interactive.cc
- Defines a map of function pointers to map interactive commands to necessary functions
- Reads in commands and calls functions until interactive is exited with "r" command