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: 
Highlighted
Observer lin.zhang
Observer
6,465 Views
Registered: ‎07-09-2012

Floating point core using HLS

Jump to solution

Hi all,

I used Vivado HLS 14.5 in Ubuntu 12.04 64-bit,  to generate an extremely simple function:

void function_test(float a[9], float b[9], float c[9]){
int i=0;
for(i=0;i<9;i++){c[i]=b[i]+a[i];}
}

With the following directives:

set_directive_resource -core AXI4LiteS "function_test" a
set_directive_array_partition -type complete -factor 1 -dim 1 "function_test" a
set_directive_resource -core AXI4LiteS "function_test" b
set_directive_array_partition -type complete -factor 1 -dim 1 "function_test" b
set_directive_resource -core AXI4LiteS "function_test" c
set_directive_array_partition -type complete -factor 1 -dim 1 "function_test" c

This core is added into an EDK project and downloaded on a Zedboard, the ap_start of the core is connected to a switch for non-stop running.

 

The function in HLS has been simulated and works as expected.

My problem is:
I can't write floating point numbers in SDK, I tried type cast etc. but still got the following:
1. Positive floating point numbers, e.g. 1.5, is read as a 1 and written into the register.
2. Negative floating point numbers, e.g. -2.2, is treated as 0.
3. Negative and positive integers are acceptable.

4. Type cast does not work

5. The .c and .h files generated along with the core in "drivers" directory have undefined macros, and the ConfigTable doesn't exist in anyother .c or .h files.


It seems the FPGA only accept int type, both signed and unsigned, how can I write float number?

Wrt problem 5, is there any other directives I should add?

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Observer lin.zhang
Observer
9,967 Views
Registered: ‎07-09-2012

Re: Floating point core using HLS

Jump to solution

I got it solved by using union:

 

union my_type {

u32 u;

float f;

}

 

 

0 Kudos
2 Replies
Observer lin.zhang
Observer
6,459 Views
Registered: ‎07-09-2012

Re: Floating point core using HLS

Jump to solution

I have solved problem 5, by adding "pcores" and "drivers" directories into the repository of SDK.

 

I made a mistake on the path ..

0 Kudos
Observer lin.zhang
Observer
9,968 Views
Registered: ‎07-09-2012

Re: Floating point core using HLS

Jump to solution

I got it solved by using union:

 

union my_type {

u32 u;

float f;

}

 

 

0 Kudos