Immediate addressing means that the numerical
value of the data is itself provided within the assembly
instruction. Various TMS320C54x instructions allow immediate
data of 3, 5, 8, 9, or 16 bits in length, which are signified
in the assembly language syntax descriptions with one of the
above symbols. The 16-bit form is the most common and is
signified by #lk. 16-bit immediate values always
require an extra instruction word and therefore take an extra
machine 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 may
assume 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 the
memory 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 sign
or 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 the
pound sign is not optional when specifying immediate
addressing. The only safe rule, then, is always to prefix the
label 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 opcodes
listed to the left of the assembly instructions with the
assembly opcodes given in the assembly language manual
(Chapter 4 of the Mnemonic
Instruction Set [link] reference).
"Doug course at UIUC using the TI C54x DSP has been adopted by many EE, CE and CS depts Worldwide "