Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
730 Views

Forcing registers

Hi. 

 

Is there a way to force the compiler to use registers for a 2-dimensional array? 

 

I am experimenting with an interconnect kernel whose structure is easier to express with array indices.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
33 Views

The standard way to force register instead of Block RAM is to use __attribute__((register)). However, I remember the compiler ignored this attribute for 2D arrays. What I did was to use multiple one-dimensional arrays, instead of one 2D one in that case, and use the attribute on them. You should be able to create a custom address conversion in this case using macros. Note that if the array is too big, using registers for implementing it will be inefficient.

Altera_Forum
Honored Contributor I
33 Views

__attribute__((register)) and a 1-dimensional array with index conversion sounds like a perfect solution. 

 

I thought about multiple 1-dimensional arrays but that would require quite some macro programming to make it generic. 

 

For this interconnect, having messages be retrieved and saved to block ram would most probably render the whole system useless. 

Either it works with registers only or I will have to revise parts. 

 

Thank you for the quick and very helpful answer :-)
Reply