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!

Accepted Solution

ap_fixed details

Posts: 5,149
Registered: ‎03-31-2012

Re: ap_fixed details

I just found this old thread and wanted to contribute a solution to it which I didn't have at the time:


The traits file in %XILINX/include/utils/x_hls_traits.h has the solution to this issue. One can define a trait based on types and use them like this:


typedef ap_fixed<...> foo;

typedef ap_fixed<...> bar;


typedef typename hls::x_traits<foo, bar>::MULT_T fooXbar;


This is how multiplication etc operators can expand their outputs based on the size of the input variable.

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
Posts: 187
Registered: ‎08-31-2017

Re: ap_fixed details



For your previous comment in Q4 LOSSLESS SUM,it seems your reply is something wrong in my tests in ap_fixed<5,3> for 3.25 and ap_fixed<5,2> for 1.125.


It should be corrected as ap_fixed<max(a-c,b-d)+max(b,d)+1,max(b,d)+1>. Thanks