using trigonometric functions in fixed point design in vivado HLS

Status
Not open for further replies.

sai_shashi

Junior Member level 3
Joined
Jan 20, 2017
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
240
Hi there,
I have an algorithm in HLS which has fixed point data types and which uses a trigonometric function:

temp=imgons[j][k] * (hls:data_t) sin(((float)(50))));

where temp and imgons are FP data types. But when i run the model i get the following error:
Can some help me? (is it the correct way to define the trigonometric function in the fixed point design ?)

Thanks in advance..
 

hls:data_t) is not a valid type declaration. You want (hls::data_t) for the cast.
 

i have changed into:

temp=imgons[j][k]* (hls::data_t) sin(((float)(50)));

It gives me the following error:



Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Compiling ../../../core.cpp in debug mode
In file included from C:/Xilinx/Vivado_HLS/2016.2/include/floating_point_v7_0_bitacc_cmodel.h:143:0,
                 from C:/Xilinx/Vivado_HLS/2016.2/include/hls_half.h:40,
                 from C:/Xilinx/Vivado_HLS/2016.2/include/hls/utils/x_hls_utils.h:37,
                 from C:/Xilinx/Vivado_HLS/2016.2/include/hls_math.h:48,
                 from ../../../core.h:10,
                 from ../../../core.cpp:1:
C:/Xilinx/Vivado_HLS/2016.2/include/gmp.h:62:0: warning: "__GMP_LIBGMP_DLL" redefined [enabled by default]
C:/Xilinx/Vivado_HLS/2016.2/include/floating_point_v7_0_bitacc_cmodel.h:135:0: note: this is the location of the previous definition
../../../core.cpp: In function 'void mat_3d_mult(data_t (*)[64][64], data_t (*)[64][64])':
../../../core.cpp:37:33: error: 'data_t' is not a member of 'hls'
../../../core.cpp:37:33: note: suggested alternative:
../../../core.h:31:24: note:   'data_t'
../../../core.cpp:37:46: error: expected ';' before 'sin'
make: *** [obj/core.o] Error 1
CRITICAL WARNING: [SIM 1] 'csim_design' failed: compilation error(s).

 
Last edited by a moderator:

These are not HLS errors. Are you sure you don't want ::data_t or <some-other-namespace>::data_t?

It sounds like you can just use (data_t) for the conversion.
 

Hi there,

The code i am using is :

temp=imgons[j][k]* (data_t)sin(90);

where i am multiplying a matrix of ones by a constant value, sine(90)=1
but in the output i get the following values: why is it so?
 

Did you already learn about the difference between degree and rad? You have put sine(90 rad).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…