Page 1 of 1

Accumulator clipping order question

Posted: Sun Apr 28, 2019 5:25 am
by knutolai
Consider a single run-through of the below codes:

Code: Select all

sof	0, -0.5
wrax	reg0, 0		; reg0 = -0.5
sof	0, -1
wrax	reg1,0		; reg1 = -1

ldax	reg0		; acc = -0.5
rdax	reg1, -2	; acc = -0.5 + (reg1*-2)
wrax	reg2, 0		; reg2 = acc
What would be the content of reg2?

On one hand you could think that -0.5 + (-1*-2) = 1.5 which would be clipped to 1 (max positive acc value).
But on the other hand you could think that the content of (-1*-2) would be clipped before being added with -0.5 which would yield an answer of 0.5.

I know I can test this by outputing the result to one of the DACs, but I'm currently away from my workshop.

Re: Accumulator clipping order question

Posted: Sun Apr 28, 2019 9:59 am
by frank
If memory serves, as it has been a long time since I designed the MAC, there is a bit or two of headroom so it should be 1.5 and saturated to 0.999....

Re: Accumulator clipping order question

Posted: Sun Apr 28, 2019 10:10 am
by knutolai
Thanks Frank :)