Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21618 Discussions

URJENT problem in fixed point output

Altera_Forum
Honored Contributor II
1,599 Views

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:

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
727 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
727 Views

sir here is my code,plz suggest me.

0 Kudos
Altera_Forum
Honored Contributor II
727 Views

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.

0 Kudos
Altera_Forum
Honored Contributor II
727 Views

@FvM sir, i am attaching the component.plz help.

0 Kudos
Altera_Forum
Honored Contributor II
727 Views

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);
0 Kudos
Altera_Forum
Honored Contributor II
727 Views

@ 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.
0 Kudos
Reply