NMSIS-Core  Version 1.5.0
NMSIS-Core support for Nuclei processor-based devices
ECC Functions

Functions that related to the ECC feature. More...

Macros

#define ECC_ERROR_RAMID_MASK_ICACHE   1U
 
#define ECC_ERROR_RAMID_MASK_DCACHE   2U
 
#define ECC_ERROR_RAMID_MASK_TLB   4U
 
#define ECC_ERROR_RAMID_MASK_ILM   8U
 
#define ECC_ERROR_RAMID_MASK_DLM   16U
 

Functions

__STATIC_FORCEINLINE int32_t ECC_IsGlobalSupportECC (void)
 Check if the core globally supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsICacheSupportECC (void)
 Check if I-Cache supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDCacheSupportECC (void)
 Check if D-Cache supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsTLBSupportECC (void)
 Check if TLB supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsILMSupportECC (void)
 Check if ILM supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDLMSupportECC (void)
 Check if DLM supports ECC. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsXorErrorInjectMode (void)
 Check if XOR error injection mode is supported. More...
 
__STATIC_FORCEINLINE void ECC_EnableICacheECC (void)
 Enable ECC for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableICacheECC (void)
 Disable ECC for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_EnableICacheECCExcp (void)
 Enable ECC exception for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableICacheECCExcp (void)
 Disable ECC exception for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_EnableICacheECCCheck (void)
 Enable ECC checking for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableICacheECCCheck (void)
 Disable ECC checking for I-Cache. More...
 
__STATIC_FORCEINLINE void ECC_EnableDCacheECC (void)
 Enable ECC for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableDCacheECC (void)
 Disable ECC for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_EnableDCacheECCExcp (void)
 Enable ECC exception for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableDCacheECCExcp (void)
 Disable ECC exception for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_EnableDCacheECCCheck (void)
 Enable ECC checking for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_DisableDCacheECCCheck (void)
 Disable ECC checking for D-Cache. More...
 
__STATIC_FORCEINLINE void ECC_ICacheTRamErrInject (uint32_t ecc_code, void *addr)
 Inject error into I-Cache Tag RAM. More...
 
__STATIC_FORCEINLINE void ECC_ICacheDRamErrInject (uint32_t ecc_code, void *addr)
 Inject error into I-Cache Data RAM. More...
 
__STATIC_FORCEINLINE void ECC_ICacheErrRestore (void *addr)
 Restore I-Cache error at specified address. More...
 
__STATIC_FORCEINLINE void ECC_DCacheTRamErrInject (uint32_t ecc_code, void *addr)
 Inject error into D-Cache Tag RAM. More...
 
__STATIC_FORCEINLINE void ECC_DCacheDRamErrInject (uint32_t ecc_code, void *addr)
 Inject error into D-Cache Data RAM. More...
 
__STATIC_FORCEINLINE void ECC_DCacheErrRestore (void *addr)
 Restore D-Cache error at specified address. More...
 
__STATIC_FORCEINLINE void ECC_EnableILM (void)
 Enable ILM. More...
 
__STATIC_FORCEINLINE void ECC_DisableILM (void)
 Disable ILM. More...
 
__STATIC_FORCEINLINE void ECC_EnableILMECC (void)
 Enable ECC for ILM. More...
 
__STATIC_FORCEINLINE void ECC_DisableILMECC (void)
 Disable ECC for ILM. More...
 
__STATIC_FORCEINLINE void ECC_EnableILMECCExcp (void)
 Enable ECC exception for ILM. More...
 
__STATIC_FORCEINLINE void ECC_DisableILMECCExcp (void)
 Disable ECC exception for ILM. More...
 
__STATIC_FORCEINLINE void ECC_EnableILMECCCheck (void)
 Enable ECC checking for ILM. More...
 
__STATIC_FORCEINLINE void ECC_DisableILMECCCheck (void)
 Disable ECC checking for ILM. More...
 
__STATIC_FORCEINLINE void ECC_ILMErrInject (uint32_t ecc_code, void *addr)
 Inject error into ILM. More...
 
__STATIC_FORCEINLINE void ECC_ILMErrRestore (void *addr)
 Restore ILM error at specified address. More...
 
__STATIC_FORCEINLINE void ECC_EnableDLM (void)
 Enable DLM. More...
 
__STATIC_FORCEINLINE void ECC_DisableDLM (void)
 Disable DLM. More...
 
__STATIC_FORCEINLINE void ECC_EnableDLMECC (void)
 Enable ECC for DLM. More...
 
__STATIC_FORCEINLINE void ECC_DisableDLMECC (void)
 Disable ECC for DLM. More...
 
__STATIC_FORCEINLINE void ECC_EnableDLMECCExcp (void)
 Enable ECC exception for DLM. More...
 
__STATIC_FORCEINLINE void ECC_DisableDLMECCExcp (void)
 Disable ECC exception for DLM. More...
 
__STATIC_FORCEINLINE void ECC_EnableDLMECCCheck (void)
 Enable ECC checking for DLM. More...
 
__STATIC_FORCEINLINE void ECC_DisableDLMECCCheck (void)
 Disable ECC checking for DLM. More...
 
__STATIC_FORCEINLINE void ECC_DLMErrInject (uint32_t ecc_code, void *addr)
 Inject error into DLM. More...
 
__STATIC_FORCEINLINE void ECC_DLMErrRestore (void *addr)
 Restore DLM error at specified address. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsAnySingleBitErrorOccured (void)
 Check if any single-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsICacheSingleBitErrorOccured (void)
 Check if I-Cache single-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDCacheSingleBitErrorOccured (void)
 Check if D-Cache single-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsTLBSingleBitErrorOccured (void)
 Check if TLB single-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsILMSingleBitErrorOccured (void)
 Check if ILM single-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDLMSingleBitErrorOccured (void)
 Check if DLM single-bit error has occurred. More...
 
__STATIC_FORCEINLINE void ECC_ClearAllSingleBitError (void)
 Clear all single-bit errors. More...
 
__STATIC_FORCEINLINE void ECC_ClearICacheSingleBitError (void)
 Clear I-Cache single-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearDCacheSingleBitError (void)
 Clear D-Cache single-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearTLBSingleBitError (void)
 Clear TLB single-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearILMSingleBitError (void)
 Clear ILM single-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearDLMSingleBitError (void)
 Clear DLM single-bit error. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsAnyDoubleBitErrorOccured (void)
 Check if any double-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsICacheDoubleBitErrorOccured (void)
 Check if I-Cache double-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDCacheDoubleBitErrorOccured (void)
 Check if D-Cache double-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsTLBDoubleBitErrorOccured (void)
 Check if TLB double-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsILMDoubleBitErrorOccured (void)
 Check if ILM double-bit error has occurred. More...
 
__STATIC_FORCEINLINE int32_t ECC_IsDLMDoubleBitErrorOccured (void)
 Check if DLM double-bit error has occurred. More...
 
__STATIC_FORCEINLINE void ECC_ClearAllDoubleBitError (void)
 Clear all double-bit errors. More...
 
__STATIC_FORCEINLINE void ECC_ClearICacheDoubleBitError (void)
 Clear I-Cache double-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearDCacheDoubleBitError (void)
 Clear D-Cache double-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearTLBDoubleBitError (void)
 Clear TLB double-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearILMDoubleBitError (void)
 Clear ILM double-bit error. More...
 
__STATIC_FORCEINLINE void ECC_ClearDLMDoubleBitError (void)
 Clear DLM double-bit error. More...
 
static uint8_t ECC_GenerateECCCodeU32 (uint32_t a)
 Generate ECC code for a 32-bit value. More...
 
static uint8_t ECC_GenerateECCCodeU64 (uint64_t a)
 Generate ECC code for a 64-bit value. More...
 

