Hi,
I am working LDPC encoding and decoding.In Vivado HLS, I need to transform a parity-check matrix H (that only consists of ones and zeros) from a non-standard to a standard form through C/C++ programming language.
Its showing wrong result while generating codeword, please debug my program.
ISSUE : codeword, is wrong.
Codeword actual result should be [0 0 1 0 1 1] but its displaying [0 1 1 1 0 0]
this is, express it as
Hsys = [I| P]
This is my H parity check matrix
H= [1 1 0 0 1 0;
1 0 0 1 0 1;
1 1 1 0 0 1 ];
1. Arranging the parity check matrix in systematic form using row and column operations
Hsys = [I| P]
systematic parity check matrix, Hsys= [0 0 1 0 1 1
0 1 0 1 1 1;
1 0 0 1 0 1;]
2. Rearranging the systematic parity check matrix
Generator matrix G =[Ptranspose\I];
Therefore, G= [0 1 1 1 0 0 ;
1 1 0 0 1 0 ;
1 1 1 0 0 1]
3. Generate the codeword in by multiplying message with generator matrix G
c=m.G //c =codeword
Through C code, i have completed coding tasks 1 &2, but while generation codeword its showing wrong result.
for e.g. m=011
c= [011] [0 1 1 1 0 0 ;
1 1 0 0 1 0 ;
1 1 1 0 0 1]
Code:
// coding for the general form beginning using rows and cols
int i,j,msg_length,sum=0,k;
int message[1][10]={0};
int rows,cols,r=0,r2,c;
int H_Matrix[10][10]={0},code[10][10]={0};
int temp[10][10]={0};
.................
..............
for(j=0;j<cols;j++)
{
printf("%d\t ",H_Matrix[i][j]);
}
printf("\n");
}
for (i = 0; i < 1; i++) {
for (j = 0; j < cols; j++) {
for (k = 0; k < rows; k++) {
sum = sum^( message[i][k]&H_Matrix[k][j]);
}
code[i][j] = sum;
sum = 0;
}
}
//code wrd
printf("the code word \n");
for(i=0;i<1;i++)
{
for(j=0;j<cols;j++)
{
printf("%d\t ",code[i][j]);
}
printf("\n");
}