EasyManua.ls Logo

NXP Semiconductors MPC5777M - Page 89

NXP Semiconductors MPC5777M
94 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Testing All-X in RAM
Safety Manual for MPC5777M, Rev. 1.1
NXP Semiconductors 89
Figure 5 shows an alternative representation of the ECC encode process, written as a C language function.
Figure 5. C Language encodeECC function description
encodeEcc (addr, data_a2_is_zero, data_a2_is_one)
unsigned int addr; /* 32-bit byte address */
unsigned int data_a2_is_zero; /* 32-bit data lower, a[2]=0 */
unsigned int data_a2_is_one; /* 32-bit data upper, a[2]=1 */
{
unsigned int addr_ecc; /* 8 bits of ecc for address */
unsigned int ecc; /* 8 bits of ecc codeword */
/* the following equation calculates the 8-bit wide ecc codeword by examining
each addr or data bits and xor'ing the appropriate H-matrix value if the bit = 1 */
addr_ecc
= (((addr >> 31) & 1) ? 0x1f : 0x0) /* addr[31] */
^ (((addr >> 30) & 1) ? 0xf4 : 0x0) /* addr[30] */
^ (((addr >> 29) & 1) ? 0x3b : 0x0) /* addr[29] */
^ (((addr >> 28) & 1) ? 0xe3 : 0x0) /* addr[28] */
^ (((addr >> 27) & 1) ? 0x5d : 0x0) /* addr[27] */
^ (((addr >> 26) & 1) ? 0xda : 0x0) /* addr[26] */
^ (((addr >> 25) & 1) ? 0x6e : 0x0) /* addr[25] */
^ (((addr >> 24) & 1) ? 0xb5 : 0x0) /* addr[24] */
^ (((addr >> 23) & 1) ? 0x8f : 0x0) /* addr[23] */
^ (((addr >> 22) & 1) ? 0xd6 : 0x0) /* addr[22] */
^ (((addr >> 21) & 1) ? 0x79 : 0x0) /* addr[21] */
^ (((addr >> 20) & 1) ? 0xba : 0x0) /* addr[20] */
^ (((addr >> 19) & 1) ? 0x9b : 0x0) /* addr[19] */
^ (((addr >> 18) & 1) ? 0xe5 : 0x0) /* addr[18] */
^ (((addr >> 17) & 1) ? 0x57 : 0x0) /* addr[17] */
^ (((addr >> 16) & 1) ? 0xec : 0x0) /* addr[16] */
^ (((addr >> 15) & 1) ? 0xc7 : 0x0) /* addr[15] */
^ (((addr >> 14) & 1) ? 0xae : 0x0) /* addr[14] */
^ (((addr >> 13) & 1) ? 0x67 : 0x0) /* addr[13] */
^ (((addr >> 12) & 1) ? 0x9d : 0x0) /* addr[12] */
^ (((addr >> 11) & 1) ? 0x5b : 0x0) /* addr[11] */
^ (((addr >> 10) & 1) ? 0xe6 : 0x0) /* addr[10] */
^ (((addr >> 9) & 1) ? 0x3e : 0x0) /* addr[ 9] */
^ (((addr >> 8) & 1) ? 0xf1 : 0x0) /* addr[ 8] */
^ (((addr >> 7) & 1) ? 0xdc : 0x0) /* addr[ 7] */
^ (((addr >> 6) & 1) ? 0xe9 : 0x0) /* addr[ 6] */
^ (((addr >> 5) & 1) ? 0x3d : 0x0) /* addr[ 5] */
^ (((addr >> 4) & 1) ? 0xf2 : 0x0) /* addr[ 4] */
^ (((addr >> 3) & 1) ? 0x2f : 0x0); /* addr[ 3] */
ecc = (((data_a2_is_zero >> 31) & 1) ? 0xb0 : 0x0) /* data[63] */
^ (((data_a2_is_zero >> 30) & 1) ? 0x23 : 0x0) /* data[62] */
^ (((data_a2_is_zero >> 29) & 1) ? 0x70 : 0x0) /* data[61] */
NOTES:
1
Bit numbering is AHB convention, bit 0 is LSB. D[7:0] corresponds to byte at address 0. D[63:56] corresponds to
byte at address 7.

Table of Contents

Other manuals for NXP Semiconductors MPC5777M

Related product manuals