Detailed Description

Functions that related to the ECC feature.

These functions provide access to the Error Correction Code (ECC) feature available in Nuclei N/NX processor cores. ECC is a memory protection mechanism that can detect and correct single-bit errors and detect double-bit errors in memory systems such as caches and local memories.

The ECC feature includes:

Macro Definition Documentation

◆ ECC_ERROR_RAMID_MASK_DCACHE

#define ECC_ERROR_RAMID_MASK_DCACHE   2U

Definition at line 654 of file core_feature_ecc.h.

◆ ECC_ERROR_RAMID_MASK_DLM

#define ECC_ERROR_RAMID_MASK_DLM   16U

Definition at line 657 of file core_feature_ecc.h.

◆ ECC_ERROR_RAMID_MASK_ICACHE

#define ECC_ERROR_RAMID_MASK_ICACHE   1U

Definition at line 653 of file core_feature_ecc.h.

◆ ECC_ERROR_RAMID_MASK_ILM

#define ECC_ERROR_RAMID_MASK_ILM   8U

Definition at line 656 of file core_feature_ecc.h.

◆ ECC_ERROR_RAMID_MASK_TLB

#define ECC_ERROR_RAMID_MASK_TLB   4U

Definition at line 655 of file core_feature_ecc.h.

Function Documentation

◆ ECC_ClearAllDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearAllDoubleBitError ( void  )

Clear all double-bit errors.

This function clears all double-bit errors by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 887 of file core_feature_ecc.h.

888 {
890 }
#define MECC_CODE_RAMID
#define __RV_CSR_CLEAR(csr, val)
CSR operation Macro for csrc instruction.
#define CSR_MECC_CODE

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID.

◆ ECC_ClearAllSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearAllSingleBitError ( void  )

Clear all single-bit errors.

This function clears all single-bit errors by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 743 of file core_feature_ecc.h.

744 {
746 }
#define MECC_CODE_SRAMID

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID.

◆ ECC_ClearDCacheDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearDCacheDoubleBitError ( void  )

Clear D-Cache double-bit error.

This function clears the double-bit error in the D-Cache by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 909 of file core_feature_ecc.h.

910 {
912 }
#define MECC_CODE_RAMID_DC

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID_DC.

◆ ECC_ClearDCacheSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearDCacheSingleBitError ( void  )

Clear D-Cache single-bit error.

This function clears the single-bit error in the D-Cache by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 765 of file core_feature_ecc.h.

766 {
768 }
#define MECC_CODE_SRAMID_DC

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID_DC.

◆ ECC_ClearDLMDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearDLMDoubleBitError ( void  )

Clear DLM double-bit error.

This function clears the double-bit error in the DLM by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 942 of file core_feature_ecc.h.

943 {
945 }
#define MECC_CODE_RAMID_DLM

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID_DLM.

◆ ECC_ClearDLMSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearDLMSingleBitError ( void  )

Clear DLM single-bit error.

This function clears the single-bit error in the DLM by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 798 of file core_feature_ecc.h.

799 {
801 }
#define MECC_CODE_SRAMID_DLM

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID_DLM.

◆ ECC_ClearICacheDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearICacheDoubleBitError ( void  )

Clear I-Cache double-bit error.

This function clears the double-bit error in the I-Cache by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 898 of file core_feature_ecc.h.

899 {
901 }
#define MECC_CODE_RAMID_IC

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID_IC.

◆ ECC_ClearICacheSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearICacheSingleBitError ( void  )

Clear I-Cache single-bit error.

This function clears the single-bit error in the I-Cache by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 754 of file core_feature_ecc.h.

755 {
757 }
#define MECC_CODE_SRAMID_IC

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID_IC.

◆ ECC_ClearILMDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearILMDoubleBitError ( void  )

Clear ILM double-bit error.

This function clears the double-bit error in the ILM by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 931 of file core_feature_ecc.h.

932 {
934 }
#define MECC_CODE_RAMID_ILM

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID_ILM.

◆ ECC_ClearILMSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearILMSingleBitError ( void  )

Clear ILM single-bit error.

This function clears the single-bit error in the ILM by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 787 of file core_feature_ecc.h.

788 {
790 }
#define MECC_CODE_SRAMID_ILM

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID_ILM.

◆ ECC_ClearTLBDoubleBitError()

__STATIC_FORCEINLINE void ECC_ClearTLBDoubleBitError ( void  )

Clear TLB double-bit error.

This function clears the double-bit error in the TLB by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 920 of file core_feature_ecc.h.

921 {
923 }
#define MECC_CODE_RAMID_TLB

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_RAMID_TLB.

◆ ECC_ClearTLBSingleBitError()

__STATIC_FORCEINLINE void ECC_ClearTLBSingleBitError ( void  )

Clear TLB single-bit error.

This function clears the single-bit error in the TLB by clearing the appropriate bits in the machine ECC code CSR.

Definition at line 776 of file core_feature_ecc.h.

777 {
779 }
#define MECC_CODE_SRAMID_TLB

References __RV_CSR_CLEAR, CSR_MECC_CODE, and MECC_CODE_SRAMID_TLB.

◆ ECC_DCacheDRamErrInject()

__STATIC_FORCEINLINE void ECC_DCacheDRamErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into D-Cache Data RAM.

This function injects an error into the D-Cache Data RAM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 389 of file core_feature_ecc.h.

390 {
391  /* Write ecc_code into mecc_code csr also clear all error status */
392  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
394  MFlushInvalDCacheLine((unsigned long)addr);
395  __RWMB();
397  MLockDCacheLine((unsigned long)addr);
399  __RWMB();
401 }
#define MCACHE_CTL_DC_DRAM_ECC_INJ_EN
#define __RWMB()
Read & Write Memory barrier.
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
#define __RV_CSR_SET(csr, val)
CSR operation Macro for csrs instruction.
#define CSR_MCACHE_CTL
__STATIC_INLINE void MFlushInvalDCacheLine(unsigned long addr)
Flush and invalidate one D-Cache line specified by address in M-Mode.
__STATIC_INLINE unsigned long MLockDCacheLine(unsigned long addr)
Lock one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void ECC_EnableDCacheECCCheck(void)
Enable ECC checking for D-Cache.
__STATIC_FORCEINLINE void ECC_DisableDCacheECCCheck(void)
Disable ECC checking for D-Cache.

References __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, CSR_MCACHE_CTL, CSR_MECC_CODE, ECC_DisableDCacheECCCheck(), ECC_EnableDCacheECCCheck(), MCACHE_CTL_DC_DRAM_ECC_INJ_EN, MFlushInvalDCacheLine(), and MLockDCacheLine().

◆ ECC_DCacheErrRestore()

__STATIC_FORCEINLINE void ECC_DCacheErrRestore ( void *  addr)

Restore D-Cache error at specified address.

This function restores the correct ECC code for the D-Cache line at the specified address.

Parameters
[in]addrAddress to restore

Definition at line 409 of file core_feature_ecc.h.

410 {
412  MFlushInvalDCacheLine((unsigned long)addr);
413  MLockDCacheLine((unsigned long)addr);
415 }

References ECC_DisableDCacheECCCheck(), ECC_EnableDCacheECCCheck(), MFlushInvalDCacheLine(), and MLockDCacheLine().

◆ ECC_DCacheTRamErrInject()

__STATIC_FORCEINLINE void ECC_DCacheTRamErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into D-Cache Tag RAM.

This function injects an error into the D-Cache Tag RAM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 367 of file core_feature_ecc.h.

