NMSIS-Core  Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
Intrinsic Functions for CPU Intructions

Functions that generate RISC-V CPU instructions. More...

Macros

#define __FENCE(p, s)   __ASM volatile ("fence " #p "," #s : : : "memory")
 Execute fence instruction, p -> pred, s -> succ. More...
 
#define __RWMB()   __FENCE(iorw,iorw)
 Read & Write Memory barrier. More...
 
#define __RMB()   __FENCE(ir,ir)
 Read Memory barrier. More...
 
#define __WMB()   __FENCE(ow,ow)
 Write Memory barrier. More...
 
#define __SMP_RWMB()   __FENCE(rw,rw)
 SMP Read & Write Memory barrier. More...
 
#define __SMP_RMB()   __FENCE(r,r)
 SMP Read Memory barrier. More...
 
#define __SMP_WMB()   __FENCE(w,w)
 SMP Write Memory barrier. More...
 
#define __CPU_RELAX()   __ASM volatile ("" : : : "memory")
 CPU relax for busy loop. More...
 

Enumerations

enum  WFI_SleepMode {
  WFI_SHALLOW_SLEEP = 0,
  WFI_DEEP_SLEEP = 1
}
 WFI Sleep Mode enumeration. More...
 

Functions

__STATIC_FORCEINLINE void __NOP (void)
 NOP Instruction. More...
 
__STATIC_FORCEINLINE void __WFI (void)
 Wait For Interrupt. More...
 
__STATIC_FORCEINLINE void __WFE (void)
 Wait For Event. More...
 
__STATIC_FORCEINLINE void __EBREAK (void)
 Breakpoint Instruction. More...
 
__STATIC_FORCEINLINE void __ECALL (void)
 Environment Call Instruction. More...
 
__STATIC_FORCEINLINE void __set_wfi_sleepmode (WFI_SleepMode_Type mode)
 Set Sleep mode of WFI. More...
 
__STATIC_FORCEINLINE void __TXEVT (void)
 Send TX Event. More...
 
__STATIC_FORCEINLINE void __enable_mcycle_counter (void)
 Enable MCYCLE counter. More...
 
__STATIC_FORCEINLINE void __disable_mcycle_counter (void)
 Disable MCYCLE counter. More...
 
__STATIC_FORCEINLINE void __enable_minstret_counter (void)
 Enable MINSTRET counter. More...
 
__STATIC_FORCEINLINE void __disable_minstret_counter (void)
 Disable MINSTRET counter. More...
 
__STATIC_FORCEINLINE void __enable_mhpm_counter (unsigned long idx)
 Enable selected hardware performance monitor counter. More...
 
__STATIC_FORCEINLINE void __disable_mhpm_counter (unsigned long idx)
 Disable selected hardware performance monitor counter. More...
 
__STATIC_FORCEINLINE void __enable_mhpm_counters (unsigned long mask)
 Enable hardware performance counters with mask. More...
 
__STATIC_FORCEINLINE void __disable_mhpm_counters (unsigned long mask)
 Disable hardware performance counters with mask. More...
 
__STATIC_FORCEINLINE void __enable_all_counter (void)
 Enable all MCYCLE & MINSTRET & MHPMCOUNTER counter. More...
 
__STATIC_FORCEINLINE void __disable_all_counter (void)
 Disable all MCYCLE & MINSTRET & MHPMCOUNTER counter. More...
 
__STATIC_FORCEINLINE void __set_hpm_event (unsigned long idx, unsigned long event)
 Set event for selected high performance monitor event. More...
 
__STATIC_FORCEINLINE unsigned long __get_hpm_event (unsigned long idx)
 Get event for selected high performance monitor event. More...
 
__STATIC_FORCEINLINE void __set_hpm_counter (unsigned long idx, uint64_t value)
 Set value for selected high performance monitor counter. More...
 
__STATIC_FORCEINLINE unsigned long __get_hpm_counter (unsigned long idx)
 Get value of selected high performance monitor couner. More...
 
__STATIC_FORCEINLINE void __set_medeleg (unsigned long mask)
 Set exceptions delegation to S mode. More...
 
__STATIC_FORCEINLINE void __FENCE_I (void)
 Fence.i Instruction. More...
 
__STATIC_FORCEINLINE uint8_t __LB (volatile void *addr)
 Load 8bit value from address (8 bit) More...
 
__STATIC_FORCEINLINE uint16_t __LH (volatile void *addr)
 Load 16bit value from address (16 bit) More...
 
__STATIC_FORCEINLINE uint32_t __LW (volatile void *addr)
 Load 32bit value from address (32 bit) More...
 
__STATIC_FORCEINLINE void __SB (volatile void *addr, uint8_t val)
 Write 8bit value to address (8 bit) More...
 
__STATIC_FORCEINLINE void __SH (volatile void *addr, uint16_t val)
 Write 16bit value to address (16 bit) More...
 
__STATIC_FORCEINLINE void __SW (volatile void *addr, uint32_t val)
 Write 32bit value to address (32 bit) More...
 
__STATIC_FORCEINLINE uint32_t __CAS_W (volatile uint32_t *addr, uint32_t oldval, uint32_t newval)
 Compare and Swap 32bit value using LR and SC. More...
 
__STATIC_FORCEINLINE uint32_t __AMOSWAP_W (volatile uint32_t *addr, uint32_t newval)
 Atomic Swap 32bit value into memory. More...
 
__STATIC_FORCEINLINE int32_t __AMOADD_W (volatile int32_t *addr, int32_t value)
 Atomic Add with 32bit value. More...
 
__STATIC_FORCEINLINE int32_t __AMOAND_W (volatile int32_t *addr, int32_t value)
 Atomic And with 32bit value. More...
 
__STATIC_FORCEINLINE int32_t __AMOOR_W (volatile int32_t *addr, int32_t value)
 Atomic OR with 32bit value. More...
 
__STATIC_FORCEINLINE int32_t __AMOXOR_W (volatile int32_t *addr, int32_t value)
 Atomic XOR with 32bit value. More...
 
__STATIC_FORCEINLINE uint32_t __AMOMAXU_W (volatile uint32_t *addr, uint32_t value)
 Atomic unsigned MAX with 32bit value. More...
 
__STATIC_FORCEINLINE int32_t __AMOMAX_W (volatile int32_t *addr, int32_t value)
 Atomic signed MAX with 32bit value. More...
 
__STATIC_FORCEINLINE uint32_t __AMOMINU_W (volatile uint32_t *addr, uint32_t value)
 Atomic unsigned MIN with 32bit value. More...
 
__STATIC_FORCEINLINE int32_t __AMOMIN_W (volatile int32_t *addr, int32_t value)
 Atomic signed MIN with 32bit value. More...
 

Detailed Description

Functions that generate RISC-V CPU instructions.

The following functions generate specified RISC-V instructions that cannot be directly accessed by compiler.

Macro Definition Documentation

◆ __CPU_RELAX

#define __CPU_RELAX ( )    __ASM volatile ("" : : : "memory")

CPU relax for busy loop.

Definition at line 1786 of file core_feature_base.h.

◆ __FENCE

