# problem in sending and receiving data to a fixed point IP core.

1. ## problem in sending and receiving data to a fixed point IP core.

HI there,
I have a simple fixed-point adder written in HLS. I exported it as an IP core with Axi-lite interface. After completing the design in IP integrator i have written an SDK C++ app.

But the functions that are generated for sending inputs show me that, i need to send u32 Data. But my design is for fixed point.
Can i not send any other datatype like signed or float to IP core other than u32 data.? It looks to me very strange.

Can someone tell me how to deal with it?
How do i send my fixed point data types to fixed point IP core?

•

2. ## Re: problem in sending and receiving data to a fixed point IP core.

Hi,

fixed point .... you decide
* if you mean fixed point binary or fixed point decimal
* if it is signed or not
* how many integer bits/digits you use
* and how many fractional bits/digits you use.

Where are these informations?

Klaus

•

3. ## Re: problem in sending and receiving data to a fixed point IP core.

I am going to use fixed point decimal. Here is how i have defined my fixed point data:

typedef ap_fixed<22,10> data_t;
data_t a=55.12;
data_t b=21.32;
data_t c=32.12;

can you tell me how i can send it to IP core which only takes u32 data types?

•

4. ## Re: problem in sending and receiving data to a fixed point IP core.

data_t and u32 are both 32-bit numbers, also standard float type, by the way. You can send any 32-bit entity as u32 parameter, using common C type casting methods.

5. ## Re: problem in sending and receiving data to a fixed point IP core.

Hi,

I assume it is fixed point binary, not decimal.
the decimal value "55.12" is represented in

* integer: "55" = "0b 00 0000 0000 0000 0011 0111"

* fractional: "0.12" = 0b 00 0111 1011"
(calculated as 0.12 * 2^10 = 123 (rounded), the "10" of 2^10 comes from the 10 bits fractional resolution)

so the total 32 bit binary number is: 0b 0000 0000 0000 0000 1101 11|00 0111 1011
(the "|" is just to visualize where the dicimal point is.)

Klaus

6. ## Re: problem in sending and receiving data to a fixed point IP core.

So i need to convert fixed to binary and send, is it?

•

7. ## Re: problem in sending and receiving data to a fixed point IP core.

Hi,

if it already is in fixed_binary then you donīt need a conversion to binary.

It is just a problem of definition. But 32 bits will be 32 bits.

***
example:

Unsigned integer 8 bits: letīs say the decimal value is "5" --> 0b 0000 0101
now multiply it with decimal 7 and get decimal 35 = 0b 0010 0011

***
now say you define the value as 6.2 unsigned fixed binary.
then decimal "5" is represented as 0b 0001 01|00
now multiply it with decimal 7 and get decimal 35 = 0b 1000 11|00

now focus on the binary value 0b 0001 0100 (formerly seen as decimal "5", but now see it as usual integer binary) then it represents the decimal value "20"
now multiply it with decimal 7 and get the decimal value of 140 = 0b 1000 1100

Did you recognize that the binary values (input and result) remain the same ... and the difference is only in your mind, because you decided it to be 6.2 fixed binary?

Klaus

--[[ ]]--