368 {
369  /* Write ecc_code into mecc_code csr also clear all error status */
370  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
372  MFlushInvalDCacheLine((unsigned long)addr);
373  __RWMB();
375  MLockDCacheLine((unsigned long)addr);
377  __RWMB();
379 }
#define MCACHE_CTL_DC_TRAM_ECC_INJ_EN

References __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, CSR_MCACHE_CTL, CSR_MECC_CODE, ECC_DisableDCacheECCCheck(), ECC_EnableDCacheECCCheck(), MCACHE_CTL_DC_TRAM_ECC_INJ_EN, MFlushInvalDCacheLine(), and MLockDCacheLine().

◆ ECC_DisableDCacheECC()

__STATIC_FORCEINLINE void ECC_DisableDCacheECC ( void  )

Disable ECC for D-Cache.

This function disables ECC for the data cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 253 of file core_feature_ecc.h.

254 {
256 }
#define MCACHE_CTL_DC_ECC_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ ECC_DisableDCacheECCCheck()

__STATIC_FORCEINLINE void ECC_DisableDCacheECCCheck ( void  )

Disable ECC checking for D-Cache.

This function disables ECC checking for the data cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 297 of file core_feature_ecc.h.

298 {
300 }
#define MCACHE_CTL_DC_ECC_CHK_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_CHK_EN.

Referenced by ECC_DCacheDRamErrInject(), ECC_DCacheErrRestore(), and ECC_DCacheTRamErrInject().

◆ ECC_DisableDCacheECCExcp()

__STATIC_FORCEINLINE void ECC_DisableDCacheECCExcp ( void  )

Disable ECC exception for D-Cache.

This function disables ECC exception for the data cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 275 of file core_feature_ecc.h.

276 {
278 }
#define MCACHE_CTL_DC_ECC_EXCP_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EXCP_EN.

◆ ECC_DisableDLM()

__STATIC_FORCEINLINE void ECC_DisableDLM ( void  )

Disable DLM.

This function disables DLM by clearing the appropriate bit in the machine DLM control CSR.

Definition at line 551 of file core_feature_ecc.h.

552 {
554 }
#define MDLM_CTL_DLM_EN
#define CSR_MDLM_CTL

References __RV_CSR_CLEAR, CSR_MDLM_CTL, and MDLM_CTL_DLM_EN.

◆ ECC_DisableDLMECC()

__STATIC_FORCEINLINE void ECC_DisableDLMECC ( void  )

Disable ECC for DLM.

This function disables ECC for DLM by clearing the appropriate bit in the machine DLM control CSR.

Definition at line 571 of file core_feature_ecc.h.

572 {
574 }
#define MDLM_CTL_DLM_ECC_EN

References __RV_CSR_CLEAR, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_EN.

◆ ECC_DisableDLMECCCheck()

__STATIC_FORCEINLINE void ECC_DisableDLMECCCheck ( void  )

Disable ECC checking for DLM.

This function disables ECC checking for DLM by clearing the appropriate bit in the machine DLM control CSR.

Definition at line 611 of file core_feature_ecc.h.

612 {
614 }
#define MDLM_CTL_DLM_ECC_CHK_EN

References __RV_CSR_CLEAR, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_CHK_EN.

Referenced by ECC_DLMErrInject(), and ECC_DLMErrRestore().

◆ ECC_DisableDLMECCExcp()

__STATIC_FORCEINLINE void ECC_DisableDLMECCExcp ( void  )

Disable ECC exception for DLM.

This function disables ECC exception for DLM by clearing the appropriate bit in the machine DLM control CSR.

Definition at line 591 of file core_feature_ecc.h.

592 {
594 }
#define MDLM_CTL_DLM_ECC_EXCP_EN

References __RV_CSR_CLEAR, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_EXCP_EN.

◆ ECC_DisableICacheECC()

__STATIC_FORCEINLINE void ECC_DisableICacheECC ( void  )

Disable ECC for I-Cache.

This function disables ECC for the instruction cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 187 of file core_feature_ecc.h.

188 {
190 }
#define MCACHE_CTL_IC_ECC_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EN.

◆ ECC_DisableICacheECCCheck()

__STATIC_FORCEINLINE void ECC_DisableICacheECCCheck ( void  )

Disable ECC checking for I-Cache.

This function disables ECC checking for the instruction cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 231 of file core_feature_ecc.h.

232 {
234 }
#define MCACHE_CTL_IC_ECC_CHK_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_CHK_EN.

◆ ECC_DisableICacheECCExcp()

__STATIC_FORCEINLINE void ECC_DisableICacheECCExcp ( void  )

Disable ECC exception for I-Cache.

This function disables ECC exception for the instruction cache by clearing the appropriate bit in the machine cache control CSR.

Definition at line 209 of file core_feature_ecc.h.

210 {
212 }
#define MCACHE_CTL_IC_ECC_EXCP_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EXCP_EN.

◆ ECC_DisableILM()

__STATIC_FORCEINLINE void ECC_DisableILM ( void  )

Disable ILM.

This function disables ILM by clearing the appropriate bit in the machine ILM control CSR.

Definition at line 434 of file core_feature_ecc.h.

435 {
437 }
#define MILM_CTL_ILM_EN
#define CSR_MILM_CTL

References __RV_CSR_CLEAR, CSR_MILM_CTL, and MILM_CTL_ILM_EN.

◆ ECC_DisableILMECC()

__STATIC_FORCEINLINE void ECC_DisableILMECC ( void  )

Disable ECC for ILM.

This function disables ECC for ILM by clearing the appropriate bit in the machine ILM control CSR.

Definition at line 454 of file core_feature_ecc.h.

455 {
457 }
#define MILM_CTL_ILM_ECC_EN

References __RV_CSR_CLEAR, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_EN.

◆ ECC_DisableILMECCCheck()

__STATIC_FORCEINLINE void ECC_DisableILMECCCheck ( void  )

Disable ECC checking for ILM.

This function disables ECC checking for ILM by clearing the appropriate bit in the machine ILM control CSR.

Definition at line 494 of file core_feature_ecc.h.

495 {
497 }
#define MILM_CTL_ILM_ECC_CHK_EN

References __RV_CSR_CLEAR, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_CHK_EN.

Referenced by ECC_ILMErrInject(), and ECC_ILMErrRestore().

◆ ECC_DisableILMECCExcp()

__STATIC_FORCEINLINE void ECC_DisableILMECCExcp ( void  )

Disable ECC exception for ILM.

This function disables ECC exception for ILM by clearing the appropriate bit in the machine ILM control CSR.

Definition at line 474 of file core_feature_ecc.h.

475 {
477 }
#define MILM_CTL_ILM_ECC_EXCP_EN

References __RV_CSR_CLEAR, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_EXCP_EN.

◆ ECC_DLMErrInject()

__STATIC_FORCEINLINE void ECC_DLMErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into DLM.

This function injects an error into the DLM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 623 of file core_feature_ecc.h.

624 {
625  /* Write ecc_code into mecc_code csr also clear all error status */
626  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
628  uint32_t val = __LW(addr);
629  __RWMB(); // make sure setting the ECC_INJ_EN bit before any other memory access
631  __SW(addr, val);
632  __RWMB(); // make sure the error injection is finished
634  __RWMB(); // make sure clearing the ECC_INJ_EN bit before any other memory access
636 }
__STATIC_FORCEINLINE void __SW(volatile void *addr, uint32_t val)
Write 32bit value to address (32 bit)
__STATIC_FORCEINLINE uint32_t __LW(volatile void *addr)
Load 32bit value from address (32 bit)
#define MDLM_CTL_DLM_ECC_INJ_EN
__STATIC_FORCEINLINE void ECC_DisableDLMECCCheck(void)
Disable ECC checking for DLM.
__STATIC_FORCEINLINE void ECC_EnableDLMECCCheck(void)
Enable ECC checking for DLM.

