UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
750 Views
Registered: ‎03-29-2017

Vivado HLS IP Using C++ code (arbitrary precision (or bit-accurate) integer data types) & calling into XSDK

Hi,

 

  The codes contain larger size of matrix. Basically, in a matrix , each bit is taken as one word. I want to get rid-off from that issues. I need to give bit as bit in a matrix. So, i am using C++ code (arbitrary precision (or bit-accurate) integer data types) for implementation. In order to reduce memory usage..

 

WorkFlow Process involves:

 

1. Generating HLS IP with below source Code For Kintex custom board.

2. Integrated HLS IP with microblaze, and generated Bitstream

3. Export Hardware and launch XSDK.

 

HLS Source Code

 

#define ROWS 102  //k
#define COLS 204
void Encoder_Arbitray(ap_uint<1> msg[ROWS], ap_uint<1> dout[COLS])

{

#pragma HLS INTERFACE s_axilite port=msg bundle=a
#pragma HLS INTERFACE s_axilite port=dout bundle=a
#pragma HLS INTERFACE s_axilite port=return bundle=a
	static ap_uint<1> Generator[ROWS][COLS];
		static ap_uint<1> G[ROWS][COLS];
		int i,j,k,r,c,n;

k = ROWS;
r = ROWS;
c = COLS;
n = COLS;
static int H[ROWS][COLS] = {0,1,0,1,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,10,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01......};
ap_uint<1> Codeword[COLS];
int s = 0;


for (i=0;i<k;i++)
    for(j=0;j<k;j++)
        if(i == j)
        G[i][j] = 1;

for(i=0;i<r;i++)
    for(j=0;j<k;j++)
        G[j][k+i] = H[i][j];

for(i=0;i<r;i++)
{
    for(j=0;j<c;j++)
    	Generator[i][j]=G[i][j];
}

for(j=0;j<n;j++)
{
    for(i=0;i<k;i++)
    {
        s = s + msg[i]*Generator[i][j];
    }
    Codeword[j] = s % 2;
    s = 0;
}

for(i=0;i<n;i++)
{
	dout[i]=Codeword[i];
}
}

I need to get the output of

 

Expected Output:

101000111001011010010000100101000101100010010010010010101000010110001011010101010010010010010110011100100000101111001101100011111011001010000110000000001001110101111100000010001001000001111101101001001000

 

But I am getting all 0`s..

Console Output in XSDK

 

Encoder_com.PNG

0 Kudos
1 Reply
Teacher xilinxacct
Teacher
365 Views
Registered: ‎10-23-2018

Re: Vivado HLS IP Using C++ code (arbitrary precision (or bit-accurate) integer data types) & calling into XSDK

@thaus_015 Check your return value on the write. I suspect it is coming back as 0. (meaning you didn't send the number of 32bit values you thought you did.) Hope that helps If so, please mark as solution accepted. Kudos also welcomed. :-)
0 Kudos