Documentation ¶
Index ¶
- Constants
- func DisplaySATP(s *State) string
- func Name(reg uint) string
- type ECode
- type Error
- type ICode
- type Mode
- type State
- func (s *State) Display() string
- func (s *State) ECALL(epc uint64, val uint) uint64
- func (s *State) Exception(epc uint64, code, val uint, isInterrupt bool) uint64
- func (s *State) GetMPP() Mode
- func (s *State) GetMPRV() bool
- func (s *State) GetMXR() bool
- func (s *State) GetMode() Mode
- func (s *State) GetPPN() uint
- func (s *State) GetSUM() bool
- func (s *State) GetVM() VM
- func (s *State) IncClockCycles(n uint)
- func (s *State) IncInstructions()
- func (s *State) IsFloatOff() bool
- func (s *State) MRET() uint
- func (s *State) Rd(reg uint) (uint64, error)
- func (s *State) Reset()
- func (s *State) SRET() uint
- func (s *State) URET() uint
- func (s *State) Wr(reg uint, val uint64) error
- type VM
Constants ¶
View Source
const ( ErrTodo = 1 << iota // csr not implemented ErrPrivilege // insufficient privilege ErrReadOnly // trying to write a read-only register ErrNoRead // no read function (todo) ErrNoWrite // no write function (todo) )
CSR error bits.
View Source
const ( FFLAGS = 0x001 FRM = 0x002 FCSR = 0x003 SSTATUS = 0x100 SEDELEG = 0x102 SIDELEG = 0x103 MSTATUS = 0x300 MEDELEG = 0x302 MIDELEG = 0x303 MTVEC = 0x305 MEPC = 0x341 MCAUSE = 0x342 MTVAL = 0x343 )
Register numbers for specific CSRs.
View Source
const ( IsaExtA = (1 << iota) // Atomic extension IsaExtB // Tentatively reserved for Bit-Manipulation extension IsaExtC // Compressed extension IsaExtD // Double-precision floating-point extension IsaExtE // RV32E base ISA IsaExtF // Single-precision floating-point extension IsaExtG // Additional standard extensions present IsaExtH // Hypervisor extension IsaExtI // RV32I/64I/128I base ISA IsaExtJ // Tentatively reserved for Dynamically Translated Languages extension IsaExtK // Reserved IsaExtL // Tentatively reserved for Decimal Floating-Point extension IsaExtM // Integer Multiply/Divide extension IsaExtN // User-level interrupts supported IsaExtO // Reserved IsaExtP // Tentatively reserved for Packed-SIMD extension IsaExtQ // Quad-precision floating-point extension IsaExtR // Reserved IsaExtS // Supervisor mode implemented IsaExtT // Tentatively reserved for Transactional Memory extension IsaExtU // User mode implemented IsaExtV // Tentatively reserved for Vector extension IsaExtW // Reserved IsaExtX // Non-standard extensions present IsaExtY // Reserved IsaExtZ // Reserved )
ISA Extension Bitmap
Variables ¶
This section is empty.
Functions ¶
func DisplaySATP ¶
DisplaySATP returns a display string for the SATP register.
Types ¶
type ECode ¶
type ECode uint
ECode is a RISC-V exception code.
const ( ExInsAddrMisaligned ECode = 0 // Instruction address misaligned ExInsAccessFault ECode = 1 // Instruction access fault ExInsIllegal ECode = 2 // Illegal instruction ExBreakpoint ECode = 3 // Breakpoint ExLoadAddrMisaligned ECode = 4 // Load address misaligned ExLoadAccessFault ECode = 5 // Load access fault ExStoreAddrMisaligned ECode = 6 // Store/AMO address misaligned ExStoreAccessFault ECode = 7 // Store/AMO access fault ExEnvCallFromUserMode ECode = 8 // Environment call from U-mode ExEnvCallFromSupervisorMode ECode = 9 // Environment call from S-mode ExUnknown10 ECode = 10 // unknown 10 ExEnvCallFromMachineMode ECode = 11 // Environment call from M-mode ExInsPageFault ECode = 12 // Instruction page fault ExLoadPageFault ECode = 13 // Load page fault ExUnknown14 ECode = 14 // unknown 14 ExStorePageFault ECode = 15 // Store/AMO page fault )
Exception Codes
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a CSR access error.
type ICode ¶
type ICode uint
ICode is a RISC-V interrupt code.
const ( IntUserSoftware ICode = 0 // User software interrupt IntSupervisorSoftware ICode = 1 // Supervisor software interrupt IntMachineSoftware ICode = 3 // Machine software interrupt IntUserTimer ICode = 4 // User timer interrupt IntSupervisorTimer ICode = 5 // Supervisor timer interrupt IntMachineTimer ICode = 7 // Machine timer interrupt IntUserExternal ICode = 8 // User external interrupt IntSupervisorExternal ICode = 9 // Supervisor external interrupt IntMachineExternal ICode = 11 // Machine external interrupt )
Interrupt Codes
type Mode ¶
type Mode uint
Mode is the processor mode (user/supervisor/machine).
type State ¶
type State struct {
// contains filtered or unexported fields
}
State stores the CSR state for the CPU.
func (*State) IncClockCycles ¶
IncClockCycles increments the CSR clock cycle counter.
func (*State) IncInstructions ¶
func (s *State) IncInstructions()
IncInstructions increments the CSR instructions retired counter.
func (*State) IsFloatOff ¶
IsFloatOff returns true if the floating point has been disabled in mstatus.fs.
Click to show internal directories.
Click to hide internal directories.