#define __FENCE (   p,
 
)    __ASM volatile ("fence " #p "," #s : : : "memory")

Execute fence instruction, p -> pred, s -> succ.

the FENCE instruction ensures that all memory accesses from instructions preceding the fence in program order (the predecessor set) appear earlier in the global memory order than memory accesses from instructions appearing after the fence in program order (the successor set). For details, please refer to The RISC-V Instruction Set Manual

Parameters
ppredecessor set, such as iorw, rw, r, w
ssuccessor set, such as iorw, rw, r, w

Definition at line 1754 of file core_feature_base.h.

◆ __RMB

#define __RMB ( )    __FENCE(ir,ir)

Read Memory barrier.

Definition at line 1771 of file core_feature_base.h.

◆ __RWMB

#define __RWMB ( )    __FENCE(iorw,iorw)

Read & Write Memory barrier.

Definition at line 1768 of file core_feature_base.h.

◆ __SMP_RMB

#define __SMP_RMB ( )    __FENCE(r,r)

SMP Read Memory barrier.

Definition at line 1780 of file core_feature_base.h.

◆ __SMP_RWMB

#define __SMP_RWMB ( )    __FENCE(rw,rw)

SMP Read & Write Memory barrier.

Definition at line 1777 of file core_feature_base.h.

◆ __SMP_WMB

#define __SMP_WMB ( )    __FENCE(w,w)

SMP Write Memory barrier.

Definition at line 1783 of file core_feature_base.h.

◆ __WMB

#define __WMB ( )    __FENCE(ow,ow)

Write Memory barrier.

Definition at line 1774 of file core_feature_base.h.

Enumeration Type Documentation

◆ WFI_SleepMode

WFI Sleep Mode enumeration.

Enumerator
WFI_SHALLOW_SLEEP 

Shallow sleep mode, the core_clk will poweroff.

WFI_DEEP_SLEEP 

Deep sleep mode, the core_clk and core_ano_clk will poweroff.

Definition at line 1169 of file core_feature_base.h.

1169  {
1170  WFI_SHALLOW_SLEEP = 0,
1171  WFI_DEEP_SLEEP = 1
1172 } WFI_SleepMode_Type;

Function Documentation

◆ __AMOADD_W()

__STATIC_FORCEINLINE int32_t __AMOADD_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic Add with 32bit value.

Atomically ADD 32bit value with value in memory using amoadd.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be ADDed
Returns
return memory value + add value

Definition at line 1945 of file core_feature_base.h.

1946 {
1947  int32_t result;
1948 
1949  __ASM volatile ("amoadd.w %0, %2, %1" : \
1950  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
1951  return *addr;
1952 }

References __ASM.

◆ __AMOAND_W()

__STATIC_FORCEINLINE int32_t __AMOAND_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic And with 32bit value.

Atomically AND 32bit value with value in memory using amoand.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be ANDed
Returns
return memory value & and value

Definition at line 1961 of file core_feature_base.h.

1962 {
1963  int32_t result;
1964 
1965  __ASM volatile ("amoand.w %0, %2, %1" : \
1966  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
1967  return *addr;
1968 }

References __ASM.

◆ __AMOMAX_W()

__STATIC_FORCEINLINE int32_t __AMOMAX_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic signed MAX with 32bit value.

Atomically signed max compare 32bit value with value in memory using amomax.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be compared
Returns
the bigger value

Definition at line 2025 of file core_feature_base.h.

2026 {
2027  int32_t result;
2028 
2029  __ASM volatile ("amomax.w %0, %2, %1" : \
2030  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
2031  return *addr;
2032 }

References __ASM.

◆ __AMOMAXU_W()

__STATIC_FORCEINLINE uint32_t __AMOMAXU_W ( volatile uint32_t *  addr,
uint32_t  value 
)

Atomic unsigned MAX with 32bit value.

Atomically unsigned max compare 32bit value with value in memory using amomaxu.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be compared
Returns
return the bigger value

Definition at line 2009 of file core_feature_base.h.

2010 {
2011  uint32_t result;
2012 
2013  __ASM volatile ("amomaxu.w %0, %2, %1" : \
2014  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
2015  return *addr;
2016 }

References __ASM.

◆ __AMOMIN_W()

__STATIC_FORCEINLINE int32_t __AMOMIN_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic signed MIN with 32bit value.

Atomically signed min compare 32bit value with value in memory using amomin.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be compared
Returns
the smaller value

Definition at line 2057 of file core_feature_base.h.

2058 {
2059  int32_t result;
2060 
2061  __ASM volatile ("amomin.w %0, %2, %1" : \
2062  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
2063  return *addr;
2064 }

References __ASM.

◆ __AMOMINU_W()

__STATIC_FORCEINLINE uint32_t __AMOMINU_W ( volatile uint32_t *  addr,
uint32_t  value 
)

Atomic unsigned MIN with 32bit value.

Atomically unsigned min compare 32bit value with value in memory using amominu.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be compared
Returns
the smaller value

Definition at line 2041 of file core_feature_base.h.

2042 {
2043  uint32_t result;
2044 
2045  __ASM volatile ("amominu.w %0, %2, %1" : \
2046  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
2047  return *addr;
2048 }

References __ASM.

◆ __AMOOR_W()

__STATIC_FORCEINLINE int32_t __AMOOR_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic OR with 32bit value.

Atomically OR 32bit value with value in memory using amoor.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be ORed
Returns
return memory value | and value

Definition at line 1977 of file core_feature_base.h.

1978 {
1979  int32_t result;
1980 
1981  __ASM volatile ("amoor.w %0, %2, %1" : \
1982  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
1983  return *addr;
1984 }

References __ASM.

◆ __AMOSWAP_W()

__STATIC_FORCEINLINE uint32_t __AMOSWAP_W ( volatile uint32_t *  addr,
uint32_t  newval 
)

Atomic Swap 32bit value into memory.

Atomically swap new 32bit value into memory using amoswap.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]newvalNew value to be stored into the address
Returns
return the original value in memory

Definition at line 1929 of file core_feature_base.h.

1930 {
1931  uint32_t result;
1932 
1933  __ASM volatile ("amoswap.w %0, %2, %1" : \
1934  "=r"(result), "+A"(*addr) : "r"(newval) : "memory");
1935  return result;
1936 }

References __ASM.

◆ __AMOXOR_W()

__STATIC_FORCEINLINE int32_t __AMOXOR_W ( volatile int32_t *  addr,
int32_t  value 
)

Atomic XOR with 32bit value.

Atomically XOR 32bit value with value in memory using amoxor.d.

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]valuevalue to be XORed
Returns
return memory value ^ and value

Definition at line 1993 of file core_feature_base.h.

1994 {
1995  int32_t result;
1996 
1997  __ASM volatile ("amoxor.w %0, %2, %1" : \
1998  "=r"(result), "+A"(*addr) : "r"(value) : "memory");
1999  return *addr;
2000 }

References __ASM.

◆ __CAS_W()

__STATIC_FORCEINLINE uint32_t __CAS_W ( volatile uint32_t *  addr,
uint32_t  oldval,
uint32_t  newval 
)

Compare and Swap 32bit value using LR and SC.

Compare old value with memory, if identical, store new value in memory. Return the initial value in memory. Success is indicated by comparing return value with OLD. memory address, return 0 if successful, otherwise return !0

Parameters
[in]addrAddress pointer to data, address need to be 4byte aligned
[in]oldvalOld value of the data in address
[in]newvalNew value to be stored into the address
Returns
return the initial value in memory

Definition at line 1905 of file core_feature_base.h.

1906 {
1907  uint32_t result;
1908  uint32_t rc;
1909 
1910  __ASM volatile ( \
1911  "0: lr.w %0, %2 \n" \
1912  " bne %0, %z3, 1f \n" \
1913  " sc.w %1, %z4, %2 \n" \
1914  " bnez %1, 0b \n" \
1915  "1:\n" \
1916  : "=&r"(result), "=&r"(rc), "+A"(*addr) \
1917  : "r"(oldval), "r"(newval) \
1918  : "memory");
1919  return result;
1920 }

References __ASM.

◆ __disable_all_counter()

__STATIC_FORCEINLINE void __disable_all_counter ( void  )

Disable all MCYCLE & MINSTRET & MHPMCOUNTER counter.

Set all to one to disable all counters, such as cycle, instret, high performance monitor counters

Definition at line 1300 of file core_feature_base.h.

1301 {
1302  __RV_CSR_SET(CSR_MCOUNTINHIBIT, 0xFFFFFFFF);
1303 }

References __RV_CSR_SET, and CSR_MCOUNTINHIBIT.

◆ __disable_mcycle_counter()

__STATIC_FORCEINLINE void __disable_mcycle_counter ( void  )

Disable MCYCLE counter.

Set the CY bit of MCOUNTINHIBIT to 1 to disable MCYCLE Counter

Definition at line 1212 of file core_feature_base.h.

1213 {
1215 }

References __RV_CSR_SET, CSR_MCOUNTINHIBIT, and MCOUNTINHIBIT_CY.

◆ __disable_mhpm_counter()

__STATIC_FORCEINLINE void __disable_mhpm_counter ( unsigned long  idx)

Disable selected hardware performance monitor counter.

Parameters
[in]idxthe index of the hardware performance monitor counter

Disable selected hardware performance monitor counter mhpmcounterx.

Definition at line 1254 of file core_feature_base.h.

1255 {
1256  __RV_CSR_SET(CSR_MCOUNTINHIBIT, (1 << idx));
1257 }

References __RV_CSR_SET, and CSR_MCOUNTINHIBIT.

◆ __disable_mhpm_counters()

__STATIC_FORCEINLINE void __disable_mhpm_counters ( unsigned long  mask)

Disable hardware performance counters with mask.

Parameters
[in]maskmask of selected hardware performance monitor counters

Disable mhpmcounterx with mask, only the masked ones will be disabled. mhpmcounter3-mhpmcount31 are for high performance monitor counters.

Definition at line 1278 of file core_feature_base.h.

1279 {
1281 }

References __RV_CSR_SET, and CSR_MCOUNTINHIBIT.

◆ __disable_minstret_counter()

__STATIC_FORCEINLINE void __disable_minstret_counter ( void  )

Disable MINSTRET counter.

Set the IR bit of MCOUNTINHIBIT to 1 to disable MINSTRET Counter

Definition at line 1232 of file core_feature_base.h.

1233 {
1235 }

References __RV_CSR_SET, CSR_MCOUNTINHIBIT, and MCOUNTINHIBIT_IR.

◆ __EBREAK()

__STATIC_FORCEINLINE void __EBREAK ( void  )

Breakpoint Instruction.

Causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached.

Definition at line 1150 of file core_feature_base.h.

1151 {
1152  __ASM volatile("ebreak");
1153 }

References __ASM.

◆ __ECALL()

__STATIC_FORCEINLINE void __ECALL ( void  )

Environment Call Instruction.

The ECALL instruction is used to make a service request to the execution environment.

Definition at line 1161 of file core_feature_base.h.

1162 {
1163  __ASM volatile("ecall");
1164 }

References __ASM.

◆ __enable_all_counter()

__STATIC_FORCEINLINE void __enable_all_counter ( void  )

Enable all MCYCLE & MINSTRET & MHPMCOUNTER counter.

Clear all to zero to enable all counters, such as cycle, instret, high performance monitor counters

Definition at line 1289 of file core_feature_base.h.

1290 {
1291  __RV_CSR_CLEAR(CSR_MCOUNTINHIBIT, 0xFFFFFFFF);
1292 }

References __RV_CSR_CLEAR, and CSR_MCOUNTINHIBIT.

◆ __enable_mcycle_counter()

__STATIC_FORCEINLINE void __enable_mcycle_counter ( void  )

Enable MCYCLE counter.

Clear the CY bit of MCOUNTINHIBIT to 0 to enable MCYCLE Counter

Definition at line 1202 of file core_feature_base.h.

References __RV_CSR_CLEAR, CSR_MCOUNTINHIBIT, and MCOUNTINHIBIT_CY.

◆ __enable_mhpm_counter()

__STATIC_FORCEINLINE void __enable_mhpm_counter ( unsigned long  idx)

Enable selected hardware performance monitor counter.

Parameters
[in]idxthe index of the hardware performance monitor counter

enable selected hardware performance monitor counter mhpmcounterx.

Definition at line 1243 of file core_feature_base.h.

1244 {
1245  __RV_CSR_CLEAR(CSR_MCOUNTINHIBIT, (1 << idx));
1246 }

References __RV_CSR_CLEAR, and CSR_MCOUNTINHIBIT.

◆ __enable_mhpm_counters()

__STATIC_FORCEINLINE void __enable_mhpm_counters ( unsigned long  mask)

Enable hardware performance counters with mask.

Parameters
[in]maskmask of selected hardware performance monitor counters

enable mhpmcounterx with mask, only the masked ones will be enabled. mhpmcounter3-mhpmcount31 are for high performance monitor counters.

Definition at line 1266 of file core_feature_base.h.

1267 {
1269 }

References __RV_CSR_CLEAR, and CSR_MCOUNTINHIBIT.

◆ __enable_minstret_counter()

__STATIC_FORCEINLINE void __enable_minstret_counter ( void  )

Enable MINSTRET counter.

Clear the IR bit of MCOUNTINHIBIT to 0 to enable MINSTRET Counter

Definition at line 1222 of file core_feature_base.h.

References __RV_CSR_CLEAR, CSR_MCOUNTINHIBIT, and MCOUNTINHIBIT_IR.

◆ __FENCE_I()

__STATIC_FORCEINLINE void __FENCE_I ( void  )

Fence.i Instruction.

The FENCE.I instruction is used to synchronize the instruction and data streams.

Definition at line 1762 of file core_feature_base.h.

1763 {
1764  __ASM volatile("fence.i");
1765 }

References __ASM.

Referenced by __ECLIC_SetVector(), and __ECLIC_SetVector_S().

◆ __get_hpm_counter()

__STATIC_FORCEINLINE unsigned long __get_hpm_counter ( unsigned long  idx)

Get value of selected high performance monitor couner.

Parameters
[in]idxHPMCOUNTERx CSR index(3-31)
[in]eventHPMCOUNTERx Register value to set

Get high performance monitor counter register value

Returns
HPMCOUNTERx Register value

Definition at line 1536 of file core_feature_base.h.

1537 {
1538 #if __RISCV_XLEN == 32
1539  volatile uint32_t high0, low, high;
1540  uint64_t full;
1541 
1542  switch (idx) {
1543  case 0: return __get_rv_cycle();
1544  case 2: return __get_rv_instret();
1545  case 3: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER3H);
1548  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER3); }
1549  full = (((uint64_t)high) << 32) | low; return full;
1550  case 4: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER4H);
1553  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER4); }
1554  full = (((uint64_t)high) << 32) | low; return full;
1555  case 5: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER5H);
1558  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER5); }
1559  full = (((uint64_t)high) << 32) | low; return full;
1560  case 6: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER6H);
1563  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER6); }
1564  full = (((uint64_t)high) << 32) | low; return full;
1565  case 7: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER7H);
1568  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER7); }
1569  full = (((uint64_t)high) << 32) | low; return full;
1570  case 8: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER8H);
1573  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER8); }
1574  full = (((uint64_t)high) << 32) | low; return full;
1575  case 9: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER9H);
1578  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER9); }
1579  full = (((uint64_t)high) << 32) | low; return full;
1580  case 10: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER10H);
1583  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER10); }
1584  full = (((uint64_t)high) << 32) | low; return full;
1585  case 11: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER11H);
1588  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER11); }
1589  full = (((uint64_t)high) << 32) | low; return full;
1590  case 12: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER12H);
1593  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER12); }
1594  full = (((uint64_t)high) << 32) | low; return full;
1595  case 13: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER13H);
1598  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER13); }
1599  full = (((uint64_t)high) << 32) | low; return full;
1600  case 14: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER14H);
1603  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER14); }
1604  full = (((uint64_t)high) << 32) | low; return full;
1605  case 15: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER15H);
1608  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER15); }
1609  full = (((uint64_t)high) << 32) | low; return full;
1610  case 16: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER16H);
1613  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER16); }
1614  full = (((uint64_t)high) << 32) | low; return full;
1615  case 17: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER17H);
1618  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER17); }
1619  full = (((uint64_t)high) << 32) | low; return full;
1620  case 18: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER18H);
1623  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER18); }
1624  full = (((uint64_t)high) << 32) | low; return full;
1625  case 19: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER19H);
1628  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER19); }
1629  full = (((uint64_t)high) << 32) | low; return full;
1630  case 20: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER20H);
1633  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER20); }
1634  full = (((uint64_t)high) << 32) | low; return full;
1635  case 21: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER21H);
1638  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER21); }
1639  full = (((uint64_t)high) << 32) | low; return full;
1640  case 22: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER22H);
1643  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER22); }
1644  full = (((uint64_t)high) << 32) | low; return full;
1645  case 23: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER23H);
1648  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER23); }
1649  full = (((uint64_t)high) << 32) | low; return full;
1650  case 24: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER24H);
1653  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER24); }
1654  full = (((uint64_t)high) << 32) | low; return full;
1655  case 25: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER25H);
1658  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER25); }
1659  full = (((uint64_t)high) << 32) | low; return full;
1660  case 26: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER26H);
1663  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER26); }
1664  full = (((uint64_t)high) << 32) | low; return full;
1665  case 27: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER27H);
1668  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER27); }
1669  full = (((uint64_t)high) << 32) | low; return full;
1670  case 28: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER28H);
1673  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER28); }
1674  full = (((uint64_t)high) << 32) | low; return full;
1675  case 29: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER29H);
1678  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER29); }
1679  full = (((uint64_t)high) << 32) | low; return full;
1680  case 30: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER30H);
1683  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER30); }
1684  full = (((uint64_t)high) << 32) | low; return full;
1685  case 31: high0 = __RV_CSR_READ(CSR_MHPMCOUNTER31H);
1688  if (high0 != high) { low = __RV_CSR_READ(CSR_MHPMCOUNTER31); }
1689  full = (((uint64_t)high) << 32) | low; return full;
1690 
1691 #elif __RISCV_XLEN == 64
1692  switch (idx) {
1693  case 0: return __get_rv_cycle();
1694  case 2: return __get_rv_instret();
1695  case 3: return __RV_CSR_READ(CSR_MHPMCOUNTER3);
1696  case 4: return __RV_CSR_READ(CSR_MHPMCOUNTER4);
1697  case 5: return __RV_CSR_READ(CSR_MHPMCOUNTER5);
1698  case 6: return __RV_CSR_READ(CSR_MHPMCOUNTER6);
1699  case 7: return __RV_CSR_READ(CSR_MHPMCOUNTER7);
1700  case 8: return __RV_CSR_READ(CSR_MHPMCOUNTER8);
1701  case 9: return __RV_CSR_READ(CSR_MHPMCOUNTER9);
1702  case 10: return __RV_CSR_READ(CSR_MHPMCOUNTER10);
1703  case 11: return __RV_CSR_READ(CSR_MHPMCOUNTER11);
1704  case 12: return __RV_CSR_READ(CSR_MHPMCOUNTER12);
1705  case 13: return __RV_CSR_READ(CSR_MHPMCOUNTER13);
1706  case 14: return __RV_CSR_READ(CSR_MHPMCOUNTER14);
1707  case 15: return __RV_CSR_READ(CSR_MHPMCOUNTER15);
1708  case 16: return __RV_CSR_READ(CSR_MHPMCOUNTER16);
1709  case 17: return __RV_CSR_READ(CSR_MHPMCOUNTER17);
1710  case 18: return __RV_CSR_READ(CSR_MHPMCOUNTER18);
1711  case 19: return __RV_CSR_READ(CSR_MHPMCOUNTER19);
1712  case 20: return __RV_CSR_READ(CSR_MHPMCOUNTER20);
1713  case 21: return __RV_CSR_READ(CSR_MHPMCOUNTER21);
1714  case 22: return __RV_CSR_READ(CSR_MHPMCOUNTER22);
1715  case 23: return __RV_CSR_READ(CSR_MHPMCOUNTER23);
1716  case 24: return __RV_CSR_READ(CSR_MHPMCOUNTER24);
1717  case 25: return __RV_CSR_READ(CSR_MHPMCOUNTER25);
1718  case 26: return __RV_CSR_READ(CSR_MHPMCOUNTER26);
1719  case 27: return __RV_CSR_READ(CSR_MHPMCOUNTER27);
1720  case 28: return __RV_CSR_READ(CSR_MHPMCOUNTER28);
1721  case 29: return __RV_CSR_READ(CSR_MHPMCOUNTER29);
1722  case 30: return __RV_CSR_READ(CSR_MHPMCOUNTER30);
1723  case 31: return __RV_CSR_READ(CSR_MHPMCOUNTER31);
1724 
1725 #else
1726  switch (idx) {
1727 #endif
1728  default: return 0;
1729  }
1730 }

