OpenCores
Issue List
or1ksim030 ic not enabled #59
Closed alfredo opened this issue almost 15 years ago
alfredo commented almost 15 years ago

Hi Everybody,

I've been working with or1ksim0.3.0 and found that if I set enabled=1 in sim.cfg "section ic", the ic is still not enabled. I took a look in the sources and found that in icache-model.c::ic_enabled() that only "cpu_state.sprsSPR_UPR |= SPR_UPR_ICP" was being set. In ic_simulate_fetch() however, cpu_state.sprsSPR_SR & SPR_SR_ICE is also being checked so I added a line to set ICE in ic_enabled().

cpu_state.sprsSPR_SR |= SPR_SR_ICE;

The simulator was now reporting IC read: 100% on all fetches. Looking further I found that in ic_end_sec() the line

memset (ic->tags, 0, ic->nsets ic->nways sizeof (oraddr_t));

however "0" is a valid tag which explains the 100% hit rate. I changed the memset value to "-1" so as to provide an initialized value of invalid for the cache. The results now appear to show initial access to a fetchaddr to fail, and subsequent access to addresses in the same block to succeed, and a reasonable hit rate.

John Alfredo

jeremybennett commented almost 15 years ago
<p> Hi John, </p> <p> Thanks for logging this and finding the solution. I'll try to incorporate it in the next release of Or1ksim. </p> <p> Jeremy </p> <p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>
jeremybennett was assigned almost 15 years ago
jeremybennett commented almost 14 years ago
<p> Hi John </p> <p> I've investigated further, and this fix is only partially correct. </p> <p> You are right that the tags table should be initialized invalidated (-1). In practice it matters little, since any cache management software would invalidate the tags before turning on the cache. </p> <p> The other part of your suggestion is wrong. ic_enabled () is triggered by the "enabled" field in the configuration file, which indicates the presence of an instruction cache. It is up to the software controlling the cache to enable it at the right time. </p> <p> I've checked against the test suite (now we have that working, and this change would break a number of the tests, which all work on the assumption that on reset a cache if present is not enabled in the supervision register. </p> <p> I'm marking this bug closed. If you think this interpretation by Or1ksim is wrong, perhaps you'd start a discussion on the OpenRISC forum. </p> <p> Thanks for reporting the bug </p> <p> Jeremy </p> <p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>
jeremybennett commented almost 14 years ago
<p> I should have added that the use of -1 to invalidate the tags will be committed to SVN very shortly. </p> <p> Jeremy </p>
jeremybennett closed this almost 14 years ago

Assignee
jeremybennett
Labels
Request