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.

digital filter output quantisation

Status
Not open for further replies.

91divine

Junior Member level 3
Junior Member level 3
Joined
Jun 12, 2012
Messages
28
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Netherlands
Activity points
1,488
Guys i have designed a VHDL code for a 4th order digital filter.
It have 10bit input from a ADC and it should give 10bit output. But the simulator shows an error that output should be 20bit(double of input).
Can any one help me in quantisation of the 20bit output to 10bit for my further applications.
I have coded the filter in figure2 of **broken link removed**
 

What kind of error are you getting? For no loss of precision, if you have 10 bit input and 10 bit coefficients, you'll need 20 bit products. Then when you sum those four products, you'll need an additional 2 bits for the result. If you just want a 10 bit output, then you need to perform some rounding.
 

There are several methods for rounding. For the sake of discussion, assume you want to round an unsigned 20 bit number to 10 bits. Here's the simplest approach:

1) Take the 10 most-significant bits
2) Look at the 11th most-significant bit-if it's 1, add one to your 10 MSBs, otherwise add zero.
3) Done

This gets a little more complicated if you're using signed numbers, but you get the idea.

Think of it in terms of decimal numbers, if that helps. To round a decimal number, if the fractional part is greater than .5, you round your integer part up 1, otherwise, you just leave the integer part alone.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top