Hi,
what is the role of Cache Memory in DSP Processor, like L1 and L2 cache. why do we need Cache in DSP as Microcontroller do not not any kind of cache memory, where is this difference lie.
Thanks & Regards
Sukhdeep Singh
Cache memory in DSP
-
- Lieutenant
- Posts: 92
- Joined: Tue Oct 27, 2009 7:50 pm
Re: Cache memory in DSP
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.
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. So the answer to your question is this. 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.
I hope you get the idea!
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.
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. So the answer to your question is this. 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.
I hope you get the idea!
-
- Lieutenant
- Posts: 92
- Joined: Tue Oct 27, 2009 7:50 pm
Re: Cache memory in DSP
Thanks Neo.
-
- Lieutenant
- Posts: 92
- Joined: Tue Oct 27, 2009 7:50 pm
Re: Cache memory in DSP
Thanks a lot Neo,
Your way of telling is extremely good.I have no doubt about this issue.
Thanks again.
Your way of telling is extremely good.I have no doubt about this issue.
Thanks again.
-
- Sergeant
- Posts: 14
- Joined: Fri Jan 25, 2019 11:31 am
- Location: Denmark
- Contact:
Re: Cache memory in DSP
I reported this for Cache Selective already, but noted that its incorrect. Clearing the 4GB of cache in the Cache Selective freed up >13GB of memory in my scene.