title: VIVADO HLS:How to declare arbitrary precision (or bit-accurate) integer data types for 2D array?
body: <p>I am working with larger size matrix in Vivado HLS. As normal "int", its occupies lot of memory space and slow down the hardware speed. </p>
  
  <p>So, for better optimization and performance, arbitrary precision (or bit-accurate) integer data types best. I have gone through the VIVADO User guide, i am not clear. But, I don`t know how to initialize “ap_int.h” or “ap_cin.h” for two-dimensional array. Can anyone clear me how to apply <strong>“ap_int.h” or “ap_cin.h”</strong> for below source code. </p>
  
  <pre><code>#define ROWS 102  //k
  #define COLS 204
  void GeneratorM(int msg[ROWS], int 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
  int Generator[ROWS][COLS]= {0};
  int G[ROWS][COLS] = {0};
  int i,j,k,r,c,n;
  k = ROWS;
  r = ROWS;
  c = COLS;
  n = COLS;
  static int H[ROWS][COLS];
  int Codeword[COLS]= {0};
  int s = 0;
  for (i=0;i&lt;k;i++)
   for(j=0;j&lt;k;j++)
      if(i == j)
      G[i][j] = 1;
  
  for(i=0;i&lt;r;i++)
   for(j=0;j&lt;k;j++)
      G[j][k+i] = H[i][j];
  
  for(i=0;i&lt;r;i++)
   {
    for(j=0;j&lt;c;j++)
      Generator[i][j]=G[i][j];
   }
  
  for(j=0;j&lt;n;j++)
  {
   for(i=0;i&lt;k;i++)
   {
      s = s + msg[i]*Generator[i][j];
   }
    Codeword[j] = s % 2;
    s = 0;
  }
   for(i=0;i&lt;n;i++)
   {
   dout[i]=Codeword[i];
   }
  }
  </code></pre>