References __get_rv_cycle(), __get_rv_instret(), __RV_CSR_READ, CSR_MHPMCOUNTER10, CSR_MHPMCOUNTER10H, CSR_MHPMCOUNTER11, CSR_MHPMCOUNTER11H, CSR_MHPMCOUNTER12, CSR_MHPMCOUNTER12H, CSR_MHPMCOUNTER13, CSR_MHPMCOUNTER13H, CSR_MHPMCOUNTER14, CSR_MHPMCOUNTER14H, CSR_MHPMCOUNTER15, CSR_MHPMCOUNTER15H, CSR_MHPMCOUNTER16, CSR_MHPMCOUNTER16H, CSR_MHPMCOUNTER17, CSR_MHPMCOUNTER17H, CSR_MHPMCOUNTER18, CSR_MHPMCOUNTER18H, CSR_MHPMCOUNTER19, CSR_MHPMCOUNTER19H, CSR_MHPMCOUNTER20, CSR_MHPMCOUNTER20H, CSR_MHPMCOUNTER21, CSR_MHPMCOUNTER21H, CSR_MHPMCOUNTER22, CSR_MHPMCOUNTER22H, CSR_MHPMCOUNTER23, CSR_MHPMCOUNTER23H, CSR_MHPMCOUNTER24, CSR_MHPMCOUNTER24H, CSR_MHPMCOUNTER25, CSR_MHPMCOUNTER25H, CSR_MHPMCOUNTER26, CSR_MHPMCOUNTER26H, CSR_MHPMCOUNTER27, CSR_MHPMCOUNTER27H, CSR_MHPMCOUNTER28, CSR_MHPMCOUNTER28H, CSR_MHPMCOUNTER29, CSR_MHPMCOUNTER29H, CSR_MHPMCOUNTER3, CSR_MHPMCOUNTER30, CSR_MHPMCOUNTER30H, CSR_MHPMCOUNTER31, CSR_MHPMCOUNTER31H, CSR_MHPMCOUNTER3H, CSR_MHPMCOUNTER4, CSR_MHPMCOUNTER4H, CSR_MHPMCOUNTER5, CSR_MHPMCOUNTER5H, CSR_MHPMCOUNTER6, CSR_MHPMCOUNTER6H, CSR_MHPMCOUNTER7, CSR_MHPMCOUNTER7H, CSR_MHPMCOUNTER8, CSR_MHPMCOUNTER8H, CSR_MHPMCOUNTER9, and CSR_MHPMCOUNTER9H.