References __LW(), __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, __SW(), CSR_MDLM_CTL, CSR_MECC_CODE, ECC_DisableDLMECCCheck(), ECC_EnableDLMECCCheck(), and MDLM_CTL_DLM_ECC_INJ_EN.

◆ ECC_DLMErrRestore()

__STATIC_FORCEINLINE void ECC_DLMErrRestore ( void *  addr)

Restore DLM error at specified address.

This function restores the correct ECC code for the DLM at the specified address.

Parameters
[in]addrAddress to restore

Definition at line 644 of file core_feature_ecc.h.

645 {
647  __RWMB();
648  __SW(addr, __LW(addr));
649  __RWMB();
651 }

References __LW(), __RWMB, __SW(), ECC_DisableDLMECCCheck(), and ECC_EnableDLMECCCheck().

◆ ECC_EnableDCacheECC()

__STATIC_FORCEINLINE void ECC_EnableDCacheECC ( void  )

Enable ECC for D-Cache.

This function enables ECC for the data cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 242 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ ECC_EnableDCacheECCCheck()

__STATIC_FORCEINLINE void ECC_EnableDCacheECCCheck ( void  )

Enable ECC checking for D-Cache.

This function enables ECC checking for the data cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 286 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_CHK_EN.

Referenced by ECC_DCacheDRamErrInject(), ECC_DCacheErrRestore(), and ECC_DCacheTRamErrInject().

◆ ECC_EnableDCacheECCExcp()

__STATIC_FORCEINLINE void ECC_EnableDCacheECCExcp ( void  )

Enable ECC exception for D-Cache.

This function enables ECC exception for the data cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 264 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EXCP_EN.

◆ ECC_EnableDLM()

__STATIC_FORCEINLINE void ECC_EnableDLM ( void  )

Enable DLM.

This function enables DLM by setting the appropriate bit in the machine DLM control CSR.

Definition at line 541 of file core_feature_ecc.h.

542 {
544 }

References __RV_CSR_SET, CSR_MDLM_CTL, and MDLM_CTL_DLM_EN.

◆ ECC_EnableDLMECC()

__STATIC_FORCEINLINE void ECC_EnableDLMECC ( void  )

Enable ECC for DLM.

This function enables ECC for DLM by setting the appropriate bit in the machine DLM control CSR.

Definition at line 561 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_EN.

◆ ECC_EnableDLMECCCheck()

__STATIC_FORCEINLINE void ECC_EnableDLMECCCheck ( void  )

Enable ECC checking for DLM.

This function enables ECC checking for DLM by setting the appropriate bit in the machine DLM control CSR.

Definition at line 601 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_CHK_EN.

Referenced by ECC_DLMErrInject(), and ECC_DLMErrRestore().

◆ ECC_EnableDLMECCExcp()

__STATIC_FORCEINLINE void ECC_EnableDLMECCExcp ( void  )

Enable ECC exception for DLM.

This function enables ECC exception for DLM by setting the appropriate bit in the machine DLM control CSR.

Definition at line 581 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MDLM_CTL, and MDLM_CTL_DLM_ECC_EXCP_EN.

◆ ECC_EnableICacheECC()

__STATIC_FORCEINLINE void ECC_EnableICacheECC ( void  )

Enable ECC for I-Cache.

This function enables ECC for the instruction cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 176 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EN.

◆ ECC_EnableICacheECCCheck()

__STATIC_FORCEINLINE void ECC_EnableICacheECCCheck ( void  )

Enable ECC checking for I-Cache.

This function enables ECC checking for the instruction cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 220 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_CHK_EN.

◆ ECC_EnableICacheECCExcp()

__STATIC_FORCEINLINE void ECC_EnableICacheECCExcp ( void  )

Enable ECC exception for I-Cache.

This function enables ECC exception for the instruction cache by setting the appropriate bit in the machine cache control CSR.

Definition at line 198 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EXCP_EN.

◆ ECC_EnableILM()

__STATIC_FORCEINLINE void ECC_EnableILM ( void  )

Enable ILM.

This function enables ILM by setting the appropriate bit in the machine ILM control CSR.

Definition at line 424 of file core_feature_ecc.h.

425 {
427 }

References __RV_CSR_SET, CSR_MILM_CTL, and MILM_CTL_ILM_EN.

◆ ECC_EnableILMECC()

__STATIC_FORCEINLINE void ECC_EnableILMECC ( void  )

Enable ECC for ILM.

This function enables ECC for ILM by setting the appropriate bit in the machine ILM control CSR.

Definition at line 444 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_EN.

◆ ECC_EnableILMECCCheck()

__STATIC_FORCEINLINE void ECC_EnableILMECCCheck ( void  )

Enable ECC checking for ILM.

This function enables ECC checking for ILM by setting the appropriate bit in the machine ILM control CSR.

Definition at line 484 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_CHK_EN.

Referenced by ECC_ILMErrInject(), and ECC_ILMErrRestore().

◆ ECC_EnableILMECCExcp()

__STATIC_FORCEINLINE void ECC_EnableILMECCExcp ( void  )

Enable ECC exception for ILM.

This function enables ECC exception for ILM by setting the appropriate bit in the machine ILM control CSR.

Definition at line 464 of file core_feature_ecc.h.

References __RV_CSR_SET, CSR_MILM_CTL, and MILM_CTL_ILM_ECC_EXCP_EN.

◆ ECC_GenerateECCCodeU32()

static uint8_t ECC_GenerateECCCodeU32 ( uint32_t  a)
static

Generate ECC code for a 32-bit value.

This function calculates the ECC code for a 32-bit input value using Hamming code algorithm. It generates a 7-bit ECC code that can be used to detect and correct single-bit errors and detect double-bit errors.

Parameters
[in]a32-bit value for which ECC code is to be generated
Returns
8-bit ECC code (7 bits used, 1 bit unused)

Definition at line 956 of file core_feature_ecc.h.

