Dear Anand
thanks for the reply..... I am trying to compile a very simple C++ algorithm. The din_t I am taking as ac_int<16> and d_out I am taking as ap_int<48>....The length of vector as N=10... I have compiled it in another HLS tool.... I will be grateful if you can check if I am following the right difrection towards synthesis in Intel HLS..... In my code there is a component and below i have the test bench under int main(void)....This test bench works in other HLS tool.... I am having problem in Intel HLS with this...Can you figure out what is wrong in it ? Will be really thankful...
# include "HLS/hls.h"
# include <stdio.h>
# include "HLS/ac_int.h"
# include "HLS/ac_fixed.h"
# include "HLS/math.h"
using namespace ihc;
component void sol (din_t a[N], din_t b[N], dout_t *dout)
{
int i;
int acc= 0;
int a_reg, b_reg, sub, sub2;
for(i=0; i<N; i++)
{
# pragma HLS PIPELINE II=1
a_reg = a
;
b_reg = b;
sub = a_reg - b_reg;
sub2 = sub*sub;
acc += sub2;
}
*dout = acc;
}
int main(void)
{
int i, k, cnt;
int ret_val = 0;
int a[N], b[N];
din_t aa[N], bb[N];
long long int ref_res;
dout_t res;
cnt = 0;
for (k=0; k<10; k++)
{
//create random data
for(i=0; i<N; i++)
{
a
= rand() % (1024*16);
b = rand() % (1024*16);
aa
= (din_t) a;
bb
= (din_t) b;
}
//call reference function
ref_sol(a, b, &ref_res);
//call design Under Test
sol( aa, bb, &res);
//check results
printf("got %lld expected %lld\n", (long long int) res.to_double(), (long long int) ref_res);
if ( (ref_res - (long long int) res) !=0 ) cnt++;
}
if (cnt>0)
{
printf("TEST FAILED: %d errors\n", cnt);
ret_val = 1;
}
else
{
printf("TEST SUCCESS!\n");
ret_val = 0;
}
return ret_val;
}