DSPRelated.com
Forums

TI 54x Assembler - Is it possible to move between T/ASM and A/B registers

Started by Unknown February 22, 2005
Hi all,

I have what should be a simple request that I can't seem to find the
answer to.

In TI 54x assembler, is there an instruction to copy a value directly
from either the T or ASM registers to the A/B accumulator registers?

My motivation is that fixed point math frequently requires a shift
value to be calculated in the A or B accumulators (I dont believe T or
ASM can do arithmetic). Once the shift value is calculated in A or B, I
believe it needs to be copied to the T or ASM registers in order for
the shift to be applied, for example using 'NORM A' or 'LD A, ASM, A'
respectively.

However I can not find a single instruction method of moving the shift
value from A or B to T or ASM in 54x assembly.

My current solution is to use the stack as an intermediate storage
location, for example:
(shift value has been calculated in B)
STL  B, *sp(temp)
LD   *sp(temp), ASM

but this feels inefficient and dirty.

Help clean my code up!

Regards,

Nick

I have just found a solution, although I still think its a bit of a
hack.

Absolute addressing can be used to address a memory mapped register,
therefore allowing a register such as T or ASM to be used as a Smem
parameter.

For example
LD T, B
does not work because T is not a Smem address

But
LD *(0Eh), B
does work because *(0Eh) is a Smem address that points to the memory
mapped location of the T register (see SPRU131G pg 3-27).


This still feels a bit dirty to me, but at least it is just one
instruction. Is there a better method?

Regards,

Nick

Look at the MVMM instruction (Move Memory Mapped Register) (or similarly the
MVDK, MVDM )  I think one of these will do what you need.  Just be careful
of pipeline latencies.

Going from A or B into T is straight forward:
 STLM A,T     ;  T=x
 MPY  y,A     ; A=x*y

Hope this helps

-Shawn



<npelly@gmail.com> wrote in message
news:1109121040.475930.89540@f14g2000cwb.googlegroups.com...
> Hi all, > > I have what should be a simple request that I can't seem to find the > answer to. > > In TI 54x assembler, is there an instruction to copy a value directly > from either the T or ASM registers to the A/B accumulator registers? > > My motivation is that fixed point math frequently requires a shift > value to be calculated in the A or B accumulators (I dont believe T or > ASM can do arithmetic). Once the shift value is calculated in A or B, I > believe it needs to be copied to the T or ASM registers in order for > the shift to be applied, for example using 'NORM A' or 'LD A, ASM, A' > respectively. > > However I can not find a single instruction method of moving the shift > value from A or B to T or ASM in 54x assembly. > > My current solution is to use the stack as an intermediate storage > location, for example: > (shift value has been calculated in B) > STL B, *sp(temp) > LD *sp(temp), ASM > > but this feels inefficient and dirty. > > Help clean my code up! > > Regards, > > Nick >