diff options
author | Jiri Gaisler <jiri@gaisler.se> | 2019-05-22 21:56:59 +0200 |
---|---|---|
committer | Jiri Gaisler <jiri@gaisler.se> | 2019-05-27 10:35:06 +0200 |
commit | 6a742ad589f8a5967cb878e4065f70d93b90fb58 (patch) | |
tree | 7a71ab6385f0f177594ebe0be30f2c65f7e11497 /exec.c | |
parent | 92d08c9905121d4022c3be45d9f4579429d5620a (diff) |
Add emulated L1 cache to SMP configurations
* Also improve timing accuracy for certain instructions
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -175,3 +175,29 @@ init_regs(sregs) sregs[i].bphit = 0; } } + +void +l1data_snoop(uint32 address, uint32 cpu) +{ + int i; + for (i=0; i<ncpu; i++) { + if (sregs[i].l1dtags[(address >> L1DLINEBITS) & L1DMASK] == (address >> L1DLINEBITS)) { + if (cpu != i) { + sregs[i].l1dtags[(address >> L1DLINEBITS) & L1DMASK] = 0; +// printf("l1 snoop hit : 0x%08X, %d %d\n", address, cpu, i); + } + } + } +} + +void +l1data_update(uint32 address, uint32 cpu) +{ + if (sregs[cpu].l1dtags[address >> L1DLINEBITS & L1DMASK] != (address >> L1DLINEBITS)) + { + sregs[cpu].l1dtags[(address >> L1DLINEBITS) & L1DMASK] = (address >> L1DLINEBITS); + sregs[cpu].hold += 17; + sregs[cpu].l1dmiss++; + } +} + |