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: 
Observer endofday
Observer
281 Views
Registered: ‎07-24-2018

Half precision floating point methods.

Jump to solution

Hello,

I tried to synthesis a function with half precision floating point or half variables as the code below.

C simulation could be done however, during synthesis, I got the error as ' error: member reference base type 'half' is not a structure or union'. I expected this error is from I used the built-in half precision methods, set_bits and get_bits in the function.

Are there have the way around to use those methods during synthesis?

The code as following:

#include <hls_half.h>

void copy(half x, half &y)
{
	y.set_bits(x.get_bits());
}

 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
233 Views
Registered: ‎10-04-2011

Re: Half precision floating point methods.

Jump to solution

Hello @endofday ,

 

Just to follow up on what @archangel-lightworks said, the get_bits and set_bits methods defined in hls_half.h are not meant for synthesis. They are utility functions provided for the half type applicable to simulation only, and are not meant to be used in synthesis. This is the reason these are not defined in HLS User's Guide UG902. 

 

OK, I hope this helps,
Scott

5 Replies
251 Views
Registered: ‎07-23-2019

Re: Half precision floating point methods.

Jump to solution

 

mmm, 'y' in your function is a pointer, right? if you add a point you are telling the compiler it's a structure, aren't you?

I don't know much about these functions get_bits and set_bits (neither why you use them) but shouldn't it be as below?

y->set_bits(x.get_bits()):

If that doesn't work for whatever reason, try declaring some 'y2' local, using your assignment, then copying y2 into *y.

Moderator
Moderator
234 Views
Registered: ‎10-04-2011

Re: Half precision floating point methods.

Jump to solution

Hello @endofday ,

 

Just to follow up on what @archangel-lightworks said, the get_bits and set_bits methods defined in hls_half.h are not meant for synthesis. They are utility functions provided for the half type applicable to simulation only, and are not meant to be used in synthesis. This is the reason these are not defined in HLS User's Guide UG902. 

 

OK, I hope this helps,
Scott

Highlighted
227 Views
Registered: ‎07-23-2019

Re: Half precision floating point methods.

Jump to solution

@scampbell 

And that's probably I hadn't heard of those... non-synthesisable functions are useless to me if you can't put them into silicon and get something to work. Simulation-only is a Matrix World.

Moderator
Moderator
225 Views
Registered: ‎10-04-2011

Re: Half precision floating point methods.

Jump to solution

Right. It is pretty common for designers/programmers to look inside these headers to see what is there and try and make use of that. Unfortunately, problems such as this arise when doing so. That is why I agree with you that we should stick with the defined functions exposed and documented in UG902.

Thanks again for the help!

Scott

Observer endofday
Observer
186 Views
Registered: ‎07-24-2018

Re: Half precision floating point methods.

Jump to solution

Thank you all for replying.

0 Kudos