◆ __get_hpm_event()

__STATIC_FORCEINLINE unsigned long __get_hpm_event ( unsigned long  idx)

Get event for selected high performance monitor event.

Parameters
[in]idxHPMEVENTx CSR index(3-31)
[in]eventHPMEVENTx Register value to set

Get high performance monitor event register value

Returns
HPMEVENTx Register value

Definition at line 1356 of file core_feature_base.h.

1357 {
1358  switch (idx) {
1359  case 3: return __RV_CSR_READ(CSR_MHPMEVENT3);
1360  case 4: return __RV_CSR_READ(CSR_MHPMEVENT4);
1361  case 5: return __RV_CSR_READ(CSR_MHPMEVENT5);
1362  case 6: return __RV_CSR_READ(CSR_MHPMEVENT6);
1363  case 7: return __RV_CSR_READ(CSR_MHPMEVENT7);
1364  case 8: return __RV_CSR_READ(CSR_MHPMEVENT8);
1365  case 9: return __RV_CSR_READ(CSR_MHPMEVENT9);
1366  case 10: return __RV_CSR_READ(CSR_MHPMEVENT10);
1367  case 11: return __RV_CSR_READ(CSR_MHPMEVENT11);
1368  case 12: return __RV_CSR_READ(CSR_MHPMEVENT12);
1369  case 13: return __RV_CSR_READ(CSR_MHPMEVENT13);
1370  case 14: return __RV_CSR_READ(CSR_MHPMEVENT14);
1371  case 15: return __RV_CSR_READ(CSR_MHPMEVENT15);
1372  case 16: return __RV_CSR_READ(CSR_MHPMEVENT16);
1373  case 17: return __RV_CSR_READ(CSR_MHPMEVENT17);
1374  case 18: return __RV_CSR_READ(CSR_MHPMEVENT18);
1375  case 19: return __RV_CSR_READ(CSR_MHPMEVENT19);
1376  case 20: return __RV_CSR_READ(CSR_MHPMEVENT20);
1377  case 21: return __RV_CSR_READ(CSR_MHPMEVENT21);
1378  case 22: return __RV_CSR_READ(CSR_MHPMEVENT22);
1379  case 23: return __RV_CSR_READ(CSR_MHPMEVENT23);
1380  case 24: return __RV_CSR_READ(CSR_MHPMEVENT24);
1381  case 25: return __RV_CSR_READ(CSR_MHPMEVENT25);
1382  case 26: return __RV_CSR_READ(CSR_MHPMEVENT26);
1383  case 27: return __RV_CSR_READ(CSR_MHPMEVENT27);
1384  case 28: return __RV_CSR_READ(CSR_MHPMEVENT28);
1385  case 29: return __RV_CSR_READ(CSR_MHPMEVENT29);
1386  case 30: return __RV_CSR_READ(CSR_MHPMEVENT30);
1387  case 31: return __RV_CSR_READ(CSR_MHPMEVENT31);
1388  default: return 0;
1389  }
1390 }

References __RV_CSR_READ, CSR_MHPMEVENT10, CSR_MHPMEVENT11, CSR_MHPMEVENT12, CSR_MHPMEVENT13, CSR_MHPMEVENT14, CSR_MHPMEVENT15, CSR_MHPMEVENT16, CSR_MHPMEVENT17, CSR_MHPMEVENT18, CSR_MHPMEVENT19, CSR_MHPMEVENT20, CSR_MHPMEVENT21, CSR_MHPMEVENT22, CSR_MHPMEVENT23, CSR_MHPMEVENT24, CSR_MHPMEVENT25, CSR_MHPMEVENT26, CSR_MHPMEVENT27, CSR_MHPMEVENT28, CSR_MHPMEVENT29, CSR_MHPMEVENT3, CSR_MHPMEVENT30, CSR_MHPMEVENT31, CSR_MHPMEVENT4, CSR_MHPMEVENT5, CSR_MHPMEVENT6, CSR_MHPMEVENT7, CSR_MHPMEVENT8, and CSR_MHPMEVENT9.

◆ __LB()

__STATIC_FORCEINLINE uint8_t __LB ( volatile void *  addr)

Load 8bit value from address (8 bit)

Load 8 bit value.

Parameters
[in]addrAddress pointer to data
Returns
value of type uint8_t at (*addr)

Definition at line 1796 of file core_feature_base.h.

1797 {
1798  uint8_t result;
1799 
1800  __ASM volatile ("lb %0, 0(%1)" : "=r" (result) : "r" (addr));
1801  return result;
1802 }

References __ASM.

◆ __LH()

__STATIC_FORCEINLINE uint16_t __LH ( volatile void *  addr)

Load 16bit value from address (16 bit)

Load 16 bit value.

Parameters
[in]addrAddress pointer to data
Returns
value of type uint16_t at (*addr)

Definition at line 1810 of file core_feature_base.h.

1811 {
1812  uint16_t result;
1813 
1814  __ASM volatile ("lh %0, 0(%1)" : "=r" (result) : "r" (addr));
1815  return result;
1816 }

References __ASM.

◆ __LW()

__STATIC_FORCEINLINE uint32_t __LW ( volatile void *  addr)

Load 32bit value from address (32 bit)

Load 32 bit value.

Parameters
[in]addrAddress pointer to data
Returns
value of type uint32_t at (*addr)

Definition at line 1824 of file core_feature_base.h.

1825 {
1826  uint32_t result;
1827 
1828  __ASM volatile ("lw %0, 0(%1)" : "=r" (result) : "r" (addr));
1829  return result;
1830 }

References __ASM.

Referenced by SysTimer_GetHartCompareValue(), SysTimer_GetHartMsipValue(), and SysTimer_GetLoadValue().

◆ __NOP()

__STATIC_FORCEINLINE void __NOP ( void  )

NOP Instruction.

No Operation does nothing. This instruction can be used for code alignment purposes.

Definition at line 1109 of file core_feature_base.h.

1110 {
1111  __ASM volatile("nop");
1112 }

References __ASM.

◆ __SB()

__STATIC_FORCEINLINE void __SB ( volatile void *  addr,
uint8_t  val 
)

Write 8bit value to address (8 bit)

Write 8 bit value.

Parameters
[in]addrAddress pointer to data
[in]valValue to set

Definition at line 1854 of file core_feature_base.h.

1855 {
1856  __ASM volatile ("sb %0, 0(%1)" : : "r" (val), "r" (addr));
1857 }

