问题
I am trying to implement a Low Pass Filter in an FPGA using VHDL. Now, I worked out all the filter coefficients, but I am having trouble trying to understand how to work with the coefficients, given the fact that they are non-whole numbers. I would appreciate any help with an example of a simple filter implementation in VHDL.
Thanks a lot, Chris
回答1:
You should convert the coefficients to fix-point numbers.
Very short:
- Chose a precision and multiply all coefficients by the nearest higher reciprocal power of two.
- Do the normal multiply-add operation in the FPGA.
- The end result should be divided by that same power of two.
Example:
- Coefficients are C0 = 0.707, C1= 0.123
- Lets take a precision of 0.5% which is 1/200
- Nearest power of 2 above 200 is 256
- C0 becomes 0.707*256 = 181, C1 becomes 0.123*256 = 31.
- Use those in your filter.
- At the end throw away the bottom 8 bits (As extra you can round using bit 7)
来源:https://stackoverflow.com/questions/58804713/low-pass-filters-in-fpgas