EEE C415: DIGITAL SIGNAL PROCESSING Lecture 10
Addressing Modes of TMS320C54x
Last Session ¾Addressing Modes of c54x
29 January 2009
EEE C415 / Shikha Tripathi
2
Today’s Session • Addressing Modes cont… • Instruction set
29 January 2009
EEE C415 / Shikha Tripathi
3
Data Addressing modes 9Immediate Addressing 9Absolute Addressing 9Accumulator Addressing 9Direct Addressing • Indirect Addressing • Memory-Mapped Register Addressing • Stack Addressing
29 January 2009
EEE C415 / Shikha Tripathi
4
Indirect Addressing • Uses 8 ARs; AR0-AR7 • Used to step-through sequential locations in mem in fixed-size steps • AR modified by: • Increment / Decrement • Offset • Index • Special modes: 9Circular addressing • Bit-reserved addressing 29 January 2009
EEE C415 / Shikha Tripathi
5
Bit reversed addressing • Enhances the execution speed for FFT algorithm • AR0 specifies one-half the size of FFT (2N-1) where N is integer (2N : size of FFT) • To generate address, add AR0 to any AR which is pointing to a data value in bit reversed fashion. • Carry propagates from left to right
29 January 2009
EEE C415 / Shikha Tripathi
6
Example
29 January 2009
EEE C415 / Shikha Tripathi
7
Memory mapped register addressing • Modifies MMRs without affecting DP and SP • In addition to registers any scratch-pad RAM on Data Page 0 can be modified • 2 modes ¾Direct: forces 9 MSBs of Dmem to 0 ¾Indirect: uses 7 LSBs of current AR ¾If AR1 point to MMR & it contains FF25h,then AR1 point to Time Period register(PRD) whose address is 25h (7 LSBs of FF25h).After execution AR1=25h.
• Example ¾LDM MMR ,dst (direct) ¾STM #lk,*arx (indirect) 29 January 2009
EEE C415 / Shikha Tripathi
8
Example 1
LDM AR4, A Before execution A
00 0000 1111
AR4 Example 2
FFFF
;Direct After execution A
00 0000 FFFF
AR4
LDM 060h, B
;Direct
Before execution B Data Memory
0060h
29 January 2009
00 0000 0000 1234
FFFF
After execution B 0060h
EEE C415 / Shikha Tripathi
00 0000 1234 1234 9
Example 1
STM #FFFF,IMR
;Direct
Before execution IMR Example 2
After execution
FF01
STM #8765,*Ar7+
IMR ;Indirect
Before execution
29 January 2009
FFFF
After execution
AR0
0000
AR0
8765
AR7
8010
AR7
0011
EEE C415 / Shikha Tripathi
10
CPU MMRs (Table 10.3)
29 January 2009
EEE C415 / Shikha Tripathi
12
Some MMR addr mode Instructions
29 January 2009
EEE C415 / Shikha Tripathi
13
29 January 2009
EEE C415 / Shikha Tripathi
14
Stack Addressing • System Stack: store PC when interrupt / subroutine • To pass data values. • SP points to the last element stored onto the stack
29 January 2009
EEE C415 / Shikha Tripathi
15
PSHD X2 ( )
( ) ( )
• FRAME ??? • INTR ??? • TRAP ??? 29 January 2009
EEE C415 / Shikha Tripathi
16
BUS Operations • • • • •
16-bit read: D bus 16-bit write: E bus 32-bit read: C:D Bus (Msword : Lsword) 32-bit write: ????? For 32-bit data, present address is Msword • Msword even / odd address?? ¾Even:Big Endian ¾Odd: Little endian
29 January 2009
EEE C415 / Shikha Tripathi
17
Instruction set • Arithmetic operations • Logical operations • Load and store operations • Program control operations • Special operations
29 January 2009
EEE C415 / Shikha Tripathi
18
Arithmetic operation • Absolute value • Addition • Subtraction • Multiplication
29 January 2009
EEE C415 / Shikha Tripathi
19
Absolute • ABS src, [dst] • Absolute value of Accumulator • Ex: ABS A, B
• SRC -> DST/ SRC if DST is not specified. • OVM affects the result • C & OV dst flags are affected.
Example
29 January 2009
EEE C415 / Shikha Tripathi
21
Addition
29 January 2009
EEE C415 / Shikha Tripathi
22
Examples • ADD
*AR2+, 12, A
• ADD
B, -5, A ;(category 9)
• ADD
#2345h, 7, B ;(category 8)
29 January 2009
EEE C415 / Shikha Tripathi
;(category 3)
23
Subtraction
29 January 2009
EEE C415 / Shikha Tripathi
24
Example • SUB
*AR1+, 14, A
• SUB
A, -8, B
• SUB
#2345h, 8, A, B
29 January 2009
EEE C415 / Shikha Tripathi
25
Explore Others… • ADDC
*+AR2 (5), A
• ADDM
#123Bh, *AR4+
• ADDS
*AR2-, B
• SUBB
*AR1+, B
• SUBS
*AR2-, B
• SUBC
???
– Used for division
29 January 2009
EEE C415 / Shikha Tripathi
26
Multiply
MPYR Rounds the result of multiplication by adding 215 to the result & then clearing bits 15-0. 29 January 2009
EEE C415 / Shikha Tripathi
27
Example • MPY • MPY
13, A #FFFEh, A
• MPYR
0, B ; DP=004h
Next Session • Instruction set cont.. • Assembler directives • Simple programs
29 January 2009
EEE C415 / Shikha Tripathi
29
Thank You
29 January 2009
EEE C415 / Shikha Tripathi
30