Š

Data addressing modes provide various ways to access operands to execute instructions and place results in the memory or the registers.

‡ ‡ ‡ ‡ ‡ ‡

In immediate addressing, the instruction syntax contains the specific value of the operand. Two types of values can be encoded in an instruction: Short immediate values can be 3, 5, 8, or 9 bits in length. Long immediate values are always 16 bits in length. Immediate values can be encoded in 1-word or 2word instructions. The 3-, 5-, 8-, or 9-bit values are encoded into 1word instructions; 16-bit values are encoded into 2word instructions.

The length of the immediate value encoded in an instruction depends on the type of instruction used.

. For example. bits 0²15 of the high word of a 2-word encoding. A RPT instruction: a long-immediate (#lk) value is encoded in instructions that use immediate addressing. LD #80h.‡ ‡ ‡ ‡ ‡ The syntax for immediate addressing uses a number sign (#) immediately preceding the value or symbol to indicate that it is an immediate value. to load accumulator A with the value 80 in hexadecimal. The opcode of the instruction is encoded in the high half of the instruction. The value of the constant is in the remaining instruction space.

.

. dmad. Ymem. so instructions that encode absolute addresses are always at least two words in length. pmad. Smem PORTW Smem. pmad MVPD pmad. MMR. Smem MVMD MMR. dmad Program-memory address (pmad) addressing: FIRS Xmem. PA *(lk) addressing is used with all instructions that support the use of a single data-memory (Smem) operand. Smem Port address (PA) addressing: PORTR PA. pmad. Absolute addresses are always encoded with a length of 16 bits.‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Data-memory address (dmad) addressing: MVDK Smem. pmad MACD Smem. src MACP Smem. src MVDP Smem. MVDM dmad. MVKD dmad.

. the address referenced by SAMPLE is the dmad value. to copy the value contained at the address labeled SAMPLE in data space to the memory location in data space pointed to by AR5. The syntax for dmad addressing uses a symbol or a number to specify an address in data space.‡ ‡ ‡ ‡ ‡ ‡ dmad Addressing Data-memory address (dmad) addressing uses a specific value to specify an address in data space. one would write: MVKD SAMPLE. For example. *AR5 In this example.

*AR7² In this example. to copy a word in the program memory location labeled TABLE to a data-memory location specified by AR7. . the address referenced by TABLE is the pmad value. The syntax for pmad addressing uses a symbol or a number to specify an address in program space. one would write: MVPD TABLE.‡ ‡ ‡ ‡ ‡ ‡ pmad Addressing Program-memory address (pmad) addressing uses a specific value to specify an address in program space. For example.

‡ The syntax for PA addressing uses a symbol or a number to specify the port address. FIFO refers to the port address. *AR5 ‡ In the example. ‡ For example.PA Addressing ‡ Port address (PA) addressing uses a specific value to specify an external I/O port address. to copy a value from the I/O port at port address FIFO to a data-memory location pointed to by AR5. . one would write: ‡ PORTR FIFO.

For example.‡ ‡ ‡ ‡ ‡ ‡ *(lk) Addressing *(lk) addressing uses a specific value to specify an address in data space. . The syntax for *(lk) addressing uses a symbol or a number to specify an address in data space.A The syntax for *(lk) addressing allows all instructions that use Smem addressing to access any location in data space without changing the DP or initializing an AR. one would write: LD *(BUFFER). to load accumulator A with the value contained in address BUFFER in data space.

This addressing mode is used to address program memory as data. Two instructions allow to use the accumulator as an address: READA Smem.‡ ‡ ‡ ‡ ‡ ‡ ‡ Accumulator Addressing: Accumulator addressing uses the value in the accumulator as an address. WRITA Smem READA transfers a word from a program-memory location specified by accumulator A to a datamemory location specified by the single datamemory (Smem) operand of the instruction. WRITA transfers a word from a data-memory location specified by the Smem operand of the instruction to a program-memory location specified by accumulator A. .

you can access any of 128 locations in random order without changing the DP or the SP.Š Š Š Š Direct Addressing In direct addressing. with the datapage pointer (DP). . The 7-bit dma is an address offset that is combined with a base address. Using this form of addressing. or with the stack pointer (SP) to form a 16-bit data-memory address. the instruction contains the lower seven bits of the data memory address (dma).

located in status register ST1. to add the contents of the memory location SAMPLE to accumulator B. selects which method is used to generate the address: When CPL = 0. For example.‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Either DP or SP can be combined with the dma offset to generate the actual address. . provided that the correct base address is in DP (CPL = 0) or SP (CPL = 1). you would write: ADD SAMPLE. The compiler mode bit (CPL). the dma field is concatenated with the 9-bit DP field to form the 16-bit data-memory address. B The lower seven bits of the address of SAMPLE are stored in the instruction word. When CPL = 1. the dma field is added (positive offset) to SP to form the 16-bit data-memory address. The syntax for direct addressing uses a symbol or a number to specify the offset value.

.

.

The only difference between an access to location 0 on page 1 and to location 0 on page 2 is the value of the DP. In other words. because the DP·s range is from 0 to 511 (29 ² 1). . DP-referenced direct addressing divides memory into 512 pages. because the dma ranges from 0 to 127 (27 ² 1). The DP is loaded by the LD instruction. the 7-bit dma in the instruction register is concatenated with the 9-bit DP to form the address. Each page has 128 addressable locations. the DP points to one of 512 possible 128-word data-memory pages. the dma points to the specific location within that page.‡ ‡ ‡ ‡ ‡ In DP-referenced direct addressing.

the 7-bit dma in the instruction register is added as a positive offset to the SP to form the effective 16bit data-memory address. ‡ SP can also add or remove items from the stack.SP-Referenced Direct Addressing ‡ In SP-referenced direct addressing. . The dma points to the specific location on the page. allowing you to access a contiguous 128-word (2^7 ² 1) block in memory from any base address. ‡ The SP points to any address in memory.

any location in the 64Kword data space can be accessed using the 16bit address contained in an auxiliary register. Š Indirect addressing is used mainly when there is a need to step through sequential locations in memory in fixed-size steps.Indirect Addressing: Š In indirect addressing. . Š The C54xDSP has eight 16-bit auxiliary registers (AR0²AR7).

The AR0 register is used for indexed and bitreversed addressing modes in addition to being used to point to memory as the other auxiliary registers do. . an increment. Special modes offer circular and bit-reversed addressing.Š Š Š When memory is addressed with indirect addressing. the auxiliary register and the address can be optionally modified by a decrement. an offset. or an index. A circular buffer size register (BK) is used with circular addressing.

and a read of one memory location combined with a write to a memory location. .Š Š Indirect addressing is flexible enough not only to read or write a single 16-bit data operand from memory with one instruction. Accesses of two data-memory locations include reads of two independent memory locations. reads and writes of two consecutive memory locations. but also to access two data memory locations with one instruction.

.

Š The ARAUs perform unsigned.ARAU and Address-Generation Operation Š Two auxiliary register arithmetic units (ARAU0 and ARAU1) operate on the contents of the auxiliary registers. Š Some addresses can be obtained by premodifying the auxiliary register. . 16-bit auxiliary register arithmetic operations.

.

.

.

Š Š Š Memory-mapped register addressing is used to modify the memory-mapped registers without affecting either the current data-page pointer (DP) value or the current stack-pointer (SP) value. Memory-mapped register addressing works for both direct and indirect addressing. . the overhead for writing to a register is minimal. Because DP and SP do not need to be modified in this mode.

regardless of the current value of DP or SP when direct addressing is used Using the seven LSBs of the current auxiliary register value when indirect addressing is used If AR1 is used to point to a memory-mapped register in memory mapped register addressing mode and it contains a value of FF25h. .Š Š Š Š Addresses are generated by: Forcing the nine most significant bits (MSBs) of data-memory address to 0.

After execution. since the seven LSBs of AR1 are 25h and the address of the PRD is 0025h. . the value remaining in AR1 is 0025h.Then AR1 points to the timer period register (PRD).

to address the stack. The stack is filled from the highest to the lowest memory address. the stack pointer (SP). .Š Š Š The system stack is used to automatically store the program counter during interrupts and subroutines. The processor uses a 16-bit memory mapped register. SP always points to the last element stored onto the stack.

POPM pops a memory-mapped register from the stack. PSHM pushes a memory-mapped register onto the stack. POPD pops a data-memory value from the stack. .Š Š Š Š Š Four instructions access the stack using the stack addressing mode: PSHD pushes a data-memory value onto the stack.

.A push predecrements and a pop postincrements the address in the SP.

the return address is automatically saved in the stack using a push operation. When a subroutine is called or an interrupt occurs. When a subroutine returns. . The stack is used during interrupts and subroutines to save and restore the PC contents.Š Š Š Š Other operations also affect the stack and the stack pointer. the return address is retrieved from the stack using a pop operation and loaded into the PC.

such as convolution. As new data comes in. require the implementation of a circular buffer in memory. The key to the implementation of a circular buffer is the implementation of circular addressing. correlation. a circular buffer is a sliding window containing the most recent data. and FIR filters. In these algorithms. the buffer overwrites the oldest data.Š Š Š Š Circular Addressing: Many algorithms. .

and the value 31 must be loaded into BK.Š Š Š The circular-buffer size register (BK) specifies the size of the circular buffer. For eg. The value R must be loaded into BK. the N LSBs of the base address of the circular buffer must be 0). . A circular buffer of size R must start on a N-bit boundary (that is. a 31-word circular buffer must start at an address whose five LSBs are 0 (that is. where N is the smallest integer that satisfies 2N> R. XXXX XXXX XXX0 00002).

The end of buffer address (EOB) of the circular buffer is determined by replacing the N LSBs of ARx with the N LSBs of BK. XXXX XXXX XX00 00002). .Š Š Š A 32-word circular buffer must start at an address whose six LSBs are 0 (that is. The effective base address (EFB) of the circular buffer is determined by zeroing the N LSBs of a user-selected auxiliary register (ARx). and the value 32 must be loaded into BK.

Use a step less than or equal to the circular buffer size. RULES: Place the first (lowest) address of the circular buffer on a 2N boundary where 2N is larger than the circular buffer size. The first time the circular queue is addressed.Š Š Š Š The index of the circular buffer is simply the N LSBs of ARx and the step is the quantity being added to or subtracted from the auxiliary register. . the auxiliary register must point to an element in the circular queue.

Š When BK is zero. the circular modifier results in no circular address modification. .The algorithm for circular addressing is as follows: If 0 <= index + step<BK index = index + step Else if index + step >=BK index = index + step ² BK Else if index + step < 0 index = index + step + BK Š Circular addressing can be used for single datamemory or dual data-memory operands.

.

.

where N is an integer. The value contained in AR0 must be equal to 2N²1. In this addressing mode. AR0 specifies one half of the size of the FFT. . An auxiliary register points to the physical location of a data value. and the FFT size is 2N.Š Š Š Bit-reversed addressing enhances execution speed and program memory for FFT algorithms that use a variety of radixes.

. the address is generated in a bit-reversed fashion. with the carry bit propagating from left to right. instead of the normal right to left.Š When you add AR0 to the auxiliary register using bit-reversed addressing.

. These instructions are all one word long and operate in indirect addressing mode only.Š Š Š Dual data-memory operand addressing is used for instructions that perform two reads or a single read and a parallel store (indicated by two vertical bars. ||) at the same time. Two data-memory operands are represented by Xmem and Ymem: Xmem is a read operand with access through the D bus.

AR2 ² AR5. .Š Š Ymem is used as a read operand in instructions with dual reads (accessed through the C bus) or as a write operand in instructions with a parallel store (accessed through the E bus). Because only two bits are available for selecting each auxiliary register in this mode. only four of the auxiliary registers can be used.