957 {
958  uint8_t ecc_bits = 0;
959  uint8_t ecc_bit_0 = ((a >> 0) & 1) ^ ((a >> 1) & 1) ^ ((a >> 3) & 1) ^ ((a >> 4) & 1) ^
960  ((a >> 6) & 1) ^ ((a >> 8) & 1) ^ ((a >> 10) & 1) ^ ((a >> 12) & 1) ^
961  ((a >> 14) & 1) ^ ((a >> 17) & 1) ^ ((a >> 19) & 1) ^ ((a >> 20) & 1) ^
962  ((a >> 24) & 1) ^ ((a >> 28) & 1);
963  uint8_t ecc_bit_1 = ((a >> 0) & 1) ^ ((a >> 2) & 1) ^ ((a >> 3) & 1) ^ ((a >> 5) & 1) ^
964  ((a >> 6) & 1) ^ ((a >> 9) & 1) ^ ((a >> 11) & 1) ^ ((a >> 12) & 1) ^
965  ((a >> 15) & 1) ^ ((a >> 20) & 1) ^ ((a >> 22) & 1) ^ ((a >> 25) & 1) ^
966  ((a >> 29) & 1);
967  uint8_t ecc_bit_2 = ((a >> 1) & 1) ^ ((a >> 2) & 1) ^ ((a >> 3) & 1) ^ ((a >> 7) & 1) ^
968  ((a >> 8) & 1) ^ ((a >> 9) & 1) ^ ((a >> 13) & 1) ^ ((a >> 14) & 1) ^
969  ((a >> 15) & 1) ^ ((a >> 18) & 1) ^ ((a >> 21) & 1) ^ ((a >> 22) & 1) ^
970  ((a >> 26) & 1) ^ ((a >> 30) & 1);
971  uint8_t ecc_bit_3 = ((a >> 4) & 1) ^ ((a >> 5) & 1) ^ ((a >> 6) & 1) ^ ((a >> 7) & 1) ^
972  ((a >> 8) & 1) ^ ((a >> 9) & 1) ^ ((a >> 16) & 1) ^ ((a >> 17) & 1) ^
973  ((a >> 18) & 1) ^ ((a >> 23) & 1) ^ ((a >> 24) & 1) ^ ((a >> 25) & 1) ^
974  ((a >> 26) & 1) ^ ((a >> 31) & 1);
975  uint8_t ecc_bit_4 = ((a >> 10) & 1) ^ ((a >> 11) & 1) ^ ((a >> 12) & 1) ^ ((a >> 13) & 1) ^
976  ((a >> 14) & 1) ^ ((a >> 15) & 1) ^ ((a >> 16) & 1) ^ ((a >> 17) & 1) ^
977  ((a >> 18) & 1) ^ ((a >> 27) & 1) ^ ((a >> 28) & 1) ^ ((a >> 29) & 1) ^
978  ((a >> 30) & 1) ^ ((a >> 31) & 1);
979  uint8_t ecc_bit_5 = ((a >> 19) & 1) ^ ((a >> 20) & 1) ^ ((a >> 21) & 1) ^ ((a >> 22) & 1) ^
980  ((a >> 23) & 1) ^ ((a >> 24) & 1) ^ ((a >> 25) & 1) ^ ((a >> 26) & 1) ^
981  ((a >> 27) & 1) ^ ((a >> 28) & 1) ^ ((a >> 29) & 1) ^ ((a >> 30) & 1) ^
982  ((a >> 31) & 1);
983  uint8_t ecc_bit_6 = ((a >> 0) & 1) ^ ((a >> 1) & 1) ^ ((a >> 2) & 1) ^ ((a >> 4) & 1) ^
984  ((a >> 5) & 1) ^ ((a >> 7) & 1) ^ ((a >> 10) & 1) ^ ((a >> 11) & 1) ^
985  ((a >> 13) & 1) ^ ((a >> 16) & 1) ^ ((a >> 19) & 1) ^ ((a >> 21) & 1) ^
986  ((a >> 23) & 1) ^ ((a >> 27) & 1);
987  ecc_bits = (ecc_bit_6 << 6) | (ecc_bit_5 << 5) | (ecc_bit_4 << 4) | (ecc_bit_3 << 3) |
988  (ecc_bit_2 << 2) | (ecc_bit_1 << 1) | ecc_bit_0;
989  return ecc_bits;
990 }

◆ ECC_GenerateECCCodeU64()

static uint8_t ECC_GenerateECCCodeU64 ( uint64_t  a)
static

Generate ECC code for a 64-bit value.

This function calculates the ECC for a 64-bit input value using Hamming code algorithm. It generates an 8-bit ECC code that can be used to detect and correct single-bit errors and detect double-bit errors.

Parameters
[in]a64-bit value for which ECC code is to be generated
Returns
8-bit ECC code

Definition at line 1001 of file core_feature_ecc.h.

1002 {
1003  uint8_t ecc_bits = 0;
1004  uint8_t ecc_bit_0 =
1005  (((a >> 0) & 1) ^ ((a >> 1) & 1) ^ ((a >> 3) & 1) ^ ((a >> 4) & 1) ^ ((a >> 6) & 1) ^
1006  ((a >> 8) & 1) ^ ((a >> 10) & 1) ^ ((a >> 12) & 1) ^ ((a >> 14) & 1) ^ ((a >> 17) & 1) ^
1007  ((a >> 20) & 1) ^ ((a >> 22) & 1) ^ ((a >> 24) & 1) ^ ((a >> 27) & 1) ^ ((a >> 30) & 1) ^
1008  ((a >> 32) & 1) ^ ((a >> 36) & 1) ^ ((a >> 37) & 1) ^ ((a >> 38) & 1) ^ ((a >> 40) & 1) ^
1009  ((a >> 42) & 1) ^ ((a >> 45) & 1) ^ ((a >> 47) & 1) ^ ((a >> 51) & 1) ^ ((a >> 54) & 1) ^
1010  ((a >> 57) & 1));
1011  uint8_t ecc_bit_1 =
1012  (((a >> 0) & 1) ^ ((a >> 2) & 1) ^ ((a >> 3) & 1) ^ ((a >> 5) & 1) ^ ((a >> 6) & 1) ^
1013  ((a >> 9) & 1) ^ ((a >> 11) & 1) ^ ((a >> 12) & 1) ^ ((a >> 15) & 1) ^ ((a >> 18) & 1) ^
1014  ((a >> 21) & 1) ^ ((a >> 22) & 1) ^ ((a >> 25) & 1) ^ ((a >> 28) & 1) ^ ((a >> 30) & 1) ^
1015  ((a >> 33) & 1) ^ ((a >> 37) & 1) ^ ((a >> 39) & 1) ^ ((a >> 40) & 1) ^ ((a >> 43) & 1) ^
1016  ((a >> 46) & 1) ^ ((a >> 47) & 1) ^ ((a >> 49) & 1) ^ ((a >> 52) & 1) ^ ((a >> 58) & 1) ^
1017  ((a >> 63) & 1));
1018  uint8_t ecc_bit_2 =
1019  (((a >> 1) & 1) ^ ((a >> 2) & 1) ^ ((a >> 3) & 1) ^ ((a >> 7) & 1) ^ ((a >> 8) & 1) ^
1020  ((a >> 9) & 1) ^ ((a >> 13) & 1) ^ ((a >> 14) & 1) ^ ((a >> 15) & 1) ^ ((a >> 19) & 1) ^
1021  ((a >> 23) & 1) ^ ((a >> 24) & 1) ^ ((a >> 25) & 1) ^ ((a >> 29) & 1) ^ ((a >> 30) & 1) ^
1022  ((a >> 34) & 1) ^ ((a >> 41) & 1) ^ ((a >> 42) & 1) ^ ((a >> 43) & 1) ^ ((a >> 48) & 1) ^
1023  ((a >> 49) & 1) ^ ((a >> 53) & 1) ^ ((a >> 54) & 1) ^ ((a >> 59) & 1) ^ ((a >> 62) & 1) ^
1024  ((a >> 63) & 1));
1025  uint8_t ecc_bit_3 =
1026  (((a >> 4) & 1) ^ ((a >> 5) & 1) ^ ((a >> 6) & 1) ^ ((a >> 7) & 1) ^ ((a >> 8) & 1) ^
1027  ((a >> 9) & 1) ^ ((a >> 16) & 1) ^ ((a >> 17) & 1) ^ ((a >> 18) & 1) ^ ((a >> 19) & 1) ^
1028  ((a >> 26) & 1) ^ ((a >> 27) & 1) ^ ((a >> 28) & 1) ^ ((a >> 29) & 1) ^ ((a >> 30) & 1) ^
1029  ((a >> 35) & 1) ^ ((a >> 36) & 1) ^ ((a >> 37) & 1) ^ ((a >> 44) & 1) ^ ((a >> 45) & 1) ^
1030  ((a >> 46) & 1) ^ ((a >> 47) & 1) ^ ((a >> 48) & 1) ^ ((a >> 49) & 1) ^ ((a >> 55) & 1) ^
1031  ((a >> 60) & 1));
1032  uint8_t ecc_bit_4 =
1033  (((a >> 10) & 1) ^ ((a >> 11) & 1) ^ ((a >> 12) & 1) ^ ((a >> 13) & 1) ^ ((a >> 14) & 1) ^
1034  ((a >> 15) & 1) ^ ((a >> 16) & 1) ^ ((a >> 17) & 1) ^ ((a >> 18) & 1) ^ ((a >> 19) & 1) ^
1035  ((a >> 31) & 1) ^ ((a >> 32) & 1) ^ ((a >> 33) & 1) ^ ((a >> 34) & 1) ^ ((a >> 35) & 1) ^
1036  ((a >> 36) & 1) ^ ((a >> 37) & 1) ^ ((a >> 50) & 1) ^ ((a >> 51) & 1) ^ ((a >> 52) & 1) ^
1037  ((a >> 53) & 1) ^ ((a >> 54) & 1) ^ ((a >> 55) & 1) ^ ((a >> 61) & 1) ^ ((a >> 62) & 1) ^
1038  ((a >> 63) & 1));
1039  uint8_t ecc_bit_5 =
1040  (((a >> 20) & 1) ^ ((a >> 21) & 1) ^ ((a >> 22) & 1) ^ ((a >> 23) & 1) ^ ((a >> 24) & 1) ^
1041  ((a >> 25) & 1) ^ ((a >> 26) & 1) ^ ((a >> 27) & 1) ^ ((a >> 28) & 1) ^ ((a >> 29) & 1) ^
1042  ((a >> 30) & 1) ^ ((a >> 31) & 1) ^ ((a >> 32) & 1) ^ ((a >> 33) & 1) ^ ((a >> 34) & 1) ^
1043  ((a >> 35) & 1) ^ ((a >> 36) & 1) ^ ((a >> 37) & 1) ^ ((a >> 56) & 1) ^ ((a >> 57) & 1) ^
1044  ((a >> 58) & 1) ^ ((a >> 59) & 1) ^ ((a >> 60) & 1) ^ ((a >> 61) & 1) ^ ((a >> 62) & 1) ^
1045  ((a >> 63) & 1));
1046  uint8_t ecc_bit_6 =
1047  (((a >> 38) & 1) ^ ((a >> 39) & 1) ^ ((a >> 40) & 1) ^ ((a >> 41) & 1) ^ ((a >> 42) & 1) ^
1048  ((a >> 43) & 1) ^ ((a >> 44) & 1) ^ ((a >> 45) & 1) ^ ((a >> 46) & 1) ^ ((a >> 47) & 1) ^
1049  ((a >> 48) & 1) ^ ((a >> 49) & 1) ^ ((a >> 50) & 1) ^ ((a >> 51) & 1) ^ ((a >> 52) & 1) ^
1050  ((a >> 53) & 1) ^ ((a >> 54) & 1) ^ ((a >> 55) & 1) ^ ((a >> 56) & 1) ^ ((a >> 57) & 1) ^
1051  ((a >> 58) & 1) ^ ((a >> 59) & 1) ^ ((a >> 60) & 1) ^ ((a >> 61) & 1) ^ ((a >> 62) & 1) ^
1052  ((a >> 63) & 1));
1053  uint8_t ecc_bit_7 =
1054  (((a >> 0) & 1) ^ ((a >> 1) & 1) ^ ((a >> 2) & 1) ^ ((a >> 4) & 1) ^ ((a >> 5) & 1) ^
1055  ((a >> 7) & 1) ^ ((a >> 10) & 1) ^ ((a >> 11) & 1) ^ ((a >> 13) & 1) ^ ((a >> 16) & 1) ^
1056  ((a >> 20) & 1) ^ ((a >> 21) & 1) ^ ((a >> 23) & 1) ^ ((a >> 26) & 1) ^ ((a >> 31) & 1) ^
1057  ((a >> 36) & 1) ^ ((a >> 38) & 1) ^ ((a >> 39) & 1) ^ ((a >> 41) & 1) ^ ((a >> 44) & 1) ^
1058  ((a >> 47) & 1) ^ ((a >> 49) & 1) ^ ((a >> 50) & 1) ^ ((a >> 54) & 1) ^ ((a >> 56) & 1) ^
1059  ((a >> 62) & 1));
1060  ecc_bits = (ecc_bit_7 << 7) | (ecc_bit_6 << 6) | (ecc_bit_5 << 5) | (ecc_bit_4 << 4) |
1061  (ecc_bit_3 << 3) | (ecc_bit_2 << 2) | (ecc_bit_1 << 1) | ecc_bit_0;
1062  return ecc_bits;
1063 }

