+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Junior Member level 2
    Points: 211, Level: 2

    Join Date
    Jan 2017
    Posts
    24
    Helped
    0 / 0
    Points
    211
    Level
    2

    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?
    Click image for larger version. 

Name:	u32.PNG 
Views:	6 
Size:	51.8 KB 
ID:	137835Click image for larger version. 

Name:	ans.PNG 
Views:	6 
Size:	35.9 KB 
ID:	137836

    •   Alt13th April 2017, 05:57

      advertising

        
       

  2. #2
    Super Moderator
    Points: 53,016, Level: 56
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    10,674
    Helped
    2530 / 2530
    Points
    53,016
    Level
    56

    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



    •   Alt13th April 2017, 10:27

      advertising

        
       

  3. #3
    Junior Member level 2
    Points: 211, Level: 2

    Join Date
    Jan 2017
    Posts
    24
    Helped
    0 / 0
    Points
    211
    Level
    2

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

    Hi thanks for reply.

    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?



    •   Alt13th April 2017, 10:35

      advertising

        
       

  4. #4
    Super Moderator
    Points: 237,321, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    41,068
    Helped
    12542 / 12542
    Points
    237,321
    Level
    100

    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. #5
    Super Moderator
    Points: 53,016, Level: 56
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    10,674
    Helped
    2530 / 2530
    Points
    53,016
    Level
    56

    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



    •   Alt13th April 2017, 11:26

      advertising

        
       

  6. #6
    Junior Member level 2
    Points: 211, Level: 2

    Join Date
    Jan 2017
    Posts
    24
    Helped
    0 / 0
    Points
    211
    Level
    2

    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. #7
    Super Moderator
    Points: 53,016, Level: 56
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    10,674
    Helped
    2530 / 2530
    Points
    53,016
    Level
    56

    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



--[[ ]]--