[sdiy] SHARC DSP programming

Richie Burnett rburnett at richieburnett.co.uk
Sat Sep 24 18:21:15 CEST 2016

Anyone programming Analog Device's SHARC DSP who can answer a quick 

Is there an instruction to left/right shift the MAC accumulator result (MRF 
or MRB)?

I think that surely there must be, as this is essential for normalising 
results of accumulated MAC operations, but I can't find it!  On the dsPIC 
you can specify an accumulator shift as part of the "Round and Store 
Accumulator" instruction "sac.r", where the double-word accumulator is 
optionally rounded and truncated back to single-precision before being 
stored.  I can't seem to find a similar instruction for the SHARC, which 
seems crazy, but the documentation for the instruction set is a bit of a 
mess, rather than having logical groups of instructions together, etc.

The best I can come up with so far is to saturate the MAC result, then move 
the multiplier result into a general purpose register, then clip it, then 
left shift it to multiply by 2 or 4 or whatever.  But this is many more 
instructions, and it obviously doesn't shift in the bits from the lower half 
of the MAC accumulator that it really should do if you do a real double-word 
shift operation.  There doesn't seem much point in having an extended 
precision accumulator (with overflow bits added onto the left, and underflow 
bits to the right,) if you can't shift it left or right to normalise it when 
you store the result.

Am I missing something!?!?


More information about the Synth-diy mailing list