◆ ECC_ICacheDRamErrInject()

__STATIC_FORCEINLINE void ECC_ICacheDRamErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into I-Cache Data RAM.

This function injects an error into the I-Cache Data RAM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 332 of file core_feature_ecc.h.

333 {
334  /* Write ecc_code into mecc_code csr also clear all error status */
335  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
336  MInvalICacheLine((unsigned long)addr);
337  __RWMB();
339  MLockICacheLine((unsigned long)addr);
341  __RWMB();
342 }
#define MCACHE_CTL_IC_DRAM_ECC_INJ_EN
__STATIC_INLINE unsigned long MLockICacheLine(unsigned long addr)
Lock one I-Cache line specified by address in M-Mode.
__STATIC_INLINE void MInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in M-Mode.

References __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, CSR_MCACHE_CTL, CSR_MECC_CODE, MCACHE_CTL_IC_DRAM_ECC_INJ_EN, MInvalICacheLine(), and MLockICacheLine().

◆ ECC_ICacheErrRestore()

__STATIC_FORCEINLINE void ECC_ICacheErrRestore ( void *  addr)

Restore I-Cache error at specified address.

This function restores the correct ECC code for the I-Cache line at the specified address.

Parameters
[in]addrAddress to restore

Definition at line 350 of file core_feature_ecc.h.

351 {
352  /* Re-lock cache to restore the correct ecc code */
353  MInvalICacheLine((unsigned long)addr);
354  MLockICacheLine((unsigned long)addr);
355 }

References MInvalICacheLine(), and MLockICacheLine().

◆ ECC_ICacheTRamErrInject()

__STATIC_FORCEINLINE void ECC_ICacheTRamErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into I-Cache Tag RAM.

This function injects an error into the I-Cache Tag RAM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 312 of file core_feature_ecc.h.

313 {
314  /* Write ecc_code into mecc_code csr also clear all error status */
315  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
316  MInvalICacheLine((unsigned long)addr);
317  __RWMB();
319  MLockICacheLine((unsigned long)addr);
321  __RWMB();
322 }
#define MCACHE_CTL_IC_TRAM_ECC_INJ_EN

References __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, CSR_MCACHE_CTL, CSR_MECC_CODE, MCACHE_CTL_IC_TRAM_ECC_INJ_EN, MInvalICacheLine(), and MLockICacheLine().

◆ ECC_ILMErrInject()

__STATIC_FORCEINLINE void ECC_ILMErrInject ( uint32_t  ecc_code,
void *  addr 
)

Inject error into ILM.

This function injects an error into the ILM at the specified address with the given ECC code.

Parameters
[in]ecc_codeECC code to inject
[in]addrAddress where error should be injected

Definition at line 506 of file core_feature_ecc.h.

507 {
508  /* Write ecc_code into mecc_code csr also clear all error status */
509  __RV_CSR_WRITE(CSR_MECC_CODE, ecc_code);
511  uint32_t val = __LW(addr);
512  __RWMB(); // make sure setting the ECC_INJ_EN bit before any other memory access
514  __SW(addr, val);
515  __RWMB(); // make sure the error injection is finished
517  __RWMB(); // make sure clearing the ECC_INJ_EN bit before any other memory access
519 }
#define MILM_CTL_ILM_ECC_INJ_EN
__STATIC_FORCEINLINE void ECC_DisableILMECCCheck(void)
Disable ECC checking for ILM.
__STATIC_FORCEINLINE void ECC_EnableILMECCCheck(void)
Enable ECC checking for ILM.

