#include <hart.hpp>
class HartDefined in include/hart.hpp:39
RISC-V CPU Core.
| Name | Kind | Owner |
|---|---|---|
Hart |
function |
Declared here |
~Hart |
function |
Declared here |
get_effective_mode |
function |
Declared here |
get_mmio |
function |
Declared here |
get_mmap |
function |
Declared here |
get_reservation |
function |
Declared here |
get_mmu |
function |
Declared here |
clear_decode_cache |
function |
Declared here |
get_memsize |
function |
Declared here |
amo_check_reservation |
function |
Declared here |
csr_read |
function |
Declared here |
csr_write |
function |
Declared here |
trap |
function |
Declared here |
PrivilegeMode |
enum |
Declared here |
run_blocks |
function |
Declared here |
| Return | Name | Description |
|---|---|---|
Hart |
Hart constructor. | |
~Hart inline |
Hart destructor. | |
PrivilegeMode |
get_effective_mode const inline |
Returns CPU Effective mode for a specific memory access. |
MMIO * |
get_mmio inline |
Returns MMIO pointer. |
MemoryMap * |
get_mmap inline |
Returns MemoryMap pointer. |
Reservation & |
get_reservation inline |
Returns CPU Atomic Reservation. |
MMU & |
get_mmu inline |
Returns CPU Memory Management Unit. |
void |
clear_decode_cache inline |
Clears Instruction Decoder Cache. |
constuint64_t |
get_memsize const inline |
Returns RAM size. |
void |
amo_check_reservation inline |
Clears reservation if defined address is within CPU reservation address. |
uint64_t |
csr_read |
Returns value stored in CSR. |
void |
csr_write |
Stores value to CSR. |
void |
trap |
CPU Trap function. |
Hart(uint8_t id, uint64_t memsize)Defined in include/hart.hpp:71
Hart constructor.
Creates RISC-V core
Note
It must be equal with memory size defined in machine config.
| Parameter | Type | Description |
|---|---|---|
id |
uint8_t |
Internal Hart ID (starts from 0) |
memsize |
uint64_t |
Memory size |
inline
inline ~Hart()Defined in include/hart.hpp:78
Hart destructor.
Destroys RISC-V core
const inline
inline PrivilegeMode get_effective_mode(AccessType access_type) constDefined in include/hart.hpp:138
Returns CPU Effective mode for a specific memory access.
Effective mode corresponds to MPRV bit in mstatus: 1 - MPP (only for LOAD/STORE), 0 - current mode
Effective mode
See also: PrivilegeMode
inline
inline MMIO * get_mmio()Defined in include/hart.hpp:151
Returns MMIO pointer.
See also: MMIO
MMIO Pointer
inline
inline MemoryMap * get_mmap()Defined in include/hart.hpp:157
Returns MemoryMap pointer.
See also: MemoryMap
MemoryMap pointer
inline
inline Reservation & get_reservation()Defined in include/hart.hpp:163
Returns CPU Atomic Reservation.
See also: Reservation
Reservation reference object
inline
inline MMU & get_mmu()Defined in include/hart.hpp:169
Returns CPU Memory Management Unit.
See also: MMU
MMU reference
inline
inline void clear_decode_cache()Defined in include/hart.hpp:173
Clears Instruction Decoder Cache.
const inline
inline constuint64_t get_memsize() constDefined in include/hart.hpp:187
Returns RAM size.
Memory size in bytes
inline
inline void amo_check_reservation(uint64_t pa)Defined in include/hart.hpp:192
Clears reservation if defined address is within CPU reservation address.
uint64_t csr_read(uint16_t csr)Defined in include/hart.hpp:204
Returns value stored in CSR.
CSR value
| Parameter | Type | Description |
|---|---|---|
csr |
uint16_t |
CSR address |
void csr_write(uint16_t csr, uint64_t val)Defined in include/hart.hpp:210
Stores value to CSR.
| Parameter | Type | Description |
|---|---|---|
csr |
uint16_t |
CSR address |
val |
uint64_t |
Value |
void trap(uint64_t cause, uint64_t tval, bool interrupt)Defined in include/hart.hpp:219
CPU Trap function.
Raises trap in CPU core.
| Parameter | Type | Description |
|---|---|---|
cause |
uint64_t |
Trap cause |
tval |
uint64_t |
Trap value (can be zero) |
interrupt |
bool |
Is trap will be interrupt(true) of exception(false)? |
| Name | Description |
|---|---|
PrivilegeMode |
CPU PrivilegeMode. |
enum PrivilegeModeDefined in include/hart.hpp:46
CPU PrivilegeMode.
Current CPU privilege mode.
| Value | Description |
|---|---|
User |
|
Supervisor |
|
Hypervisor |
|
Machine |
| Return | Name | Description |
|---|---|---|
uint64_t |
run_blocks |
Block-chaining fast path (lightweight JIT). |
uint64_t run_blocks(BlockCache & bc, uint64_t max_insts)Defined in include/hart.hpp:247
Block-chaining fast path (lightweight JIT).
Runs precompiled straight-line blocks of the guest code, bypassing the per-instruction decode probe and MMU translate. Returns the number of instructions executed.
See also: BlockCache