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.
15323 Discussions

passing pointer to RTL library

Honored Contributor II

Hello everyone, 


I'm having a RTL library function that writes to the DDR some data to an address given as an input. Currently, my design is very simple and the OpenCL wrapper only passes the data and pointer, which works see the code below. 

kernel void test_lib (__global uint* restrict pin, ulong din) { ulong8 din_extended; // ddr words must be 512 bits width din_extended.s0 = din; din_extended.s1 = din + 1; din_extended.s2 = din + 2; din_extended.s3 = din + 3; din_extended.s4 = din + 4; din_extended.s5 = din + 5; din_extended.s6 = din + 6; din_extended.s7 = din + 7; ddr_w_rtl(pin, din_extended); } 


But then I want to optimize my OpenCL call. So I want to create a buffer of input pointers and a buffer of data. So far, I did not found a way to bypass the compiler checks that annoys me. I tried the following OpenCL kernel: 

kernel void test_lib (__global uint* restrict pin, ulong din, uint n_input) { ulong8 din_extended; din_extended.s0 = din; //din_extended stuff ...// for(uint i = 0; i < n_input; i++){ ddr_w_rtl(pin, din_extended); } } 

I checked that the buffer created on the global memory is n_input*8 long. The compiler answer is: 


/home/.../ Compiler Error: Pointer argument 0 to 'ddr_w_rtl' HDL Function Call is not a function argument! Compiler Error: A pointer passed to HDL library componenet must satisfy all these criteria: Compiler Error: 1. Must be a global or constant address space pointer. Compiler Error: 2. Must be a kernel argument. Compiler Error: 3. Must be marked with 'restrict' keyword to prevent aliasing. Compiler Error: 4. Must have no other uses besides a single HDL library component OR Compiler Error: must have all its uses, including by all HDL library components, as read-only. Error: Optimizer FAILED. 


I see that my problem comes from point 4. But I don't understand how I can avoid such check. In my case, it is useless. There is no point of preventing me such pointer usage knowing that my kernel can access any address it want, whatever the input! 



0 Kudos
1 Reply
Honored Contributor II

I tried to make the function call to ddr_w_rtl use only a uint instead of a uint* to bypass the compiler checks, but the XML file prevent me from doing such. Indeed, the first parameter of my function is described as : 

<MEM_INPUT port="pin" access="readwrite"/> 

So my function prototype should provide a pointer.