Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15329 Discussions

partitioning __constant cache into parallel local memory banks

Honored Contributor II

Is there a way to partition __constant cache into parallel memory banks? The following code snippet should give some idea of what I'm trying to do. Instead of explicitly moving the message data into the msgMem banks, I'd like for the data to be pre-loaded once the kernel is executed. 


# define M 64 





void test( 

__constant volatile char * restrict message, 




local char msgMem[256)][M];  



// **************************************** 

// store input data across M memory banks 

// **************************************** 

for(uint k=0; k<NLDPC/M; k++) 


for(uint r=0; r<M; r++) 



0 Kudos
1 Reply
Honored Contributor II

When you define a global variable as __constant, the compiler automatically creates a constant cache on the FPGA with a predefined size of 16 kB, and preloads data onto it (Best Practices Guide, Constant Cache Memory). You do not need to copy the content of the constant variable to local memory manually. However, I am not sure how parallel accesses are handled in this case; I would expect the compiler would also replicate the cache to handle all parallel accesses, but Altera's documents do not address this case. You can write a simple test program and see how the compiler will behave with multiple parallel accesses to the constant cache. 


P.S. I don't think "__constant volatile" makes sense and this could prevent generation of the constant cache; you should only use constant for correct behavior.