SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
The ECC mode is enabled through the CFG_OCMC_ECC[2:0] CFG_OCMC_MODE bit field. When enabled a 9-bit Hamming ECC is calculated and stored for each consecutive 128-bit block of the SRAM. The ECC is calculated based on a codeword constructed by concatenating the 128 bits of data with the address bits A21 through A4 of the L3_MAIN. The ECC generated is Hamming(155,146) code and has a Hamming distance of 4. The OCM controller uses this code to validate the content of the SRAM, to correct a single bit error that occurs within the 128-bit boundary or to determine if a non-correctable error has occurred within the 128-bit boundary.
During write transactions and when ECC is enabled, for every 128-bit data word, the ECC is calculated and stored in a 9-bit field of the SRAM associated only with the address where that 128-bit data word is written. If an initiator performs a write transaction which is less than 128 bits or it is non-128-bit aligned transaction, then the content of all 128 bits is read, the new sub-quanta of data is inserted and the ECC is calculated based on all 128 bits.
During read transactions and when ECC is enabled, the ECC is calcualated based on the memory address (bits A21 through A4) and the 128-bit data word read from the SRAM. This ECC is then compared to the ECC stored at the address when the data was written to the SRAM. If the two ECCs are matching then the data is transferred to the requesting initiator without further exceptions. If the two ECCs are not matching then a check is made to determine if the error is correctable or not. If the error is not correctable, that is a double error, then the address of the erroneous word is stored in the DED FIFO, the STATUS_ERROR_CNT[19:16] DED_ERROR_CNT counter is incremented by 1 and the double error flag is asserted. The double error flag is indicated by the INTR0_STATUS_RAW_SET[1] DED_ERR_FOUND/INTR1_STATUS_RAW_SET[1] DED_ERR_FOUND bits, but its assertion depends on the threshold configured through the CFG_OCMC_ECC_ERROR[19:16] CFG_DED_CNT_MAX bit field. For more information see, Table 15-556, OCM Subsystem Events.
In case of a single error, the OCM controller first determines whether the erroneous bit is in the data, address or the ECC itself. In this case the following applies:
Table 15-557 summarizes the actions taken by the OCM controller for the different error types.
Error Type | Data Returned | SRAM Data/ECC Update | SEC Counter | SEC FIFO | DED Counter | DED FIFO | ADDRERR Counter | ADDRERR FIFO | Error Bit Distribution |
---|---|---|---|---|---|---|---|---|---|
Single data error | Corrected | Data corrected/ECC re-generated | Incremented by 1 | Address written | - | - | - | - | The content of the corrected bit distribution register is updated |
Single address error | Unchanged | ECC re-generated | Incremented by 1 | - | - | - | Incremented by 1 | Address written | - |
Single ECC error | Unchanged | ECC re-generated | Incremented by 1 | Address written | - | - | - | - | The content of the STATUS_SEC_ERROR_DISTR_4[7:0] SEC_ECC_CODE_ERROR_FOUND bit field is updated |
Double error | Unchanged | - | - | - | Incremented by 1 | Address written | - | - | - |
If ECC has to be used, before performing SRAM read/write operations the following steps should be performed:
Table 15-558 describes in detail the steps to be performed.
Step | Associated Register/ Bit Field | Value |
---|---|---|
(Optional) Enable the error response on L3_MAIN for a non-correctable error | CFG_OCMC_ECC[4] CFG_ECC_ERR_SRESP_EN | 0x1 |
(Optional) Enable data auto correction in case of a single error | CFG_OCMC_ECC[3] CFG_ECC_SEC_AUTO_CORRECT | 0x1 |
Enable the memory blocks to be ECC protected, if ECC block mode is used | CFG_OCMC_ECC_MEM_BLK[19:0] CFG_ECC_ENABLED_128K_BLK | 0x- |
(Optional) Configure the address errors count needed for triggering an interrupt | CFG_OCMC_ECC_ERROR[23:20] CFG_ADDR_ERR_CNT_MAX | 0x- |
(Optional) Configure the DED count needed for triggering an interrupt | CFG_OCMC_ECC_ERROR[19:16] CFG_DED_CNT_MAX | 0x- |
(Optional) Configure the SEC count needed for triggering an interrupt | CFG_OCMC_ECC_ERROR[15:0] CFG_SEC_CNT_MAX | 0x- |
Enable ECC | CFG_OCMC_ECC[2:0] CFG_OCMC_MODE | 0x2 for full ECC or 0x3 for block ECC mode |
Initialize the memory with data | ||
Clear the error counters in the STATUS_ERROR_CNT register | CFG_OCMC_ECC_CLEAR_HIST[2:0] | 0x7 |
Clear the SEC bit distribution history from the following registers: | CFG_OCMC_ECC_CLEAR_HIST[3] CLEAR_SEC_BIT_DISTR | 0x1 |
• STATUS_SEC_ERROR_DISTR_0 | ||
• STATUS_SEC_ERROR_DISTR_1 | ||
• STATUS_SEC_ERROR_DISTR_2 | ||
• STATUS_SEC_ERROR_DISTR_3 | ||
• STATUS_SEC_ERROR_DISTR_4 |