0
$\begingroup$

I have found this piece of code in Infenion DSP Library (asm code):

Fir_Blk_16()
...
;(ACC)=(ACC)+h(i)*x(n-i)<<1 as comment

I don't understand why the result is shifted (<<1)?

Is this for rounding purposes?

Thank you in advance,

Anton

$\endgroup$
3
  • $\begingroup$ what does the "as comment" mean here? $\endgroup$ Commented Feb 20, 2023 at 14:18
  • $\begingroup$ also, there's many reasons you might want to round – from limited accumulator bitwidth to controlling the gain of the filter intentionally. Without much more context, we could, at best, guess. $\endgroup$ Commented Feb 20, 2023 at 14:18
  • $\begingroup$ also, removed the unrelated tags. Also, is this really about a specific DSP chip? If so, please explicitily name the chip. $\endgroup$ Commented Feb 20, 2023 at 14:19

1 Answer 1

1
$\begingroup$

The shifting is most likely related to the fixed point representation. If input, filter coefficients and accumulator are in different "Qs" (which is the fixed to float scale factor), shifts are used to adjust.

See for example: https://en.wikipedia.org/wiki/Q_(number_format)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.