Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use floating point coefficients in an FIR using VHDL?

Status
Not open for further replies.

nashafi

Member level 1
Joined
Nov 11, 2004
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
294
Hi,

I am writing an FIR filter in VHDL and i tested with some random coefficients like 1,2,3,4,5 and it works fine for impulse response.
Now I have to test it with some actual coefficients which are like
-0.00000001234
or

0.0000234569

I was wondering that if some one can tell me how to convert this into std_logic_vectors or if i can some how use them as it like some integer conversion

Any Ideas ???

Thanks,

-Nauman
 

Multiply all your floating point values by one large constant, round them off to integers, and feed them into your VHDL table. Now you can implement your FIR using integer arithmetic.

Don't make that constant too big, or your integer arithmetic will overflow. Don't make it too small, or the roundoff error will be greater than necessary.
 

shift left to get a enough precision integer
then,shift right to compensate the enlargement before
 

Re: How to use floating point coefficients in an FIR using V

Can any one convert this one
0.00029044

what will be a suitable multiplication factor ?

if i have to shift left then still it is floating point ?
can i define

integer := 0.00029044 in VHDL

or i have to convert it to binary to make a std_logic_vector


Thanks,

-nauman
 

Sounds like you need to learn how to do fixed point arithmetic. Try searching the web for those three words, and you will get a lot of hits. Maybe someone here can suggest a good book or tutorial site.
 

Re: How to use floating point coefficients in an FIR using V

hi,
there is no folating point representations in vhdl.for ur no depending on ur decimal number precision, give a representation as below:

if coefficent is 2(.0002944) then "10" or if 29 then "11101" or else give them as 2 or 29 and use conv_std_logic_vector function to convert to binary.

take care ur results dont overflow.
 

Re: How to use floating point coefficients in an FIR using V

Yes, There is no concept of Floating Point in VHDL. We have to keep in our mind by a cautinary declaration of Floating Points For eg. for 32-Bit Floating Point No.
From Left Hand Side:
31 30---------------23 22-----------------------0
Sign Exponent Significand
And the Floating Point is assumed but is not there in VHDL:(
For more info on this refer to Computer Architecture Book by Hennesy & Patterson
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top