<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Instruction cache (I-Cache) using and user guide.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68934/instruction-cache-i-cache-using-and-user-guide</link><description>Hi. 
 I do not find the description about I-Cache principles and work algorithm. 
 I read the part of the documentation &amp;quot;NVMC - Non-volatile memory controller&amp;quot;. I think, I already activated it with instruction &amp;quot;NRF_NVMC-&amp;gt;ICACHECNF = 1&amp;quot;. I see the performance</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Dec 2020 12:11:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68934/instruction-cache-i-cache-using-and-user-guide" /><item><title>RE: Instruction cache (I-Cache) using and user guide.</title><link>https://devzone.nordicsemi.com/thread/282649?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2020 12:11:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff4b08bc-322f-4168-ba97-5f1c590fa692</guid><dc:creator>VadymS</dc:creator><description>&lt;p&gt;Thanks! Clear enough!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Instruction cache (I-Cache) using and user guide.</title><link>https://devzone.nordicsemi.com/thread/282532?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2020 17:52:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:027172f4-d253-41bb-92ca-6af92d7b55a3</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Not an official answer, but maybe some useful tips. The cache has a private SRAM which is inaccessible by the user, likely 2k bytes. The NVMC must be ready before enabling the cache:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; // Enable cache and also enable hit/miss tracking
 while(NRF_NVMC-&amp;gt;READY == 0) ;
 NRF_NVMC-&amp;gt;ICACHECNF = 0x101;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here I have enabled the hit/miss tracking counters as well as the cache, which are 2 non-resettable saturating counters which increment on every cache hit and miss. As the code executes it fills the cache (cache miss count++) until parts of the code in the cache execute from the private SRAM instead of FLASH (cache hit count++). If the code loop is bigger than the cache, then the cache starts reloading and&amp;nbsp;&lt;span&gt;(cache miss count++). If the code is small enough to fit in the private SRAM then&amp;nbsp;(cache hit count++), ie optimum performance. However, if some interrupt then occurs then that interrupt will&amp;nbsp;load the cache with new FLASH code as the interrupt executes&amp;nbsp; (cache miss count++). If the total size of active interrupts and code loop fits in the cache, then back to maximum performance and no cache misses, but that is unlikely unless most interrupts are disabled for the duration of executing the test, which must be small and not call large functions. Executing Coremark tests via function calls might exceed the size of the cache, so maybe write some other tight loop and measure performance that way&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Once the cache hit/miss registers reach max values there is no more useful information&amp;nbsp;available without a reset. To display use something like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; NRF_LOG_INFO(&amp;quot;Cache Enabled 0x%08X 0x%08X 0x%08X 0x%08X&amp;quot;, NRF_NVMC-&amp;gt;ICACHECNF, NRF_NVMC-&amp;gt;IHIT, NRF_NVMC-&amp;gt;IMISS, NRF_NVMC-&amp;gt;CONFIG);
 NRF_LOG_FLUSH();
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Cache SRAM consumes additional power, so when cache is enabled the power consumption goes up; however, FLASH code execution uses 2 wait states whereas SRAM code execution does not use wait states, so the loop code executes faster which can and usually does lead to overall lower power consumption as well as faster execution.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>