Page 1 of 1

What is the purpose of cache memory in a DSP application

Posted: Sat Apr 03, 2010 6:06 pm
by Neo
  1. What is Cache memory
  2. Cache memory in Ti DSPs
  3. Why Cache in DSPs, not in Microcontrollers

What is Cache memory
Cache memory is an extremely fast memory that is built into the CPU. The CPU uses cache memory to store instructions and data that are repeatedly required to run programs which helps to improve overall system performance. The advantage of cache memory is that the CPU does not have to use the memory bus(EMIF) for program/data transfer for repeated memory fetches. Whenever data needs to be passed through the memory bus, the data transfer speed slows to the External Memory Interface (EMIF) capability. The CPU can process data much faster by avoiding the bottleneck created by the memory bus.

As it happens, once most programs are open and running, they use very few resources. When these resources are kept in cache, programs can operate more quickly and efficiently. All else being equal, cache is so effective in system performance that a computer running a fast CPU with little cache can have lower benchmarks than a system running a somewhat slower CPU with more cache. Cache built into the CPU itself is referred to as Level 1 (L1) cache. Cache that resides on a separate chip next to the CPU is called Level 2 (L2) cache. Some CPUs have both L1 and L2 cache built-in and designate the separate cache chip as Level 3 (L3) cache.

Cache memory in Ti DSPs
Usually on DSPs from Texas Instruments have both L1 and L2 built-in to CPU. L1 is divided to L1P (Program) and L1D (Data). L1 and L2 are collectively referred as Internal System Memory (ISRAM) due to the reason that you can disable the cache functionality of them and use as Internal memory. This memory is extremely fast than accessing DDR/SDRAM through EMIF bus. IRAM is usually small as few KBs. The maximum I have seen so far is 256 KB.

L1 is the fastest. So it is better to use L1P and L1D separately as this will boost up the performance of the DSP application. L2 is the next fastest (less faster than L1 and a lot more faster than DDR through EMIF). Part of L2 is usually assigned as a cache (32 KB or 64 KB) and the remaining area is used as ISRAM. This area is used to store most critical parts of your code that require fast execution. For example, codes such as FIR, IIR, DCT, DFT are usually stored in ISRAM for fast execution.

Now you are clear on what is cache and how it is usually used in general.

Why Cache in DSPs, not in Microcontrollers
DSPs are used to execute complex signal processing algorithms mostly in real-time (for example Discrete Fourier Transformation (DFT) is used in encoding algorithms). So it is required to boost up some critical parts of code and data rather than storing everything in a single RAM which is not possible for most of the DSP applications.

Microcontrollers are used to operate simple algorithms usually based on controlling I/O pins. Such programs are tiny to load to a small internal memory (or even execute straight from Flash) and the data required is limited 1 or two arrays.
So the requirement of a cache is not significant in a microcontroller.

Re: What is the purpose of cache memory in a DSP application

Posted: Mon Apr 05, 2010 12:06 pm
by SukhdeepMankoo
Few doubts arise on reading data sheet of TMS320C6713.
I have read that

1) 4kbyte L1P Program Cache(Memory Mapped)
what does memory mapped indicate here?
2) 4K byte L1D Data cache(2 way)
what does 2 way indicate?
3) L2 unified Cache/Mapped Ram.
what is unified and Mapped RAM indicates?

Thanks & Regards

Cache Mapping and Associativity

Posted: Mon Apr 05, 2010 8:33 pm
by Max
Your questions are all related to theories in Cache Mapping and Associativity.

See Cache Mapping and Associativity for a detailed explanation.