processor.risc_v.internal.core ≡
This is internal implementation of RISC-V processor core. Use
definitions from processor.risc_v module instead.
enum Trap : uint3 §source
System trap/exception identifier
Values
-
InvalidInstructionAddress = 0 §source
Program counter moved to address outside specified instruction memory address space.
-
AccessFault = 1 §source
Memory access to address outside of data memory and memory mapped IO address spaces.
-
IllegalInstruction = 2 §source
Invalid or illegal instruction was decoded.
-
ECALL = 4 §source
ECALL instruction was executed.
-
EBREAK = 5 §source
EBREAK instruction was executed.
enum Optimize : uint1 §source
Optimization configuration bits
template < auto HARTS, auto IMEM_LENGTH, auto DMEM_LENGTH, auto MMIO_LENGTH = 0, auto IMEM_ORIGIN = 0, auto DMEM_ORIGIN = ((IMEM_ORIGIN + IMEM_LENGTH) << 2), auto MMIO_ORIGIN = (DMEM_ORIGIN + DMEM_LENGTH), auto IMEM_TCM_SIZE = IMEM_LENGTH, template <typename, auto> typename DataMemory = memory_norep, auto EXTENSIONS = Extension::None, auto CONFIG = Optimize::Area, Base ISA = Base::RV32I, auto BTB_SIZE = 1024, template <typename, auto> typename InstrMemory = memory_init > class Core §source
Aliases
-
using imem_addr_t = index_t<IMEM_LENGTH> §source
Address of 32-bit word in instruction memory.
-
using dmem_addr_t = index_t<DMEM_LENGTH> §source
Address of byte in data memory.
-
using int_t = Types<ISA>::int_t §source
Signed, XLEN bits wide integer.
-
using uint_t = Types<ISA>::uint_t §source
Unsigned, XLEN bits wide integer.
-
using hart_index_t = index_t<HARTS> §source
Index of hardware thread (hart).
-
using system_trap_t = ( Core::hart_index_t hid, Trap trap, Core::imem_addr_t addr ) -> optional<Core::imem_addr_t> §source
Type of callback to handle system exceptions and traps.
Arguments
-
Core::hart_index_t hid
Identifier of the hart that triggered the exception or trap.
-
Trap trap
Trap kind.
-
Core::imem_addr_t addr
32-bit word based instruction address.
-
-
using trace_t = ( Core::hart_index_t hid, Core::imem_addr_t addr, Core::uint_t inst, Decoded decoded, optional<Core::int_t> value ) -> void §source
Type of dynamic instruction trace callback.
Arguments
-
Core::hart_index_t hid
Identifier of the hart executing the instruction.
-
Core::imem_addr_t addr
Address of 32-bit instruction word.
-
Core::uint_t inst
Instruction word.
-
Decoded decoded
Decoded instruction.
-
optional<Core::int_t> value
If valid specifies value written by instruction to destination register specified by
decoded.format.rd.
-
-
using mmio_access_t = ( Core::hart_index_t hid, Core::uint_t load_addr, Core::uint_t store_addr, MemorySize size, bool sign_extend, optional<Core::int_t> value ) -> optional<Core::int_t> §source
Type of callback to handle memory mapped IO access. If the access operation completes immediately, the
is_validof the returned result should be set to true. For load access thevalueof the returned result is the result of the load. For store access thevalueof the returned result is ignored. If the operation will complete asynchronously theis_validof the returned result should be set to false, and execution environment should indicate completion of load/store by calling themmio_load_resultormmio_store_completedmethod respectively.Arguments
-
Core::hart_index_t hid
Identifier of the hart executing the load.
-
Core::uint_t load_addr
Memory mapped IO address used for load MMIO access.
-
Core::uint_t store_addr
Memory mapped IO address used for store MMIO access.
-
MemorySize size
Size of MMIO access.
-
bool sign_extend
Boolean flag specifying if sub-word load should be sign-extended.
-
optional<Core::int_t> value
Value to be stored, valid for store MMIO access
-
-
using mmio_load_t = ( Core::hart_index_t hid, Core::uint_t addr, MemorySize size, bool sign_extend ) -> optional<Core::int_t> §source
Type of callback to handle load from memory mapped IO. The load result may be returned immediately, by setting
is_validof the callback return value to true, or asynchronously, by callingmmio_load_resultmethod after the callback returns.Arguments
-
Core::hart_index_t hid
Identifier of the hart executing the load.
-
Core::uint_t addr
Memory mapped IO address to load from.
-
MemorySize size
Size of load.
-
bool sign_extend
Boolean flag specifying if sub-word load should be sign-extended.
-
-
using mmio_store_t = ( Core::hart_index_t hid, Core::uint_t addr, MemorySize size, Core::int_t value ) -> bool §source
Type of callback to handle store to memory mapped IO. The callback should return
trueif the program running on the core can consider the store as committed, orfalseif the store should be considered as pending. In the latter case, the hart that made the request is stalled until the execution environment indicates the store as completed by calling themmio_store_completedmethod.Arguments
-
Core::hart_index_t hid
Identifier of the hart executing the store.
-
Core::uint_t addr
Memory mapped IO address to store to.
-
MemorySize size
Size of data to store.
-
Core::int_t value
Value to be stored.
-
-
using external_fetch_t = ( Core::hart_index_t hid, Core::imem_addr_t addr ) -> optional<Core::uint_t> §source
Type of external instruction fetch handler.
Arguments
-
Core::hart_index_t hid
Identifier of the hart performing the instruction fetch.
-
Core::imem_addr_t addr
32-bit word address of instruction to fetch.
-
-
using custom_decode_t = (RVG major_opcode) -> Format §source
Type of callback of custom instruction decode handler.
Arguments
-
RVG major_opcode
Major opcode of the instruction.
-
-
using custom_execute_t = ( Core::hart_index_t hid, RVG major_opcode, Funct3 minor_opcode, Core::int_t op1, Core::int_t op2, Core::int_t imm, Funct7 funct7 ) -> Core::int_t §source
Type of callback to execute custom instruction
Arguments
-
Core::hart_index_t hid
Identifier of the hart executing the instruction.
-
RVG major_opcode
Major opcode of the instruction.
-
Funct3 minor_opcode
Minor opcode of the instruction (undefined for instructions using format
UorJ). -
Core::int_t op1
First operand. Contains value of source register 1 (undefined for instructions using format
UorJ). -
Core::int_t op2
Second operand. Contains value of source register 2 for formats that specify it, or an immediate otherwise.
-
Core::int_t imm
Immediate (undefined for instructions using
Rformat) -
Funct7 funct7
funct7 field of decoded instructions using
Rformat, undefined otherwise.
-
Methods
-
inline void pipeline() §source
-
inline void initialize(Core::uint_t[HARTS] pc) §source
-
inline void mmio_store_completed(Core::hart_index_t hid) §source
-
inline void mmio_load_result(Core::hart_index_t hid, Core::int_t value) §source
-
inline void external_fetch_result( Core::hart_index_t hid, Core::imem_addr_t addr, Core::uint_t instr ) §source
-
inline Core::Current fetch() §source
-
inline Decoded decode(Core::Current current) §source
-
inline Core::Operands read(Core::Current current, Decoded decoded) §source
-
inline Core::int_t load(Core::Current current, Decoded decoded, Core::uint_t addr) §source
-
inline Core::int_t multiply(Decoded decoded, Core::Operands in) §source
-
inline Core::Results execute( Core::Current current, Decoded decoded, Core::Operands in, Core::int_t custom_result ) §source
-
inline void store( Core::Current current, Decoded decoded, Core::Operands in, Core::Results results ) §source
-
inline Core::int_t write( Core::Current current, Decoded decoded, Core::int_t loaded, Core::Results results ) §source
-
inline auto dmem_read(Core::hart_index_t hid, Core::dmem_addr_t addr) §source
-
inline void dmem_write( Core::hart_index_t hid, Core::dmem_addr_t addr, Core::int_t value, Core::dmem_t::byte_count_t size ) §source
-
inline Core::int_t dmem_read_aligned(Core::hart_index_t hid, Core::dmem_addr_t addr) §source
-
inline void dmem_write_aligned( Core::hart_index_t hid, Core::dmem_addr_t addr, Core::int_t value ) §source
-
inline void imem_write(Core::imem_addr_t addr, Core::uint_t value) §source
-
inline auto register_get(Core::hart_index_t hid, Core::register_index_t reg) §source
-
inline void register_set( Core::hart_index_t hid, Core::register_index_t reg, Core::int_t value ) §source
-
inline auto default_system_trap( Core::hart_index_t hid, Trap trap, Core::imem_addr_t pc ) §source
-
inline void default_trace( Core::hart_index_t hid, Core::imem_addr_t addr, Core::uint_t inst, Decoded decoded, optional<Core::int_t> value ) §source
-
inline optional<Core::int_t> default_mmio_access( Core::hart_index_t hid, Core::uint_t load_addr, Core::uint_t store_addr, MemorySize size, bool sign_extend, optional<Core::int_t> value ) §source
-
inline optional<Core::int_t> default_mmio_load( Core::hart_index_t hid, Core::uint_t addr, MemorySize size, bool sign_extend ) §source
-
inline bool default_mmio_store( Core::hart_index_t hid, Core::uint_t addr, MemorySize size, Core::int_t value ) §source
-
inline optional<Core::uint_t> default_external_fetch(Core::hart_index_t hid, Core::imem_addr_t addr) §source
-
inline Format default_custom_decode(RVG major_opcode) §source
-
inline Core::int_t default_custom_execute( Core::hart_index_t hid, RVG major_opcode, Funct3 minor_opcode, Core::int_t op1, Core::int_t op2, Core::int_t imm, Funct7 funct7 ) §source