References __LW(), __RV_CSR_CLEAR, __RV_CSR_SET, __RV_CSR_WRITE, __RWMB, __SW(), CSR_MECC_CODE, CSR_MILM_CTL, ECC_DisableILMECCCheck(), ECC_EnableILMECCCheck(), and MILM_CTL_ILM_ECC_INJ_EN.

◆ ECC_ILMErrRestore()

__STATIC_FORCEINLINE void ECC_ILMErrRestore ( void *  addr)

Restore ILM error at specified address.

This function restores the correct ECC code for the ILM at the specified address.

Parameters
[in]addrAddress to restore

Definition at line 527 of file core_feature_ecc.h.

528 {
530  __RWMB();
531  __SW(addr, __LW(addr));
532  __RWMB();
534 }

References __LW(), __RWMB, __SW(), ECC_DisableILMECCCheck(), and ECC_EnableILMECCCheck().

◆ ECC_IsAnyDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsAnyDoubleBitErrorOccured ( void  )

Check if any double-bit error has occurred.

This function checks if any double-bit error has occurred by reading the machine ECC code CSR.

Returns
1 if any double-bit error has occurred, 0 otherwise

Definition at line 809 of file core_feature_ecc.h.

810 {
811  CSR_MECC_CODE_Type mecc_code;
812  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
813  return mecc_code.b.ramid;
814 }
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
Union type to access MECC_CODE CSR register.
rv_csr_t ramid
bit: 16..20 The ID of RAM that has 2bit ECC error, software can clear these bits
rv_csr_t d
Type used for csr data access.
struct CSR_MECCCODE_Type::@22 b
Structure used for bit access.

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsAnySingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsAnySingleBitErrorOccured ( void  )

Check if any single-bit error has occurred.

This function checks if any single-bit error has occurred by reading the machine ECC code CSR.

Returns
1 if any single-bit error has occurred, 0 otherwise

Definition at line 665 of file core_feature_ecc.h.

666 {
667  CSR_MECC_CODE_Type mecc_code;
668  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
669  return mecc_code.b.sramid;
670 }
rv_csr_t sramid
bit: 24..28 The ID of RAM that has 1bit ECC error, software can clear these bits

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsDCacheDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsDCacheDoubleBitErrorOccured ( void  )

Check if D-Cache double-bit error has occurred.

This function checks if a double-bit error has occurred in the D-Cache.

Returns
1 if D-Cache double-bit error has occurred, 0 otherwise

Definition at line 835 of file core_feature_ecc.h.

836 {
837  CSR_MECC_CODE_Type mecc_code;
838  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
839  return mecc_code.b.ramid & ECC_ERROR_RAMID_MASK_DCACHE;
840 }
#define ECC_ERROR_RAMID_MASK_DCACHE

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DCACHE, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsDCacheSingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsDCacheSingleBitErrorOccured ( void  )

Check if D-Cache single-bit error has occurred.

This function checks if a single-bit error has occurred in the D-Cache.

Returns
1 if D-Cache single-bit error has occurred, 0 otherwise

Definition at line 691 of file core_feature_ecc.h.

