This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

saturation logic on overflow for multiplication/shifting



So it looks like the two overflow modes (OVM=1 forcing saturation on each add/subtract, OVM=0 uses an overflow counter on add/subtract, with explicit SAT ACC to saturate) only pay attention to add/subtract operations. Is there any way to get them to work with shifts or multiplication?

At one point in some assembly-language computation, I need to apply a constant gain factor to a 32-bit number in the accumulator, before extracting a 16-bit portion to an output variable, and need it not to overflow. The only way I can seem to apply any multiplicative factor is to do:

    SAT        ACC
    ADDL    ACC, @ACC
    SAT        ACC
    ADDL    ACC, @ACC
    SAT        ACC

or

    SAT        ACC
    SETC    OVM
    ADDL    ACC, @ACC
    ADDL    ACC, @ACC
    CLRC    OVM

(e.g. add accumulator to itself multiple times, and I have to saturate first before the first one of these so that the accumulator is not overflowed, e.g. 0x7fffffff + 2 needs to be interpreted as a positive number but it shows up in the accumulator prior to saturation as a negative number 0x80000001)

It would have been nice to have an ASL (arithmetic shift left) operation in addition to LSL, such that for ASL the overflow/saturation logic were obeyed.