References __ASM.

◆ __set_hpm_counter()

__STATIC_FORCEINLINE void __set_hpm_counter ( unsigned long  idx,
uint64_t  value 
)

Set value for selected high performance monitor counter.

Parameters
[in]idxHPMCOUNTERx CSR index(3-31)
[in]valueHPMCOUNTERx Register value to set

Set value for high performance monitor couner register

Definition at line 1399 of file core_feature_base.h.

1400 {
1401  switch (idx) {
1402 #if __RISCV_XLEN == 32
1403  case 3: __RV_CSR_WRITE(CSR_MHPMCOUNTER3, 0); // prevent carry
1404  __RV_CSR_WRITE(CSR_MHPMCOUNTER3H, (uint32_t)(value >> 32));
1405  __RV_CSR_WRITE(CSR_MHPMCOUNTER3, (uint32_t)(value)); break;
1406  case 4: __RV_CSR_WRITE(CSR_MHPMCOUNTER4, 0); // prevent carry
1407  __RV_CSR_WRITE(CSR_MHPMCOUNTER4H, (uint32_t)(value >> 32));
1408  __RV_CSR_WRITE(CSR_MHPMCOUNTER4, (uint32_t)(value)); break;
1409  case 5: __RV_CSR_WRITE(CSR_MHPMCOUNTER5, 0); // prevent carry
1410  __RV_CSR_WRITE(CSR_MHPMCOUNTER5H, (uint32_t)(value >> 32));
1411  __RV_CSR_WRITE(CSR_MHPMCOUNTER5, (uint32_t)(value)); break;
1412  case 6: __RV_CSR_WRITE(CSR_MHPMCOUNTER6, 0); // prevent carry
1413  __RV_CSR_WRITE(CSR_MHPMCOUNTER6H, (uint32_t)(value >> 32));
1414  __RV_CSR_WRITE(CSR_MHPMCOUNTER6, (uint32_t)(value)); break;
1415  case 7: __RV_CSR_WRITE(CSR_MHPMCOUNTER7, 0); // prevent carry
1416  __RV_CSR_WRITE(CSR_MHPMCOUNTER7H, (uint32_t)(value >> 32));
1417  __RV_CSR_WRITE(CSR_MHPMCOUNTER7, (uint32_t)(value)); break;
1418  case 8: __RV_CSR_WRITE(CSR_MHPMCOUNTER8, 0); // prevent carry
1419  __RV_CSR_WRITE(CSR_MHPMCOUNTER8H, (uint32_t)(value >> 32));
1420  __RV_CSR_WRITE(CSR_MHPMCOUNTER8, (uint32_t)(value)); break;
1421  case 9: __RV_CSR_WRITE(CSR_MHPMCOUNTER9, 0); // prevent carry
1422  __RV_CSR_WRITE(CSR_MHPMCOUNTER9H, (uint32_t)(value >> 32));
1423  __RV_CSR_WRITE(CSR_MHPMCOUNTER9, (uint32_t)(value)); break;
1424  case 10: __RV_CSR_WRITE(CSR_MHPMCOUNTER10, 0); // prevent carry
1425  __RV_CSR_WRITE(CSR_MHPMCOUNTER10H, (uint32_t)(value >> 32));
1426  __RV_CSR_WRITE(CSR_MHPMCOUNTER10, (uint32_t)(value)); break;
1427  case 11: __RV_CSR_WRITE(CSR_MHPMCOUNTER11, 0); // prevent carry
1428  __RV_CSR_WRITE(CSR_MHPMCOUNTER11H, (uint32_t)(value >> 32));
1429  __RV_CSR_WRITE(CSR_MHPMCOUNTER11, (uint32_t)(value)); break;
1430  case 12: __RV_CSR_WRITE(CSR_MHPMCOUNTER12, 0); // prevent carry
1431  __RV_CSR_WRITE(CSR_MHPMCOUNTER12H, (uint32_t)(value >> 32));
1432  __RV_CSR_WRITE(CSR_MHPMCOUNTER12, (uint32_t)(value)); break;
1433  case 13: __RV_CSR_WRITE(CSR_MHPMCOUNTER13, 0); // prevent carry
1434  __RV_CSR_WRITE(CSR_MHPMCOUNTER13H, (uint32_t)(value >> 32));
1435  __RV_CSR_WRITE(CSR_MHPMCOUNTER13, (uint32_t)(value)); break;
1436  case 14: __RV_CSR_WRITE(CSR_MHPMCOUNTER14, 0); // prevent carry
1437  __RV_CSR_WRITE(CSR_MHPMCOUNTER14H, (uint32_t)(value >> 32));
1438  __RV_CSR_WRITE(CSR_MHPMCOUNTER14, (uint32_t)(value)); break;
1439  case 15: __RV_CSR_WRITE(CSR_MHPMCOUNTER15, 0); // prevent carry
1440  __RV_CSR_WRITE(CSR_MHPMCOUNTER15H, (uint32_t)(value >> 32));
1441  __RV_CSR_WRITE(CSR_MHPMCOUNTER15, (uint32_t)(value)); break;
1442  case 16: __RV_CSR_WRITE(CSR_MHPMCOUNTER16, 0); // prevent carry
1443  __RV_CSR_WRITE(CSR_MHPMCOUNTER16H, (uint32_t)(value >> 32));
1444  __RV_CSR_WRITE(CSR_MHPMCOUNTER16, (uint32_t)(value)); break;
1445  case 17: __RV_CSR_WRITE(CSR_MHPMCOUNTER17, 0); // prevent carry
1446  __RV_CSR_WRITE(CSR_MHPMCOUNTER17H, (uint32_t)(value >> 32));
1447  __RV_CSR_WRITE(CSR_MHPMCOUNTER17, (uint32_t)(value)); break;
1448  case 18: __RV_CSR_WRITE(CSR_MHPMCOUNTER18, 0); // prevent carry
1449  __RV_CSR_WRITE(CSR_MHPMCOUNTER18H, (uint32_t)(value >> 32));
1450  __RV_CSR_WRITE(CSR_MHPMCOUNTER18, (uint32_t)(value)); break;
1451  case 19: __RV_CSR_WRITE(CSR_MHPMCOUNTER19, 0); // prevent carry
1452  __RV_CSR_WRITE(CSR_MHPMCOUNTER19H, (uint32_t)(value >> 32));
1453  __RV_CSR_WRITE(CSR_MHPMCOUNTER19, (uint32_t)(value)); break;
1454  case 20: __RV_CSR_WRITE(CSR_MHPMCOUNTER20, 0); // prevent carry
1455  __RV_CSR_WRITE(CSR_MHPMCOUNTER20H, (uint32_t)(value >> 32));
1456  __RV_CSR_WRITE(CSR_MHPMCOUNTER20, (uint32_t)(value)); break;
1457  case 21: __RV_CSR_WRITE(CSR_MHPMCOUNTER21, 0); // prevent carry
1458  __RV_CSR_WRITE(CSR_MHPMCOUNTER21H, (uint32_t)(value >> 32));
1459  __RV_CSR_WRITE(CSR_MHPMCOUNTER21, (uint32_t)(value)); break;
1460  case 22: __RV_CSR_WRITE(CSR_MHPMCOUNTER22, 0); // prevent carry
1461  __RV_CSR_WRITE(CSR_MHPMCOUNTER22H, (uint32_t)(value >> 32));
1462  __RV_CSR_WRITE(CSR_MHPMCOUNTER22, (uint32_t)(value)); break;
1463  case 23: __RV_CSR_WRITE(CSR_MHPMCOUNTER23, 0); // prevent carry
1464  __RV_CSR_WRITE(CSR_MHPMCOUNTER23H, (uint32_t)(value >> 32));
1465  __RV_CSR_WRITE(CSR_MHPMCOUNTER23, (uint32_t)(value)); break;
1466  case 24: __RV_CSR_WRITE(CSR_MHPMCOUNTER24, 0); // prevent carry
1467  __RV_CSR_WRITE(CSR_MHPMCOUNTER24H, (uint32_t)(value >> 32));
1468  __RV_CSR_WRITE(CSR_MHPMCOUNTER24, (uint32_t)(value)); break;
1469  case 25: __RV_CSR_WRITE(CSR_MHPMCOUNTER25, 0); // prevent carry
1470  __RV_CSR_WRITE(CSR_MHPMCOUNTER25H, (uint32_t)(value >> 32));
1471  __RV_CSR_WRITE(CSR_MHPMCOUNTER25, (uint32_t)(value)); break;
1472  case 26: __RV_CSR_WRITE(CSR_MHPMCOUNTER26, 0); // prevent carry
1473  __RV_CSR_WRITE(CSR_MHPMCOUNTER26H, (uint32_t)(value >> 32));
1474  __RV_CSR_WRITE(CSR_MHPMCOUNTER26, (uint32_t)(value)); break;
1475  case 27: __RV_CSR_WRITE(CSR_MHPMCOUNTER27, 0); // prevent carry
1476  __RV_CSR_WRITE(CSR_MHPMCOUNTER27H, (uint32_t)(value >> 32));
1477  __RV_CSR_WRITE(CSR_MHPMCOUNTER27, (uint32_t)(value)); break;
1478  case 28: __RV_CSR_WRITE(CSR_MHPMCOUNTER28, 0); // prevent carry
1479  __RV_CSR_WRITE(CSR_MHPMCOUNTER28H, (uint32_t)(value >> 32));
1480  __RV_CSR_WRITE(CSR_MHPMCOUNTER28, (uint32_t)(value)); break;
1481  case 29: __RV_CSR_WRITE(CSR_MHPMCOUNTER29, 0); // prevent carry
1482  __RV_CSR_WRITE(CSR_MHPMCOUNTER29H, (uint32_t)(value >> 32));
1483  __RV_CSR_WRITE(CSR_MHPMCOUNTER29, (uint32_t)(value)); break;
1484  case 30: __RV_CSR_WRITE(CSR_MHPMCOUNTER30, 0); // prevent carry
1485  __RV_CSR_WRITE(CSR_MHPMCOUNTER30H, (uint32_t)(value >> 32));
1486  __RV_CSR_WRITE(CSR_MHPMCOUNTER30, (uint32_t)(value)); break;
1487  case 31: __RV_CSR_WRITE(CSR_MHPMCOUNTER31, 0); // prevent carry
1488  __RV_CSR_WRITE(CSR_MHPMCOUNTER31H, (uint32_t)(value >> 32));
1489  __RV_CSR_WRITE(CSR_MHPMCOUNTER31, (uint32_t)(value)); break;
1490 
1491 #elif __RISCV_XLEN == 64
1492  case 3: __RV_CSR_WRITE(CSR_MHPMCOUNTER3, (value)); break;
1493  case 4: __RV_CSR_WRITE(CSR_MHPMCOUNTER4, (value)); break;
1494  case 5: __RV_CSR_WRITE(CSR_MHPMCOUNTER5, (value)); break;
1495  case 6: __RV_CSR_WRITE(CSR_MHPMCOUNTER6, (value)); break;
1496  case 7: __RV_CSR_WRITE(CSR_MHPMCOUNTER7, (value)); break;
1497  case 8: __RV_CSR_WRITE(CSR_MHPMCOUNTER8, (value)); break;
1498  case 9: __RV_CSR_WRITE(CSR_MHPMCOUNTER9, (value)); break;
1499  case 10: __RV_CSR_WRITE(CSR_MHPMCOUNTER10, (value)); break;
1500  case 11: __RV_CSR_WRITE(CSR_MHPMCOUNTER11, (value)); break;
1501  case 12: __RV_CSR_WRITE(CSR_MHPMCOUNTER12, (value)); break;
1502  case 13: __RV_CSR_WRITE(CSR_MHPMCOUNTER13, (value)); break;
1503  case 14: __RV_CSR_WRITE(CSR_MHPMCOUNTER14, (value)); break;
1504  case 15: __RV_CSR_WRITE(CSR_MHPMCOUNTER15, (value)); break;
1505  case 16: __RV_CSR_WRITE(CSR_MHPMCOUNTER16, (value)); break;
1506  case 17: __RV_CSR_WRITE(CSR_MHPMCOUNTER17, (value)); break;
1507  case 18: __RV_CSR_WRITE(CSR_MHPMCOUNTER18, (value)); break;
1508  case 19: __RV_CSR_WRITE(CSR_MHPMCOUNTER19, (value)); break;
1509  case 20: __RV_CSR_WRITE(CSR_MHPMCOUNTER20, (value)); break;
1510  case 21: __RV_CSR_WRITE(CSR_MHPMCOUNTER21, (value)); break;
1511  case 22: __RV_CSR_WRITE(CSR_MHPMCOUNTER22, (value)); break;
1512  case 23: __RV_CSR_WRITE(CSR_MHPMCOUNTER23, (value)); break;
1513  case 24: __RV_CSR_WRITE(CSR_MHPMCOUNTER24, (value)); break;
1514  case 25: __RV_CSR_WRITE(CSR_MHPMCOUNTER25, (value)); break;
1515  case 26: __RV_CSR_WRITE(CSR_MHPMCOUNTER26, (value)); break;
1516  case 27: __RV_CSR_WRITE(CSR_MHPMCOUNTER27, (value)); break;
1517  case 28: __RV_CSR_WRITE(CSR_MHPMCOUNTER28, (value)); break;
1518  case 29: __RV_CSR_WRITE(CSR_MHPMCOUNTER29, (value)); break;
1519  case 30: __RV_CSR_WRITE(CSR_MHPMCOUNTER30, (value)); break;
1520  case 31: __RV_CSR_WRITE(CSR_MHPMCOUNTER31, (value)); break;
1521 
1522 #else
1523 #endif
1524  default: break;
1525  }
1526 }

