<< Chapter < Page Chapter >> Page >

Do not use an asterisk in front of ARx variables here, since this is not indirect addressing.

Examples:

mvmm AR3,AR5 ; sets AR5 = AR3 stm #5,AR2 ; sets AR2 = 5 ldm AR0,A ; sets A = AR0

Immediate addressing: #k3, #k5, k, #k9, #lk

Immediate addressing means that the numerical value of the data is itself provided within the assemblyinstruction. Various TMS320C54x instructions allow immediate data of 3, 5, 8, 9, or 16 bits in length, which are signifiedin the assembly language syntax descriptions with one of the above symbols. The 16-bit form is the most common and issignified by #lk . 16-bit immediate values always require an extra instruction word and therefore take an extramachine cycle to execute.

An immediate data operand is almost always specified in assembler syntax by prepending a pound sign ( # ) to the data. Depending on the context, the assembler mayassume that you meant immediate addressing anyway.

Examples:

ld #0,A ; sets A = 0 cmpm AR1,#1 ; sets flag TC = 1 if AR1 == 1; else TC = 0

Labels make this more complicated. Recall that a label in your assembly code is nothing more than shorthand for thememory address where the labeled code or data is stored. So does an instruction like

stm coef,AR2 ; sets AR2 = memory address of label coef

mean to store the contents of memory location coef in AR2 , or does it mean to store the memory address coef itself in AR2 ? The second interpretation is correct. Because the stm instruction has only one form, expecting a #lk immediate operand, the assembler does not care whether the label is prefixed with a pound signor not. Still, it would have been better for us to include the pound sign in the above example for clarity.

Many instructions have several versions allowing the use of different addressing modes (see ld for a good example of this). With these instructions, including thepound sign is not optional when specifying immediate addressing. The only safe rule, then, is always to prefix thelabel with a pound sign if you wish to specify the memory address of the label and not the contents of that address.

If you are not sure how a particular instruction has been assembled, you can always examine the .lst file produced by the assembler, and compare the hexadecimal opcodeslisted to the left of the assembly instructions with the assembly opcodes given in the assembly language manual(Chapter 4 of the Mnemonic Instruction Set reference).

Direct addressing: smem and others

In the modes called direct addressing by TI, the instruction opcode contains a memory offset (see the "dma"bits on page 5-8 of the CPU and Peripherals reference) seven bits long, which is combined with either the DP (data pointer) or SP (stack pointer) register to obtain a complete 16-bit data-memory address. This divides the data memory intopages of 128 words each.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Dsp laboratory with ti tms320c54x. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10078/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Dsp laboratory with ti tms320c54x' conversation and receive update notifications?

Ask