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: 
Explorer
Explorer
5,937 Views
Registered: ‎07-06-2016

Boolean type in HLS

Jump to solution

Hello,

 

Sorry if this question has been resolved before but I couldn't find it... seems pretty simple but I'm trying to work in HLS with a function with a boolean as an input argument but when I try to synthetise it's giving me the error: "bool type can't be resolved"

I tried to include the most common libraries but didn't work what library I'm missing?

 

 

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer ayhamzedan
Observer
10,872 Views
Registered: ‎08-04-2016

Re: Boolean type in HLS

Jump to solution
Oh ok. I thought you were using C++. I use ap_fixed for C++

According to the user guide, page 203, you can use this :

#include “ap_cint.h”

typedef uint<1> data_bool;

or

typedef uint1 data_bool;

and

bool variable_1;


I hope this solves the problem.
0 Kudos
5 Replies
Observer ayhamzedan
Observer
5,927 Views
Registered: ‎08-04-2016

Re: Boolean type in HLS

Jump to solution
Try using

#include <ap_fixed.h>

typedef ap_uint<1> data_bool;

then you can do this

data_bool variable_1;

instead of :

bool variable_1;

I hope this would work as a temporary fix until someone comes up with a better solution.
0 Kudos
Explorer
Explorer
5,916 Views
Registered: ‎07-06-2016

Re: Boolean type in HLS

Jump to solution

Thanks for your answer ayhamzedan, I tried it but didn't work, it couln'd find ap_uint<1> type...

 

Just to clarify, I'm just trying to add to a C function an input argument which be synthesized as a single signal line, and for that I'm trying a boolean type...anyone knows how to achieve that?

 

Thanks in advance.

 

0 Kudos
Scholar u4223374
Scholar
5,904 Views
Registered: ‎04-26-2015

Re: Boolean type in HLS

Jump to solution

Ah, the problem is that you're using C rather than C++. For C, you need this:

 

#include <ap_cint.h>

typedef uint1 data_bool;

Or you can just rename the file extension to .cpp instead of .c, and then you can use the ap_int.h header and the typedef in @ayhamzedan's post. Using C++ should also give you a native boolean type (I'm pretty sure I've used that before, although normally I still just use ap_uint<1> as a replacement) which will avoid the need for typedefs.

0 Kudos
Highlighted
Observer ayhamzedan
Observer
10,873 Views
Registered: ‎08-04-2016

Re: Boolean type in HLS

Jump to solution
Oh ok. I thought you were using C++. I use ap_fixed for C++

According to the user guide, page 203, you can use this :

#include “ap_cint.h”

typedef uint<1> data_bool;

or

typedef uint1 data_bool;

and

bool variable_1;


I hope this solves the problem.
0 Kudos
Explorer
Explorer
5,895 Views
Registered: ‎07-06-2016

Re: Boolean type in HLS

Jump to solution

Hi, thanks, yes, I did check it, and it's working just including the “ap_cint.h” library and after using the 'bool' type.

Best regards.

0 Kudos