Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

URJENT problem in fixed point output

sir i use fixed-pkg to represent fraction bits,but when the output is 0.05118,whose binary representation is something like 0.00001101,in waveform i get only 0.should i use float_pkg to get the correct output?:cry:

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    do you have enough fractional bits in your signal?

    and no, don't use float. without seeing the rest of your code we cant say what's wrong.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    How do you know in which step of the calculation the result is set to zero? I can't guess without knowing the component code.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The code has several length matching errors and doesn't compile. Also, what's the fpdiv component?

    Assignments with length msimatch:

    p<= to_sfixed(i)*data_in;

    b<= (i*Pi);

    cv_q<=to_slv(b);
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    @ fvm sir,

    ihave taken i (2 downto 0,data_in (14 bits),so in multiplication result is 16 bits. as i take i an ufixednumber,so i convert in in sfixed.

    now i take pi (ufixed(2 downto -7) ) so after multiplication it should be 6 downto -7,but i take b(b:ufixed(8 downto -8);) to match with the fixed point division 16 bit inputs. yep there is error,u r right,i will use correct range, other else.............. sir.