692 {
693  CSR_MECC_CODE_Type mecc_code;
694  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
695  return mecc_code.b.sramid & ECC_ERROR_RAMID_MASK_DCACHE;
696 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DCACHE, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsDCacheSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsDCacheSupportECC ( void  )

Check if D-Cache supports ECC.

This function checks if both D-Cache and ECC are supported in the core.

Returns
1 if D-Cache supports ECC, 0 otherwise

Definition at line 101 of file core_feature_ecc.h.

102 {
103  CSR_MCFGINFO_Type mcfginfo;
104  CSR_MDCFGINFO_Type mdcfginfo;
105  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
106  mdcfginfo.d = __RV_CSR_READ(CSR_MDCFG_INFO);
107  return mcfginfo.b.dcache && mdcfginfo.b.ecc;
108 }
#define CSR_MCFG_INFO
#define CSR_MDCFG_INFO
Union type to access MCFG_INFO CSR register.
struct CSR_MCFGINFO_Type::@14 b
Structure used for bit access.
rv_csr_t d
Type used for csr data access.
rv_csr_t dcache
bit: 10 DCache present
Union type to access MDCFG_INFO CSR register.
struct CSR_MDCFGINFO_Type::@16 b
Structure used for bit access.
rv_csr_t d
Type used for csr data access.
rv_csr_t ecc
bit: 10 D-Cache ECC support

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MDCFGINFO_Type::b, CSR_MCFG_INFO, CSR_MDCFG_INFO, CSR_MCFGINFO_Type::d, CSR_MDCFGINFO_Type::d, CSR_MCFGINFO_Type::dcache, and CSR_MDCFGINFO_Type::ecc.

◆ ECC_IsDLMDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsDLMDoubleBitErrorOccured ( void  )

Check if DLM double-bit error has occurred.

This function checks if a double-bit error has occurred in the DLM.

Returns
1 if DLM double-bit error has occurred, 0 otherwise

Definition at line 874 of file core_feature_ecc.h.

875 {
876  CSR_MECC_CODE_Type mecc_code;
877  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
878  return mecc_code.b.ramid & ECC_ERROR_RAMID_MASK_DLM;
879 }
#define ECC_ERROR_RAMID_MASK_DLM

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DLM, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsDLMSingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsDLMSingleBitErrorOccured ( void  )

Check if DLM single-bit error has occurred.

This function checks if a single-bit error has occurred in the DLM.

Returns
1 if DLM single-bit error has occurred, 0 otherwise

Definition at line 730 of file core_feature_ecc.h.

731 {
732  CSR_MECC_CODE_Type mecc_code;
733  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
734  return mecc_code.b.sramid & ECC_ERROR_RAMID_MASK_DLM;
735 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DLM, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsDLMSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsDLMSupportECC ( void  )

Check if DLM supports ECC.

This function checks if both DLM and ECC are supported in the core.

Returns
1 if DLM supports ECC, 0 otherwise

Definition at line 148 of file core_feature_ecc.h.

149 {
150  CSR_MCFGINFO_Type mcfginfo;
151  CSR_MDCFGINFO_Type mdcfginfo;
152  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
153  mdcfginfo.d = __RV_CSR_READ(CSR_MDCFG_INFO);
154  return mcfginfo.b.dlm && mdcfginfo.b.lm_ecc;
155 }
rv_csr_t dlm
bit: 8 DLM present
rv_csr_t lm_ecc
bit: 21 DLM ECC present

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MDCFGINFO_Type::b, CSR_MCFG_INFO, CSR_MDCFG_INFO, CSR_MCFGINFO_Type::d, CSR_MDCFGINFO_Type::d, CSR_MCFGINFO_Type::dlm, and CSR_MDCFGINFO_Type::lm_ecc.

◆ ECC_IsGlobalSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsGlobalSupportECC ( void  )

Check if the core globally supports ECC.

This function reads the machine configuration info CSR and checks if ECC is supported globally in the core.

Returns
1 if ECC is globally supported, 0 otherwise

Definition at line 73 of file core_feature_ecc.h.

74 {
75  CSR_MCFGINFO_Type mcfginfo;
76  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
77  return mcfginfo.b.ecc;
78 }
rv_csr_t ecc
bit: 1 ECC present

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MCFG_INFO, CSR_MCFGINFO_Type::d, and CSR_MCFGINFO_Type::ecc.

◆ ECC_IsICacheDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsICacheDoubleBitErrorOccured ( void  )

Check if I-Cache double-bit error has occurred.

This function checks if a double-bit error has occurred in the I-Cache.

Returns
1 if I-Cache double-bit error has occurred, 0 otherwise

Definition at line 822 of file core_feature_ecc.h.

823 {
824  CSR_MECC_CODE_Type mecc_code;
825  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
826  return mecc_code.b.ramid & ECC_ERROR_RAMID_MASK_ICACHE;
827 }
#define ECC_ERROR_RAMID_MASK_ICACHE

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_ICACHE, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsICacheSingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsICacheSingleBitErrorOccured ( void  )

Check if I-Cache single-bit error has occurred.

This function checks if a single-bit error has occurred in the I-Cache.

Returns
1 if I-Cache single-bit error has occurred, 0 otherwise

Definition at line 678 of file core_feature_ecc.h.

679 {
680  CSR_MECC_CODE_Type mecc_code;
681  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
682  return mecc_code.b.sramid & ECC_ERROR_RAMID_MASK_ICACHE;
683 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_ICACHE, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsICacheSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsICacheSupportECC ( void  )

Check if I-Cache supports ECC.

This function checks if both I-Cache and ECC are supported in the core.

Returns
1 if I-Cache supports ECC, 0 otherwise

Definition at line 86 of file core_feature_ecc.h.

87 {
88  CSR_MCFGINFO_Type mcfginfo;
89  CSR_MICFGINFO_Type micfginfo;
90  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
91  micfginfo.d = __RV_CSR_READ(CSR_MICFG_INFO);
92  return mcfginfo.b.icache && micfginfo.b.ecc;
93 }
#define CSR_MICFG_INFO
rv_csr_t icache
bit: 9 ICache present
Union type to access MICFG_INFO CSR register.
rv_csr_t d
Type used for csr data access.
rv_csr_t ecc
bit: 10 I-Cache ECC support
struct CSR_MICFGINFO_Type::@15 b
Structure used for bit access.

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MICFGINFO_Type::b, CSR_MCFG_INFO, CSR_MICFG_INFO, CSR_MCFGINFO_Type::d, CSR_MICFGINFO_Type::d, CSR_MICFGINFO_Type::ecc, and CSR_MCFGINFO_Type::icache.

◆ ECC_IsILMDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsILMDoubleBitErrorOccured ( void  )

Check if ILM double-bit error has occurred.

This function checks if a double-bit error has occurred in the ILM.

Returns
1 if ILM double-bit error has occurred, 0 otherwise

Definition at line 861 of file core_feature_ecc.h.

862 {
863  CSR_MECC_CODE_Type mecc_code;
864  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
865  return mecc_code.b.ramid & ECC_ERROR_RAMID_MASK_ILM;
866 }
#define ECC_ERROR_RAMID_MASK_ILM

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_ILM, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsILMSingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsILMSingleBitErrorOccured ( void  )

Check if ILM single-bit error has occurred.

This function checks if a single-bit error has occurred in the ILM.

Returns
1 if ILM single-bit error has occurred, 0 otherwise

Definition at line 717 of file core_feature_ecc.h.

718 {
719  CSR_MECC_CODE_Type mecc_code;
720  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
721  return mecc_code.b.sramid & ECC_ERROR_RAMID_MASK_ILM;
722 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_ILM, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsILMSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsILMSupportECC ( void  )

Check if ILM supports ECC.

This function checks if both ILM and ECC are supported in the core.

Returns
1 if ILM supports ECC, 0 otherwise

Definition at line 133 of file core_feature_ecc.h.

134 {
135  CSR_MCFGINFO_Type mcfginfo;
136  CSR_MICFGINFO_Type micfginfo;
137  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
138  micfginfo.d = __RV_CSR_READ(CSR_MICFG_INFO);
139  return mcfginfo.b.ilm && micfginfo.b.lm_ecc;
140 }
rv_csr_t ilm
bit: 7 ILM present
rv_csr_t lm_ecc
bit: 22 ILM ECC support

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MICFGINFO_Type::b, CSR_MCFG_INFO, CSR_MICFG_INFO, CSR_MCFGINFO_Type::d, CSR_MICFGINFO_Type::d, CSR_MCFGINFO_Type::ilm, and CSR_MICFGINFO_Type::lm_ecc.

◆ ECC_IsTLBDoubleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsTLBDoubleBitErrorOccured ( void  )

Check if TLB double-bit error has occurred.

This function checks if a double-bit error has occurred in the TLB.

Returns
1 if TLB double-bit error has occurred, 0 otherwise

Definition at line 848 of file core_feature_ecc.h.

849 {
850  CSR_MECC_CODE_Type mecc_code;
851  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
852  return mecc_code.b.ramid & ECC_ERROR_RAMID_MASK_DLM;
853 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DLM, and CSR_MECCCODE_Type::ramid.

◆ ECC_IsTLBSingleBitErrorOccured()

__STATIC_FORCEINLINE int32_t ECC_IsTLBSingleBitErrorOccured ( void  )

Check if TLB single-bit error has occurred.

This function checks if a single-bit error has occurred in the TLB.

Returns
1 if TLB single-bit error has occurred, 0 otherwise

Definition at line 704 of file core_feature_ecc.h.

705 {
706  CSR_MECC_CODE_Type mecc_code;
707  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
708  return mecc_code.b.sramid & ECC_ERROR_RAMID_MASK_DLM;
709 }

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, ECC_ERROR_RAMID_MASK_DLM, and CSR_MECCCODE_Type::sramid.

◆ ECC_IsTLBSupportECC()

__STATIC_FORCEINLINE int32_t ECC_IsTLBSupportECC ( void  )

Check if TLB supports ECC.

This function checks if both PLIC and TLB ECC are supported in the core. Note: TLB is only present with MMU, and when PLIC is present, MMU will be present.

Returns
1 if TLB supports ECC, 0 otherwise

Definition at line 117 of file core_feature_ecc.h.

118 {
119  CSR_MCFGINFO_Type mcfginfo;
120  CSR_MTLBCFGINFO_Type mtlbcfginfo;
121  mcfginfo.d = __RV_CSR_READ(CSR_MCFG_INFO);
122  mtlbcfginfo.d = __RV_CSR_READ(CSR_MTLBCFG_INFO);
123  /* TLB only present with MMU, when PLIC present MMU will present */
124  return mcfginfo.b.plic && mtlbcfginfo.b.ecc;
125 }
#define CSR_MTLBCFG_INFO
rv_csr_t plic
bit: 3 PLIC present
Union type to access MTLBCFG_INFO CSR register.
rv_csr_t d
Type used for csr data access.
struct CSR_MTLBCFGINFO_Type::@17 b
Structure used for bit access.
rv_csr_t ecc
bit: 10 Main TLB supports ECC or not

References __RV_CSR_READ, CSR_MCFGINFO_Type::b, CSR_MTLBCFGINFO_Type::b, CSR_MCFG_INFO, CSR_MTLBCFG_INFO, CSR_MCFGINFO_Type::d, CSR_MTLBCFGINFO_Type::d, CSR_MTLBCFGINFO_Type::ecc, and CSR_MCFGINFO_Type::plic.

◆ ECC_IsXorErrorInjectMode()

__STATIC_FORCEINLINE int32_t ECC_IsXorErrorInjectMode ( void  )

Check if XOR error injection mode is supported.

This function reads the machine ECC code CSR and checks if error injection mode is suppported.

Returns
1 if XOR error injection mode is enabled, 0 otherwise

Definition at line 163 of file core_feature_ecc.h.

164 {
165  CSR_MECC_CODE_Type mecc_code;
166  mecc_code.d = __RV_CSR_READ(CSR_MECC_CODE);
167  return mecc_code.b.ecc_inj_mode;
168 }
rv_csr_t ecc_inj_mode
bit: 31 ECC injection mode

References __RV_CSR_READ, CSR_MECCCODE_Type::b, CSR_MECC_CODE, CSR_MECCCODE_Type::d, and CSR_MECCCODE_Type::ecc_inj_mode.