1

Through overall search in Stack Overflow. I got a hint :For binary data using memcpy

for (int i=0; i < N; ++i)
    memcpy(buffer + i * byte_sequence_length, byte_sequence,    
      byte_sequence_length); 

But even though, the code is not working, please suggest me what mistake in the below code.

Code

void main ( int bit)        
static unsigned lfsr  = 0xCD;               
int  i,j;        
int buff[];                     
for ( i = 0; i < 50; i++)                  
{                      
   bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 4) ) & 1;                                    
   lfsr = (lfsr >> 1) | (bit << 7);             
   buff[i] = bit;         
 }    
for (int j=0; j < 50; ++j)    
{        
    memcpy(buff+ j, lfsr, 50*sizeof(int));    
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Thaus
  • 23
  • 5

1 Answers1

1

If you declare the buff array as a local variable, HLS will not generate a memory port to your top function. You should make it an argument of the function.

haggai_e
  • 4,689
  • 1
  • 24
  • 37
  • I have referred HLS UG902 user guide and other web sites, they have normally declared the buff array as a local variable only. I think it wont be an error of my code. Please suggest me – Thaus May 12 '17 at 06:00
  • You can declare it local, but then HLS doesn't generate it as port, just as internal memory. – haggai_e May 12 '17 at 06:04
  • Well, you don't need multiple calls to memcpy – haggai_e May 12 '17 at 09:08