References __RV_CSR_WRITE, CSR_MHPMCOUNTER10, CSR_MHPMCOUNTER10H, CSR_MHPMCOUNTER11, CSR_MHPMCOUNTER11H, CSR_MHPMCOUNTER12, CSR_MHPMCOUNTER12H, CSR_MHPMCOUNTER13, CSR_MHPMCOUNTER13H, CSR_MHPMCOUNTER14, CSR_MHPMCOUNTER14H, CSR_MHPMCOUNTER15, CSR_MHPMCOUNTER15H, CSR_MHPMCOUNTER16, CSR_MHPMCOUNTER16H, CSR_MHPMCOUNTER17, CSR_MHPMCOUNTER17H, CSR_MHPMCOUNTER18, CSR_MHPMCOUNTER18H, CSR_MHPMCOUNTER19, CSR_MHPMCOUNTER19H, CSR_MHPMCOUNTER20, CSR_MHPMCOUNTER20H, CSR_MHPMCOUNTER21, CSR_MHPMCOUNTER21H, CSR_MHPMCOUNTER22, CSR_MHPMCOUNTER22H, CSR_MHPMCOUNTER23, CSR_MHPMCOUNTER23H, CSR_MHPMCOUNTER24, CSR_MHPMCOUNTER24H, CSR_MHPMCOUNTER25, CSR_MHPMCOUNTER25H, CSR_MHPMCOUNTER26, CSR_MHPMCOUNTER26H, CSR_MHPMCOUNTER27, CSR_MHPMCOUNTER27H, CSR_MHPMCOUNTER28, CSR_MHPMCOUNTER28H, CSR_MHPMCOUNTER29, CSR_MHPMCOUNTER29H, CSR_MHPMCOUNTER3, CSR_MHPMCOUNTER30, CSR_MHPMCOUNTER30H, CSR_MHPMCOUNTER31, CSR_MHPMCOUNTER31H, CSR_MHPMCOUNTER3H, CSR_MHPMCOUNTER4, CSR_MHPMCOUNTER4H, CSR_MHPMCOUNTER5, CSR_MHPMCOUNTER5H, CSR_MHPMCOUNTER6, CSR_MHPMCOUNTER6H, CSR_MHPMCOUNTER7, CSR_MHPMCOUNTER7H, CSR_MHPMCOUNTER8, CSR_MHPMCOUNTER8H, CSR_MHPMCOUNTER9, and CSR_MHPMCOUNTER9H.

◆ __set_hpm_event()

__STATIC_FORCEINLINE void __set_hpm_event ( unsigned long  idx,
unsigned long  event 
)

Set event for selected high performance monitor event.

Parameters
[in]idxHPMEVENTx CSR index(3-31)
[in]eventHPMEVENTx Register value to set

Set event for high performance monitor event register

Definition at line 1312 of file core_feature_base.h.

1313 {
1314  switch (idx) {
1315  case 3: __RV_CSR_WRITE(CSR_MHPMEVENT3, event); break;
1316  case 4: __RV_CSR_WRITE(CSR_MHPMEVENT4, event); break;
1317  case 5: __RV_CSR_WRITE(CSR_MHPMEVENT5, event); break;
1318  case 6: __RV_CSR_WRITE(CSR_MHPMEVENT6, event); break;
1319  case 7: __RV_CSR_WRITE(CSR_MHPMEVENT7, event); break;
1320  case 8: __RV_CSR_WRITE(CSR_MHPMEVENT8, event); break;
1321  case 9: __RV_CSR_WRITE(CSR_MHPMEVENT9, event); break;
1322  case 10: __RV_CSR_WRITE(CSR_MHPMEVENT10, event); break;
1323  case 11: __RV_CSR_WRITE(CSR_MHPMEVENT11, event); break;
1324  case 12: __RV_CSR_WRITE(CSR_MHPMEVENT12, event); break;
1325  case 13: __RV_CSR_WRITE(CSR_MHPMEVENT13, event); break;
1326  case 14: __RV_CSR_WRITE(CSR_MHPMEVENT14, event); break;
1327  case 15: __RV_CSR_WRITE(CSR_MHPMEVENT15, event); break;
1328  case 16: __RV_CSR_WRITE(CSR_MHPMEVENT16, event); break;
1329  case 17: __RV_CSR_WRITE(CSR_MHPMEVENT17, event); break;
1330  case 18: __RV_CSR_WRITE(CSR_MHPMEVENT18, event); break;
1331  case 19: __RV_CSR_WRITE(CSR_MHPMEVENT19, event); break;
1332  case 20: __RV_CSR_WRITE(CSR_MHPMEVENT20, event); break;
1333  case 21: __RV_CSR_WRITE(CSR_MHPMEVENT21, event); break;
1334  case 22: __RV_CSR_WRITE(CSR_MHPMEVENT22, event); break;
1335  case 23: __RV_CSR_WRITE(CSR_MHPMEVENT23, event); break;
1336  case 24: __RV_CSR_WRITE(CSR_MHPMEVENT24, event); break;
1337  case 25: __RV_CSR_WRITE(CSR_MHPMEVENT25, event); break;
1338  case 26: __RV_CSR_WRITE(CSR_MHPMEVENT26, event); break;
1339  case 27: __RV_CSR_WRITE(CSR_MHPMEVENT27, event); break;
1340  case 28: __RV_CSR_WRITE(CSR_MHPMEVENT28, event); break;
1341  case 29: __RV_CSR_WRITE(CSR_MHPMEVENT29, event); break;
1342  case 30: __RV_CSR_WRITE(CSR_MHPMEVENT30, event); break;
1343  case 31: __RV_CSR_WRITE(CSR_MHPMEVENT31, event); break;
1344  default: break;
1345  }
1346 }

References __RV_CSR_WRITE, CSR_MHPMEVENT10, CSR_MHPMEVENT11, CSR_MHPMEVENT12, CSR_MHPMEVENT13, CSR_MHPMEVENT14, CSR_MHPMEVENT15, CSR_MHPMEVENT16, CSR_MHPMEVENT17, CSR_MHPMEVENT18, CSR_MHPMEVENT19, CSR_MHPMEVENT20, CSR_MHPMEVENT21, CSR_MHPMEVENT22, CSR_MHPMEVENT23, CSR_MHPMEVENT24, CSR_MHPMEVENT25, CSR_MHPMEVENT26, CSR_MHPMEVENT27, CSR_MHPMEVENT28, CSR_MHPMEVENT29, CSR_MHPMEVENT3, CSR_MHPMEVENT30, CSR_MHPMEVENT31, CSR_MHPMEVENT4, CSR_MHPMEVENT5, CSR_MHPMEVENT6, CSR_MHPMEVENT7, CSR_MHPMEVENT8, and CSR_MHPMEVENT9.

◆ __set_medeleg()

__STATIC_FORCEINLINE void __set_medeleg ( unsigned long  mask)

Set exceptions delegation to S mode.

Set certain exceptions of supervisor mode or user mode delegated from machined mode to supervisor mode.

Remarks
Exception should trigger in supervisor mode or user mode.

Definition at line 1739 of file core_feature_base.h.

1740 {
1741  __RV_CSR_WRITE(CSR_MEDELEG, mask);
1742 }

References __RV_CSR_WRITE, and CSR_MEDELEG.

◆ __set_wfi_sleepmode()

__STATIC_FORCEINLINE void __set_wfi_sleepmode ( WFI_SleepMode_Type  mode)

Set Sleep mode of WFI.

Set the SLEEPVALUE CSR register to control the WFI Sleep mode.

Parameters
[in]modeThe sleep mode to be set

Definition at line 1181 of file core_feature_base.h.

1182 {
1184 }

References __RV_CSR_WRITE, and CSR_SLEEPVALUE.

◆ __SH()

__STATIC_FORCEINLINE void __SH ( volatile void *  addr,
uint16_t  val 
)

Write 16bit value to address (16 bit)

Write 16 bit value.

Parameters
[in]addrAddress pointer to data
[in]valValue to set

Definition at line 1865 of file core_feature_base.h.

1866 {
1867  __ASM volatile ("sh %0, 0(%1)" : : "r" (val), "r" (addr));
1868 }

References __ASM.

◆ __SW()

__STATIC_FORCEINLINE void __SW ( volatile void *  addr,
uint32_t  val 
)

Write 32bit value to address (32 bit)

Write 32 bit value.

Parameters
[in]addrAddress pointer to data
[in]valValue to set

Definition at line 1876 of file core_feature_base.h.

1877 {
1878  __ASM volatile ("sw %0, 0(%1)" : : "r" (val), "r" (addr));
1879 }

References __ASM.

Referenced by SysTimer_ClearHartSWIRQ(), SysTimer_ClearIPI(), SysTimer_SendIPI(), SysTimer_SetHartCompareValue(), SysTimer_SetHartMsipValue(), SysTimer_SetHartSWIRQ(), and SysTimer_SetLoadValue().

◆ __TXEVT()

__STATIC_FORCEINLINE void __TXEVT ( void  )

Send TX Event.

Set the CSR TXEVT to control send a TX Event. The Core will output signal tx_evt as output event signal.

Definition at line 1192 of file core_feature_base.h.

1193 {
1194  __RV_CSR_SET(CSR_TXEVT, 0x1);
1195 }

References __RV_CSR_SET, and CSR_TXEVT.

◆ __WFE()

__STATIC_FORCEINLINE void __WFE ( void  )

Wait For Event.

Wait For Event is executed using CSR_WFE.WFE=1 and WFI instruction. It will suspends execution until event, NMI or Debug happened. When Core is waked up, Core will resume previous execution

Definition at line 1136 of file core_feature_base.h.

1137 {
1139  __ASM volatile("wfi");
1141 }

References __ASM, __RV_CSR_CLEAR, __RV_CSR_SET, CSR_WFE, and WFE_WFE.

◆ __WFI()

__STATIC_FORCEINLINE void __WFI ( void  )

Wait For Interrupt.

Wait For Interrupt is is executed using CSR_WFE.WFE=0 and WFI instruction. It will suspends execution until interrupt, NMI or Debug happened. When Core is waked up by interrupt, if

  1. mstatus.MIE == 1(interrupt enabled), Core will enter ISR code
  2. mstatus.MIE == 0(interrupt disabled), Core will resume previous execution

Definition at line 1123 of file core_feature_base.h.

1124 {
1126  __ASM volatile("wfi");
1127 }

References __ASM, __RV_CSR_CLEAR, CSR_WFE, and WFE_WFE.

