Archi V1.03
Archi V1.03
Chapter 2
Architecture Overview
ESIEE, Slide 2 2
Copyright © 2003 Texas Instruments. All rights reserved.
What Makes a DSP a Special Processor?
C5000
ESIEE, Slide 3 Copyright © 2003 Texas Instruments. All rights reserved.
Common Architectural Features of DSPs
Data crunching:
Complex Algorithms:
Specialised instructions (Viterbi, LMS…)
Bit reverse adressing (FFT)
Circular buffers (FIR filters)
Program
Bus Data Bus
Memory
192K words × 16-bit addressable memory
space in 3 blocks:
1) 64K-words program**
2) 64K-words data,
3) 64K-words I/O
3 Data Read
Buses
1 Program
Bus
2 Data Write
Bus
ESIEE, Slide 20 Copyright © 2003 Texas Instruments. All rights reserved.
TMS320C55x Key Features
32 x 16-bit Instruction buffer queue (IBQ)
Two 17-bit x17-bit MAC units
One 40-bit ALU
One 40-bit Barrel Shifter
One 16-bit ALU
Four 40-bit accumulators
Twelve independent buses:
– Three data read buses
– Two data write buses
– Five data address buses
– One program read bus
– One program address bus
MAC ALU
Time
x4 x3 x2 x1 x0
A
B
3
y 0 = a nx n z = x2 + x4 + x3 + x1 Single-cycle MAC
n=0 Single-cycle ADD
ESIEE, Slide 26 3
Copyright © 2003 Texas Instruments. All rights reserved.
Convolution with the C54x 2 of 2
Amplitude
MAC ALU
Time
x4 x3 x2 x1 x0
A
B
3
y 0 = a nx n z = x2 + x4 + x3 + x1 Single-cycle MAC
n=0 Single-cycle ADD
ESIEE, Slide 27 3
Copyright © 2003 Texas Instruments. All rights reserved.
With the C55x it can be done faster!
Amplitude Data Coeffs
a0
2 taps/cycle
a1
Data Read Buses
a2
a3
Time
x4 x3 x2 x1 x0 MAC
t
MAC
Results
y0 = a0x0 + a1x1 + a2x2 + a3x3 AC0
A
AC1
y1 = a0x1 + a1x2 + a2x3 + a3x4
C54x: MAC *AR2+, *AR3+, A Copyright © 2003 Texas Instruments. All rights reserved. - 28
ESIEE, Slide 28 Copyright © 2003 Texas Instruments. All rights reserved.
C54x Architecture
Data Read A/D Bus (C)
Program A/D Bus (P)
Data Read A/D Bus (D)
PC
XPC MAC ALU
Addr
DP @x2 AR0-7
Gen
Decode A
B
ESIEE, Slide 29 4
Copyright © 2003 Texas Instruments. All rights reserved.
C55x Architecture
Program A/D Bus
Instr A
Buffer PC ARn d CDP MAC MAC
d
Queue r
Gen
AC0
AC1
Decode
Bit Operations
D-Unit executes most
mathematical operations DU
Now, what happens to the result?...
DU
EB[16]
External AC0
FB[16] AC1
AC2
FF_FFFF
AC3
Program/Data Buses
• 40-bit ALU
A(23-0) Muxed GP I/O • 40-bit Barrel
Shifter
MAC ALU DMA Timer
17 x 17 MPY 40-Bit ALU Ch 0 • Temporary Register
CMPS Operator 8/16-bit Host Port
40-Bit Adder
• Exponent Encoder
Peripheral Bus
(VITERBI) Ch 1 Interface (HPI)
RND, SAT EXP Encoder Ch 2 Multichannel Buffered
Shifter Accumulators
Serial Port (McBSP) • Program and Data
Ch 3
40-Bit Barrel 40-Bit ACC A Multichannel Buffered Address Generation
Ch 4 Serial Port (McBSP)
Units
(-16, 31) 40-Bit ACC B
Ch 5 Multichannel Buffered
Addressing Unit Serial Port (McBSP) • Compare, Select
8 Auxiliary Registers
PLL Clock and Store Unit
2 Addressing Units Generator
S/W Waitstate
• 4 Internal Bus Pairs
Power Management Generator
• External Interface
C5416 example
5
ESIEE, Slide 35 Copyright © 2003 Texas Instruments. All rights reserved.
Focus on C54x Architecture
Program/Data Buses
• 40-bit ALU
A(23-0) Muxed GP I/O • 40-bit Barrel
Shifter
MAC ALU DMA Timer
17 x 17 MPY 40-Bit ALU Ch 0 • Temporary Register
CMPS Operator 8/16-bit Host Port
40-Bit Adder
• Exponent Encoder
Peripheral Bus
(VITERBI) Ch 1 Interface (HPI)
RND, SAT EXP Encoder Ch 2 Multichannel Buffered
Shifter Accumulators
Serial Port (McBSP) • Program and Data
Ch 3
40-Bit Barrel 40-Bit ACC A Multichannel Buffered Address Generation
Ch 4 Serial Port (McBSP)
Units
(-16, 31) 40-Bit ACC B
Ch 5 Multichannel Buffered
Addressing Unit Serial Port (McBSP) • Compare, Select
8 Auxiliary Registers
PLL Clock and Store Unit
2 Addressing Units Generator
S/W Waitstate
• 4 Internal Bus Pairs
Power Management Generator
• External Interface
C5416 example
ESIEE, Slide 37 Copyright © 2003 Texas Instruments. All rights reserved.
C54x Pipeline
Program A/D Bus (P)
Pipeline Phases
P - generate program address P F D A R X
F - get opcode P F D A R X
D - decode instruction P F D A R X
A - generate read address P F D A R X
R - read operands P F D A R X
X - execute
P F D A R X
Full Pipeline
P1 F1 D1 A1 R1 X1
P2 F2 D2 A2 R2 X2
P3 F3 D3 A3 R3 X3
P4 F4 D4 A4 R4 X4
P5 F5 D5 A5 R5 X5
P6 F6 D6 A6 R6 X6
P Bus
A
D Bus Ext’l
Mem
C Bus I/F D
E Bus
Size and number of blocks vary based upon device - refer to memory map
ESIEE, Slide 44 10
Copyright © 2003 Texas Instruments. All rights reserved.
C5409 Memory Maps
PROGRAM
PAGE 0 (64K) DATA
0000 0000
DARAM or MMR,
External OVLY Scratch, 64K x 16
8M x 16 memory bit DARAM Data
Program Space
Space
7FFF 7FFF 32K x 16
16K x 16 Internal
Internal External External DARAM
ROM memory memory
C000 Internal or C000
External
External memory
memory DROM
bit or Internal
FF80 VECTORS ROM
FFFF FFFF
DARAM
External External
memory memory 7FFF
External
memory
C000 C000
Internal External
16K x 16 memory or
ROM Internal ROM
FF80 Vectors FF80 Vectors FF80 Vectors
FFFF FFFF FFFF
ESIEE, Slide 46 12
Copyright © 2003 Texas Instruments. All rights reserved.
C5409 8M x 16 Program Space
The OVLY bit selects between two different program memory maps:
OVLY = 0 OVLY = 1
00 0000 00 0000 32K
Page 0 DARAM
ESIEE, Slide 47 13
Copyright © 2003 Texas Instruments. All rights reserved.
C5409 Data Memory
ESIEE, Slide 48 14
Copyright © 2003 Texas Instruments. All rights reserved.
C5409 Peripheral Overview
54x C5409
core
ESIEE, Slide 49 15
Copyright © 2003 Texas Instruments. All rights reserved.
C54x Review - Answers
Name the buses on the C54x
PA,PD CA,CD DA,DD EA,ED
How large are the accumulators?
40 bits
How many adders are on the part?
2, one in the MAC and the other in the ALU
Where are the Memory Mapped Registers located?
From 0x00 to 0x5F in Data Memory
Where is the Reset Vector located?
0xFF80 in Program Memory
ESIEE, Slide 51 17
Copyright © 2003 Texas Instruments. All rights reserved.
Focus on C55x Architecture
Program Bus
E Data Read Buses (B,C,D)
A M
I PU IU AU DU
F
D
Data Write Buses (E,F)
R
Read data from memory, I/O space, and MMR-addressed registers.
Read A-unit registers
Evaluate the conditions of conditional instructions.
X
Read/modify registers that are not MMR-addressed.
Read/modify individual register bits.
Set conditions.
Evaluate the condition of the RPTCC instruction.
W
Write data to MMR-addressed registers or to I/O space (peripheral
registers).
Write data to memory.
ESIEE, Slide 59 Copyright © 2003 Texas Instruments. All rights reserved.
C5510 Unified Memory Map
Program Data Program and data share
00_0000 00_0000 the same map
MMRs
00_00C0 DARAM (32KW) 00_0060 2 ways to view the map:
Internal
01_0000 00_8000 23 0
SARAM (128KW) Prog
05_0000 02_8000 23 1 0
Data 0
External 1. Program - (Bytes)
- 16M x 8-bit, linear 24-bit
addresses
FF_FFFF 7F_FFFF
- Used by fetch/decode logic
A(24)
D(32)
2. Data (Words)
- 8M x 16-bit, segmented into
64K pages, 23-bit address
C55xx - Most code written by a user
core will access data
ESIEE, Slide 60 Copyright © 2003 Texas Instruments. All rights reserved.
Memory Access
16M bytes of memory are addressable as
program space or data space
When the CPU uses program space to read
program code from memory, it uses 24-bit
addresses to reference bytes.
When program accesses data space, it uses 23-bit
addresses to reference 16-bit words.
In both cases, the address buses carry 24-bit
values, but during a data-space access, the least
significant bit on the address bus is forced to 0.
ESIEE, Slide 100 Copyright © 2003 Texas Instruments. All rights reserved.
ASM Bit Field of ST1_55
ASM is the Accumulator shift mode bit
In the TMS320C54x-compatible mode ,
ASM supplies a shift value in the range –16
through 15 (5 bits in 2’s complement).
If C54CM=1: C54x code running on the
C55x DSP, and ASM contains the shift
count for instructions that specify a shift of
an accumulator value.
If C54CM = 0: ASM is ignored and the
shift count for an accumulator shift
operation comes from the temporary
register (T0, T1, T2, or T3) specified in the
C55x instruction or from a constant
embedded in the C55x instruction.
ESIEE, Slide 101 Copyright © 2003 Texas Instruments. All rights reserved.
BRAF Bit of ST1_55
BRAF: Block-repeat active flag is used in the
TMS320C54x-compatible mode (C54CM = 1).
BRAF indicates/controls the status of a block-repeat
operation.
If C54CM = 1 (C54x mode): BRAF is saved and
restored with ST1_55 during context switches caused
by calls, interrupts, and returns.
BRAF is automatically cleared when a far branch
(FB) or far call (FCALL) instruction is executed.
If C54CM = 0: BRAF is not used. The status of repeat
operations is maintained automatically by the CPU
(see CFCT )
To stop or set an active block-repeat operation in the
C54x-compatible mode, you can use the following
instruction:
BCLR BRAF ; Clear BRAF
BSET BRAF ; Set BRAF
ESIEE, Slide 102 Copyright © 2003 Texas Instruments. All rights reserved.
C16 Bit of ST1_55
C16 is the Dual 16-bit arithmetic mode bit used in the
C54x-compatible mode (C54CM = 1), execution of
some instructions is affected by C16.
The arithmetic performed in the D-unit ALU depends
on C16:
If C16 =0 then for an instruction that is affected by C16, the D-unit
ALU performs one 32-bit operation (double-precision arithmetic) .
If C16=1 then an instruction that is affected by C16, the D-unit
ALU performs two 16-bit operations in parallel (dual 16-bit
arithmetic).
If C54CM = 0: The CPU ignores C16. The instruction
alone determines whether dual 16-bit arithmetic or
32-bit arithmetic is used.
You can clear and set C16 with the following instructions:
BCLR C16 ; Clear C16
BSET C16 ; Set C16
ESIEE, Slide 103 Copyright © 2003 Texas Instruments. All rights reserved.
C54CM Bit of ST1_55
C54CM is the TMS320C54x-compatible mode bit
The C54CM bit determines whether the CPU will
support code that was developed for a TMS320C54x
DSP:
If C54CM=0 then the CPU supports code written for
a TMS320C55x (C55x) DSP.
If C54CM=1 then you can use code that was
originally developed for a TMS320C54x (C54x) DSP.
In C54 mode all the C55x CPU resources remain
available; the additional features on the C55x can be
used for code optimization.
Change modes with the following instructions and
assembler directives:
BCLR C54CM ; Clear C54CM (happens at run time)
BSET C54CM ; Set C54CM (happens at run time)
ESIEE, Slide 104 Copyright © 2003 Texas Instruments. All rights reserved.
CPL Bit of ST1_55
CPL is the Compiler mode bit and determines
which of two direct addressing modes is active:
CPL=0 then Direct accesses to data space are
made relative to the data page register (DP).
CPL=1 then Direct accesses to data space are
made relative to the data stack pointer (SP). The
DSP is said to be in compiler mode.
Change modes with the following instructions
and assembler directives:
BCLR CPL ; Clear CPL (happens at run
time)
BSET CPL ; Set CPL (happens at run time)
ESIEE, Slide 105 Copyright © 2003 Texas Instruments. All rights reserved.
FRCT Bit of ST1_55
FRCT is the Fractional mode bit that
sets the fractional mode on or off:
FRCT=0 then results of multiply
operations are not shifted.
FRCT=1 then results of multiply
operations are shifted left by 1 bit for
decimal point adjustment.
This is required when you multiply two
signedQ15 values and you need a Q31
result.
You can clear and set FRCT with :
BCLR FRCT ; Clear FRCT
BSET FRCT ; Set FRCT
ESIEE, Slide 106 Copyright © 2003 Texas Instruments. All rights reserved.
HM Bit of ST1_55
HM is the Hold mode bit used when the DSP
acknowledges an active HOLD signal. It
places its external interface in the high-
impedance state.
Depending on HM, the DSP may also stop
internal program execution:
HM=0 then the DSP continues executing
instructions from internal program memory.
HM=1 then the DSP stops executing
instructions from internal program memory.
To clear and set HM:
BCLR HM ; Clear HM
BSET HM ; Set HM
ESIEE, Slide 107 Copyright © 2003 Texas Instruments. All rights reserved.
INTM Bit of ST1_55
INTM is the Interrupt mode bit, it globally enables
or disables the maskable interrupts.
If INTM =0 All unmasked interrupts are enabled.
If INTM=1 All maskable interrupts are disabled.
Software interrupt instruction and software reset
instruction, set INTM before branching to the
interrupt service routine.
Before executing an interrupt service routine (ISR),
the CPU automatically sets the INTM bit to globally
disable the maskable interrupts. The ISR can re-
enable the maskable interrupts by clearing the INTM
bit.
BCLR INTM ; Clear INTM
BSET INTM ; Set INTM
A return-from-interrupt instruction restores the
INTM bit from the data stack.
ESIEE, Slide 108 Copyright © 2003 Texas Instruments. All rights reserved.
M40 Bit of ST1_55
ESIEE, Slide 109 Copyright © 2003 Texas Instruments. All rights reserved.
M40 Bit
Note: In the TMS320C54x compatible
mode (C54CM = 1), CM=0
An accumulator’s sign bit is extracted from bit
position 39.
Accumulator comparisons versus 0 are done
using bits 39–0.
Signed shifts are performed as if M40 = 1.
M= 40-bit mode. In this mode the sign bit is
extracted from bit position 39, the same as
before on 40 bits.
To clear and set M40 :
BCLR M40 ; Clear M40
BSET M40 ; Set M40
ESIEE, Slide 110 Copyright © 2003 Texas Instruments. All rights reserved.
SATD Bit of ST1_55
SATD is the Saturation mode bit, it determines
whether the CPU saturates overflow results in the D
unit:
SATD =0 No saturation is performed.
SATD=1 If an operation result gives an overflow, the
result is saturated. The saturation depends on the
value of the M40 bit:
M40 = 0 The CPU saturates the result to 00 7FFF FFFFh
(positive overflow) or FF 8000 0000h (negative overflow).
M40 = 1 The CPU saturates the result to 7F FFFF FFFFh
(positive overflow) or 80 0000 0000h (negative overflow).
To clear and set SATD :
BCLR SATD ; Clear SATD
BSET SATD ; Set SATD
ESIEE, Slide 111 Copyright © 2003 Texas Instruments. All rights reserved.
SXMD Bit of ST1_55
SXMD is the Sign-extension mode bit. It sets
and resets the sign-extension mode, which
affects accumulator operations that are
performed in the D unit:
If SXMD=0 then sign-extension mode is off:
For 40-bit operations, 16-bit or smaller
operands are zero extended to 40 bits.
For the conditional subtract instruction, any
16-bit divisor produces the expected result.
When the D-unit arithmetic logic unit (ALU)
is locally configured in its dual 16-bit mode,
16-bit values used in the higher part of the D-
unit ALU are zero extended to 24 bits.
ESIEE, Slide 112 Copyright © 2003 Texas Instruments. All rights reserved.
SXMD
If SXMD=1 then 40-bit operations, 16-bit or smaller
operands are sign extended to 40 bits.
When the D-unit ALU is locally configured in its dual
16-bit mode, 16-bit values used in the higher part of
the D-unit ALU are sign extended to 24 bits.
16-bit accumulator halves are sign extended if they
are shifted right.
During a signed shift of an accumulator, if it is a 32-
bit operation (M40 = 0), bit 31 is copied into the
accumulator’s guard bits (39–32).
Set and reset SXMD by:
BCLR SXMD ; Clear SXMD
BSET SXMD ; Set SXMD
ESIEE, Slide 113 Copyright © 2003 Texas Instruments. All rights reserved.
XF Bit of ST1_55
ESIEE, Slide 114 Copyright © 2003 Texas Instruments. All rights reserved.
AR0LC–AR7LC Bits of ST2_55
AR0LC–AR7LC Bits are the
linear/circular configuration bits of the
eight auxiliary registers, AR0–AR7.
If ARnLC= 0 ARn is used for linear
addressing
If ARnLC=1 ARn is used for circular
addressing
To clear and set the ARnLC bits
BCLR AR0LC ; Clear AR0LC
BSET AR0LC ; Set AR0LC
ESIEE, Slide 115 Copyright © 2003 Texas Instruments. All rights reserved.
ARMS Bit of ST2_55
ARMS AR mode switch bit determines the CPU mode
used for the AR indirect addressing mode:
ESIEE, Slide 116 Copyright © 2003 Texas Instruments. All rights reserved.
CDPLC Bit of ST2_55
CDPLC is the CDP linear/circular
configuration bit. It determines whether
the coefficient data pointer (CDP) is
used for linear addressing or circular
addressing:
CDPLC=0 Linear addressing
CDPLC=1 Circular addressing
ESIEE, Slide 117 Copyright © 2003 Texas Instruments. All rights reserved.
DBGM Bit of ST2_55
DBGM: Debug mode bit gives the ability to
block debug events during time-critical
portions of a program:
If DBGM=0 Debug is enable
If DBGM=1 Debug is disable, emulator
cannot access memory or registers.
Software breakpoints still cause the CPU to
halt, but hardware breakpoints or halt
requests are ignored.
Before interrupt service routine CPU sets the
DBGM bit to disable.
Return-from-interrupt instruction restores
the DBGM bit from the data stack.
ESIEE, Slide 118 Copyright © 2003 Texas Instruments. All rights reserved.
EALLOW Bit of ST2_55
/RDM Bit of ST2_55
ESIEE, Slide 120 Copyright © 2003 Texas Instruments. All rights reserved.
CACLR Bit of ST3_55
CACLR, Cache clear bit, enables to check
when the process for clearing the program
cache is complete:
CACLR=0 Complete. The cache hardware clears
the CACLR bit when the process is complete.
CACLR=1 Not complete. All cache blocks are
invalid. The number of cycles needed to clear the
cache depends on the memory architecture.
If cache is cleared, the content of the prefetch
queue in the instruction buffer unit is
automatically flushed.
CACLR bit can be changed (pipeline protect):
BCLR CACLR ; Clear CACLR
BSET CACLR ; Set CACLR
ESIEE, Slide 121 Copyright © 2003 Texas Instruments. All rights reserved.
CAEN Bit of ST3_55
CAEN is the Cache enable bit that
enables or disables the program cache:
CAEN =0 then cache is disabled.
All program requests are handled either
by the internal memory or the external
memory, depending on the address
decoded.
CAEN=1 Cache is enabled. Program
code is fetched from the cache, from the
internal memory, or from the external
memory, depending on the address
decoded.
ESIEE, Slide 122 Copyright © 2003 Texas Instruments. All rights reserved.
CAFRZ Bit of ST3_55
ESIEE, Slide 123 Copyright © 2003 Texas Instruments. All rights reserved.
CBERR Bit of ST3_55
CBERR is the « CPU bus error flag »
The CBERR bit is set when an internal bus error is
detected. An error causes the CPU to set the bus error
interrupt flag (BERRINTF) in IFR1.
The interrupt service routine for the bus error
interrupt (BERRINT) must clear the CBERR bit
before it returns control to the interrupted program
using: BCLR CBERR ; Clear CBERR
If CBERR =0 The flag has been cleared by program
or by a reset.
CBERR=1 An internal bus error has been detected.
ESIEE, Slide 124 Copyright © 2003 Texas Instruments. All rights reserved.
CLKOFF Bit of ST3_55
ESIEE, Slide 125 Copyright © 2003 Texas Instruments. All rights reserved.
HINT Bit of ST3_55
ESIEE, Slide 126 Copyright © 2003 Texas Instruments. All rights reserved.
MPNMC Bit of ST3_55
ESIEE, Slide 127 Copyright © 2003 Texas Instruments. All rights reserved.
SATA Bit of ST3_55
SATA is the Saturation mode bit for the A unit
SATA bit determines whether the CPU
saturates overflow results of the A-unit
arithmetic logic unit (A-unit ALU):
If SATA=0 No saturation is performed.
If SATA=1 On. If result is in overflow,
result is saturated to 7FFFh or 8000h (for
positive or negative overflow respectively).
Can be cleared and set by:
BCLR SATA ; Clear SATA
BSET SATA ; Set SATA
ESIEE, Slide 128 Copyright © 2003 Texas Instruments. All rights reserved.
SMUL Bit of ST3_55
SMUL is the Saturation-on-multiplication
mode bit:
If SMUL =0 Off
If SMUL =1 On.
SMUL=1 forces the product of the two
negative numbers to be a positive number.
For multiply-and-accumulate/subtract
instructions, the saturation is performed after
the multiplication and before the
addition/subtraction.
Clear and set SMUL with :
BCLR SMUL ; Clear SMUL
BSET SMUL ; Set SMUL
ESIEE, Slide 129 Copyright © 2003 Texas Instruments. All rights reserved.
SST Bit of ST3_55
SST is the Saturate-on-store mode bit used
in the C54-compatible mode (C54CM=1)
If C54CM=0 SST is ignored by the C55x.
If C54CM = 1: SST turns the saturation-
on-store mode on or off.
SST= 0 no saturation
SST=1 CPU saturates a shifted or
unshifted accumulator value before
storing it. The saturation depends on the
value of the sign-extension mode bit
(SXMD)
ESIEE, Slide 130 Copyright © 2003 Texas Instruments. All rights reserved.