UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor woodpakka
Visitor
6,052 Views
Registered: ‎06-22-2012

Variables as arguments for directives

Jump to solution

I have a function, which I want to reuse and pipeline at different iteration intervals, for example:

void foo(int a[Y][X], int b[Y][X]){

...

for(i = 0; i <Y; i++){

for(j = 0; j < X; j++){

#pragma HLS PIPLINE II=1

... some code to mangle values from a and assign the result to b ...

}}

 

When I try to use a function argument for argument II of the PIPELINE directive, as in the following:

void foo(int a[Y][X], int b[Y][X], const int pipe){

...

for(i = 0; i <Y; i++){

for(j = 0; j < X; j++){

#pragma HLS PIPLINE II=pipe

... some code to mangle values from a and assign the result to b ...

}}

 

I get an internal error and I'm advised to contact technical support. I use a parameter to derive const int pipe which is known at compile time. The same thing happens if I use a const function argument to determine array lengths, or LineBuffers and Windows.

 

Is this a bug? Am I doing something wrong? Or is this not supported?

 

Thanks

 

 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
9,515 Views
Registered: ‎08-17-2011

Re: Variables as arguments for directives

Jump to solution

Hello W,

 

You can't use arguments/variables even if they are constant, you need to use "numbers".

 

you could use defines but you can't do

#define MAXPIX 1920

...

#pragma HLS loop_tripcount max = MAXPIX

 

you should be use this (or similar, i think the HLS header may have those macros, with different names)

 

#define DO_PRAGMA_INNER(x) _Pragma (#x)

#define DO_PRAGMA(x) DO_PRAGMA_INNER(x)

#define MAXPIX 1920

....

DO_PRAGMA (HLS loop_tripcount max = MAXPIX)

 

This is GCC / compiler syntax and directives used, this isn't VHLS specific.

 

I would say that if that's really constants known at compile time, then use that, constants or adapt your code to the above macros.

 

I'm sure you understand that you can't change the HW generated using variable at runtime.

If that's really what you want, then you need to describe this in C, but then it maybe doesn't make sense as you'll have different datapaths and a MUX.

 

I hope this helps

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.
3 Replies
Xilinx Employee
Xilinx Employee
6,045 Views
Registered: ‎03-24-2010

Re: Variables as arguments for directives

Jump to solution

Do not enter into some scheme that cannot be defined at compile time. Thus, if you use the const int variable as parameter in top function, HLS don't know what's its exact value when doing RTL synthesis. However, you may use it in sub function, if you pass const value to them at compile time.

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Xilinx Employee
Xilinx Employee
9,516 Views
Registered: ‎08-17-2011

Re: Variables as arguments for directives

Jump to solution

Hello W,

 

You can't use arguments/variables even if they are constant, you need to use "numbers".

 

you could use defines but you can't do

#define MAXPIX 1920

...

#pragma HLS loop_tripcount max = MAXPIX

 

you should be use this (or similar, i think the HLS header may have those macros, with different names)

 

#define DO_PRAGMA_INNER(x) _Pragma (#x)

#define DO_PRAGMA(x) DO_PRAGMA_INNER(x)

#define MAXPIX 1920

....

DO_PRAGMA (HLS loop_tripcount max = MAXPIX)

 

This is GCC / compiler syntax and directives used, this isn't VHLS specific.

 

I would say that if that's really constants known at compile time, then use that, constants or adapt your code to the above macros.

 

I'm sure you understand that you can't change the HW generated using variable at runtime.

If that's really what you want, then you need to describe this in C, but then it maybe doesn't make sense as you'll have different datapaths and a MUX.

 

I hope this helps

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.
Visitor woodpakka
Visitor
6,040 Views
Registered: ‎06-22-2012

Re: Variables as arguments for directives

Jump to solution

Thanks a lot for the quick reply! I was actually just looking for a way to increase productivity :)

0 Kudos