--- Quote Start ---
Hey guys,
I have one more question about fixed point rounding. If you multiply two numbers and have to perform rounding, how would you do that with fixed point? I'm currently rounding a 32 bit product down to 16 bits by truncating the first 15 bits, thus performing a division by 2^15. But, if you have four bits representing the fractional part, how do you perform the rounding?
--- Quote End ---
There's examples of different rounding functions from MATLAB on p41 of this document (where p41 is on the page of the document, its p43 of the PDF when read in acrobat);
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-100slides_hawkins.pdf In general, you want to use convergent rounding (round to nearest even).
There's additional details in here:
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-100paper_hawkins.pdf and source code for convergent rounding in here:
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc2011_fpga_dsp_code.zip Cheers,
Dave