Skip to content

Instantly share code, notes, and snippets.

@Neelam96
Last active June 29, 2020 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neelam96/d7f8c1714411a3ecbe24ad3e7235f70a to your computer and use it in GitHub Desktop.
Save Neelam96/d7f8c1714411a3ecbe24ad3e7235f70a to your computer and use it in GitHub Desktop.
#define H 3
float sum_arr(float* A)
{
//interfaces
#pragma HLS INTERFACE m_axi depth=9 port=A offset=slave
#pragma HLS INTERFACE s_axilite port=return
int i,j;
static float Ain[H*H];
//copying values from memory
for(i=0; i<H; i++)
{
#pragma HLS pipeline
for(j=0; j<H; j++)
{
#pragma HLS unroll
Ain[i+(H*j)]=*(A+H*i+j);
}
}
float sum=0;
//computing sum
for(i=0; i<H; i++)
{
for(j=0; j<H; j++)
{
#pragma HLS pipeline
sum = sum+ Ain[i+(H*j)];
}
}
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment