Texas Instruments TMS320 DSP 사용자 설명서

다운로드
페이지 88
www.ti.com
2.3.3 Algorithm versus Application
Persistent
Scratch
Shared
Private
Shadow
Data Memory
Guideline 1
Algorithms should minimize their persistent data memory requirements in favor of scratch memory.
In addition to the types of memory described above, there are often several memory spaces provided by a
DSP to algorithms.
Dual-access memory (DARAM) is on-chip memory that allows two simultaneous accesses in a single
instruction cycle.
Single-access memory (SARAM) is on-chip memory that allows only a single access per instruction
cycle.
External memory is memory that is external to the DSP and may require more than zero wait states
per access.
These memory spaces are often treated very differently by algorithm implementations; in order to optimize
performance, frequently accessed data is placed in on-chip memory, for example. The scratch versus
persistent attribute of a block of memory is independent of the memory space. Thus, there are six distinct
memory classes; scratch and persistent for each of the three memory spaces described above.
Other than a memory block's size, alignment, and memory space, three independent questions must be
answered before a client can properly manage a block of an algorithm's data memory.
Is the block of memory treated as scratch or persistent by the algorithm?
Is the block of memory shared by more than one algorithm?
Do the algorithms that share the block preempt one another?
The first question is determined by the implementation of the algorithm; the algorithm must be written with
assumptions about the contents of certain memory buffers. We've argued that there is significant benefit to
distinguish between scratch memory and persistent memory, but it is up to the algorithm implementation
to trade the benefits of increasing scratch, and decreasing persistent memory against the potential
performance overhead incurred by re-computing intermediate results.
The second two questions regarding sharing and preemption, can only be answered by the client of an
eXpressDSP-compliant algorithm. The client decides whether preemption is required for the system and
the client allocates all memory. Thus, only the client knows whether memory is shared among algorithms.
Some frameworks, for example, never share any allocated memory among algorithms whereas others
always share scratch memory.
There is a special type of persistent memory managed by clients of algorithms that is worth distinguishing:
shadow memory is unshared persistent memory that is used to shadow or save the contents of shared
registers and memory in a system. Shadow memory is not used by algorithms; it is used by their clients to
save the memory regions shared by various algorithms.
illustrates the relationship between the various types of memory.
Figure 2-2. Data Memory Types
General Programming Guidelines
22
SPRU352G – June 2005 – Revised February 2007