CSR_MHPMCOUNTER9
#define CSR_MHPMCOUNTER9
Definition: riscv_encoding.h:718
MCOUNTINHIBIT_CY
#define MCOUNTINHIBIT_CY
Definition: riscv_encoding.h:208
CSR_MHPMCOUNTER15H
#define CSR_MHPMCOUNTER15H
Definition: riscv_encoding.h:865
CSR_MHPMCOUNTER7
#define CSR_MHPMCOUNTER7
Definition: riscv_encoding.h:716
CSR_TXEVT
#define CSR_TXEVT
Definition: riscv_encoding.h:1017
CSR_MHPMCOUNTER16
#define CSR_MHPMCOUNTER16
Definition: riscv_encoding.h:725
CSR_MHPMEVENT26
#define CSR_MHPMEVENT26
Definition: riscv_encoding.h:764
CSR_MHPMCOUNTER22H
#define CSR_MHPMCOUNTER22H
Definition: riscv_encoding.h:872
CSR_MHPMCOUNTER20H
#define CSR_MHPMCOUNTER20H
Definition: riscv_encoding.h:870
CSR_MHPMCOUNTER23H
#define CSR_MHPMCOUNTER23H
Definition: riscv_encoding.h:873
CSR_MHPMEVENT19
#define CSR_MHPMEVENT19
Definition: riscv_encoding.h:757
CSR_MHPMCOUNTER14
#define CSR_MHPMCOUNTER14
Definition: riscv_encoding.h:723
CSR_MHPMCOUNTER17H
#define CSR_MHPMCOUNTER17H
Definition: riscv_encoding.h:867
CSR_MHPMCOUNTER21
#define CSR_MHPMCOUNTER21
Definition: riscv_encoding.h:730
__RV_CSR_CLEAR
#define __RV_CSR_CLEAR(csr, val)
CSR operation Macro for csrc instruction.
Definition: core_feature_base.h:606
CSR_MHPMEVENT11
#define CSR_MHPMEVENT11
Definition: riscv_encoding.h:749
CSR_MEDELEG
#define CSR_MEDELEG
Definition: riscv_encoding.h:598
CSR_MHPMEVENT6
#define CSR_MHPMEVENT6
Definition: riscv_encoding.h:744
CSR_MHPMCOUNTER22
#define CSR_MHPMCOUNTER22
Definition: riscv_encoding.h:731
CSR_MHPMCOUNTER31
#define CSR_MHPMCOUNTER31
Definition: riscv_encoding.h:740
CSR_MHPMEVENT17
#define CSR_MHPMEVENT17
Definition: riscv_encoding.h:755
CSR_MHPMCOUNTER27H
#define CSR_MHPMCOUNTER27H
Definition: riscv_encoding.h:877
CSR_MHPMCOUNTER13
#define CSR_MHPMCOUNTER13
Definition: riscv_encoding.h:722
CSR_MHPMEVENT9
#define CSR_MHPMEVENT9
Definition: riscv_encoding.h:747
CSR_MHPMCOUNTER10H
#define CSR_MHPMCOUNTER10H
Definition: riscv_encoding.h:860
CSR_MHPMCOUNTER14H
#define CSR_MHPMCOUNTER14H
Definition: riscv_encoding.h:864
CSR_MHPMCOUNTER13H
#define CSR_MHPMCOUNTER13H
Definition: riscv_encoding.h:863
CSR_MHPMCOUNTER20
#define CSR_MHPMCOUNTER20
Definition: riscv_encoding.h:729
CSR_MHPMCOUNTER4
#define CSR_MHPMCOUNTER4
Definition: riscv_encoding.h:713
CSR_MHPMCOUNTER8H
#define CSR_MHPMCOUNTER8H
Definition: riscv_encoding.h:858
CSR_MHPMCOUNTER8
#define CSR_MHPMCOUNTER8
Definition: riscv_encoding.h:717
__RV_CSR_WRITE
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
Definition: core_feature_base.h:532
CSR_MHPMEVENT31
#define CSR_MHPMEVENT31
Definition: riscv_encoding.h:769
CSR_MHPMEVENT14
#define CSR_MHPMEVENT14
Definition: riscv_encoding.h:752
CSR_MHPMEVENT3
#define CSR_MHPMEVENT3
Definition: riscv_encoding.h:741
CSR_MHPMCOUNTER17
#define CSR_MHPMCOUNTER17
Definition: riscv_encoding.h:726
CSR_MHPMEVENT12
#define CSR_MHPMEVENT12
Definition: riscv_encoding.h:750
CSR_MHPMCOUNTER19H
#define CSR_MHPMCOUNTER19H
Definition: riscv_encoding.h:869
CSR_MHPMCOUNTER18H
#define CSR_MHPMCOUNTER18H
Definition: riscv_encoding.h:868
CSR_MHPMEVENT29
#define CSR_MHPMEVENT29
Definition: riscv_encoding.h:767
CSR_MHPMCOUNTER24
#define CSR_MHPMCOUNTER24
Definition: riscv_encoding.h:733
CSR_MHPMEVENT15
#define CSR_MHPMEVENT15
Definition: riscv_encoding.h:753
CSR_MHPMEVENT13
#define CSR_MHPMEVENT13
Definition: riscv_encoding.h:751
CSR_MHPMEVENT27
#define CSR_MHPMEVENT27
Definition: riscv_encoding.h:765
WFE_WFE
#define WFE_WFE
Definition: riscv_encoding.h:203
CSR_MHPMEVENT25
#define CSR_MHPMEVENT25
Definition: riscv_encoding.h:763
CSR_MHPMCOUNTER30H
#define CSR_MHPMCOUNTER30H
Definition: riscv_encoding.h:880
CSR_MHPMEVENT22
#define CSR_MHPMEVENT22
Definition: riscv_encoding.h:760
WFI_SHALLOW_SLEEP
@ WFI_SHALLOW_SLEEP
Shallow sleep mode, the core_clk will poweroff.
Definition: core_feature_base.h:1170
CSR_MHPMEVENT7
#define CSR_MHPMEVENT7
Definition: riscv_encoding.h:745
CSR_MHPMEVENT20
#define CSR_MHPMEVENT20
Definition: riscv_encoding.h:758
CSR_MHPMEVENT5
#define CSR_MHPMEVENT5
Definition: riscv_encoding.h:743
__get_rv_cycle
__STATIC_FORCEINLINE uint64_t __get_rv_cycle(void)
Read whole 64 bits value of mcycle counter.
Definition: core_feature_base.h:930
CSR_MHPMCOUNTER16H
#define CSR_MHPMCOUNTER16H
Definition: riscv_encoding.h:866
CSR_MHPMEVENT16
#define CSR_MHPMEVENT16
Definition: riscv_encoding.h:754
CSR_MHPMCOUNTER4H
#define CSR_MHPMCOUNTER4H
Definition: riscv_encoding.h:854
CSR_MHPMCOUNTER12
#define CSR_MHPMCOUNTER12
Definition: riscv_encoding.h:721
CSR_MHPMCOUNTER28H
#define CSR_MHPMCOUNTER28H
Definition: riscv_encoding.h:878
CSR_MHPMCOUNTER25
#define CSR_MHPMCOUNTER25
Definition: riscv_encoding.h:734
CSR_MHPMEVENT10
#define CSR_MHPMEVENT10
Definition: riscv_encoding.h:748
CSR_MHPMEVENT30
#define CSR_MHPMEVENT30
Definition: riscv_encoding.h:768
CSR_MHPMCOUNTER9H
#define CSR_MHPMCOUNTER9H
Definition: riscv_encoding.h:859
CSR_MHPMCOUNTER11
#define CSR_MHPMCOUNTER11
Definition: riscv_encoding.h:720
MCOUNTINHIBIT_IR
#define MCOUNTINHIBIT_IR
Definition: riscv_encoding.h:207
CSR_MHPMCOUNTER7H
#define CSR_MHPMCOUNTER7H
Definition: riscv_encoding.h:857
CSR_MHPMCOUNTER27
#define CSR_MHPMCOUNTER27
Definition: riscv_encoding.h:736
CSR_MCOUNTINHIBIT
#define CSR_MCOUNTINHIBIT
Definition: riscv_encoding.h:608
CSR_MHPMCOUNTER5H
#define CSR_MHPMCOUNTER5H
Definition: riscv_encoding.h:855
CSR_MHPMCOUNTER29H
#define CSR_MHPMCOUNTER29H
Definition: riscv_encoding.h:879
CSR_MHPMCOUNTER3
#define CSR_MHPMCOUNTER3
Definition: riscv_encoding.h:712
CSR_MHPMCOUNTER12H
#define CSR_MHPMCOUNTER12H
Definition: riscv_encoding.h:862
CSR_MHPMEVENT8
#define CSR_MHPMEVENT8
Definition: riscv_encoding.h:746
CSR_SLEEPVALUE
#define CSR_SLEEPVALUE
Definition: riscv_encoding.h:1016
__RV_CSR_READ
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
Definition: core_feature_base.h:514
CSR_MHPMCOUNTER24H
#define CSR_MHPMCOUNTER24H
Definition: riscv_encoding.h:874
CSR_MHPMCOUNTER5
#define CSR_MHPMCOUNTER5
Definition: riscv_encoding.h:714
CSR_MHPMCOUNTER3H
#define CSR_MHPMCOUNTER3H
Definition: riscv_encoding.h:853
CSR_MHPMCOUNTER15
#define CSR_MHPMCOUNTER15
Definition: riscv_encoding.h:724
CSR_MHPMCOUNTER6
#define CSR_MHPMCOUNTER6
Definition: riscv_encoding.h:715
CSR_MHPMCOUNTER19
#define CSR_MHPMCOUNTER19
Definition: riscv_encoding.h:728
CSR_MHPMEVENT24
#define CSR_MHPMEVENT24
Definition: riscv_encoding.h:762
CSR_MHPMCOUNTER11H
#define CSR_MHPMCOUNTER11H
Definition: riscv_encoding.h:861
CSR_MHPMCOUNTER23
#define CSR_MHPMCOUNTER23
Definition: riscv_encoding.h:732
CSR_MHPMCOUNTER26H
#define CSR_MHPMCOUNTER26H
Definition: riscv_encoding.h:876
__RV_CSR_SET
#define __RV_CSR_SET(csr, val)
CSR operation Macro for csrs instruction.
Definition: core_feature_base.h:569
CSR_MHPMCOUNTER31H
#define CSR_MHPMCOUNTER31H
Definition: riscv_encoding.h:881
CSR_MHPMCOUNTER21H
#define CSR_MHPMCOUNTER21H
Definition: riscv_encoding.h:871
CSR_MHPMEVENT18
#define CSR_MHPMEVENT18
Definition: riscv_encoding.h:756
CSR_MHPMCOUNTER28
#define CSR_MHPMCOUNTER28
Definition: riscv_encoding.h:737
CSR_MHPMCOUNTER29
#define CSR_MHPMCOUNTER29
Definition: riscv_encoding.h:738
CSR_MHPMEVENT28
#define CSR_MHPMEVENT28
Definition: riscv_encoding.h:766
CSR_MHPMCOUNTER30
#define CSR_MHPMCOUNTER30
Definition: riscv_encoding.h:739
CSR_MHPMEVENT4
#define CSR_MHPMEVENT4
Definition: riscv_encoding.h:742
CSR_MHPMCOUNTER25H
#define CSR_MHPMCOUNTER25H
Definition: riscv_encoding.h:875
__ASM
#define __ASM
Pass information from the compiler to the assembler.
Definition: nmsis_gcc.h:55
__get_rv_instret
__STATIC_FORCEINLINE uint64_t __get_rv_instret(void)
Read whole 64 bits value of machine instruction-retired counter.
Definition: core_feature_base.h:974
WFI_DEEP_SLEEP
@ WFI_DEEP_SLEEP
Deep sleep mode, the core_clk and core_ano_clk will poweroff.
Definition: core_feature_base.h:1171
CSR_MHPMCOUNTER10
#define CSR_MHPMCOUNTER10
Definition: riscv_encoding.h:719
CSR_MHPMEVENT23
#define CSR_MHPMEVENT23
Definition: riscv_encoding.h:761
CSR_MHPMCOUNTER18
#define CSR_MHPMCOUNTER18
Definition: riscv_encoding.h:727
CSR_WFE
#define CSR_WFE
Definition: riscv_encoding.h:1018
CSR_MHPMCOUNTER6H
#define CSR_MHPMCOUNTER6H
Definition: riscv_encoding.h:856
CSR_MHPMCOUNTER26
#define CSR_MHPMCOUNTER26
Definition: riscv_encoding.h:735
CSR_MHPMEVENT21
#define CSR_MHPMEVENT21
Definition: riscv_encoding.h:759