Accumulator clipping order question

Algorithm development and general DSP issues

Moderator: frank

Post Reply
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Accumulator clipping order question

Post 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.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: Accumulator clipping order question

Post 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....
Frank Thomson
Experimental Noize
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Re: Accumulator clipping order question

Post by knutolai »

Thanks Frank :)
Post Reply