Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16596 Discussions

partitioning __constant cache into parallel local memory banks

Altera_Forum
Honored Contributor II
956 Views

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 

 

 

__kernel  

__attribute__((task)) 

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++) 

msgMem[k][r]=message[(k*M)+r]; 

 

}
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
239 Views

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, 1.8.3.1 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.
0 Kudos
Reply