cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
6,502 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
Observer
11,437 Views
Registered: ‎08-04-2016
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.

View solution in original post

0 Kudos
5 Replies
Highlighted
Observer
Observer
6,492 Views
Registered: ‎08-04-2016
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
Highlighted
Voyager
Voyager
6,481 Views
Registered: ‎07-06-2016

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
Highlighted
Advisor
Advisor
6,469 Views
Registered: ‎04-26-2015

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
Observer
11,438 Views
Registered: ‎08-04-2016
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.

View solution in original post

0 Kudos
Highlighted
Voyager
Voyager
6,460 Views
Registered: ‎07-06-2016

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