summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorJiri Gaisler <jiri@gaisler.se>2019-05-22 21:56:59 +0200
committerJiri Gaisler <jiri@gaisler.se>2019-05-27 10:35:06 +0200
commit6a742ad589f8a5967cb878e4065f70d93b90fb58 (patch)
tree7a71ab6385f0f177594ebe0be30f2c65f7e11497 /exec.c
parent92d08c9905121d4022c3be45d9f4579429d5620a (diff)
Add emulated L1 cache to SMP configurations
* Also improve timing accuracy for certain instructions
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 67a16f5..433ab0d 100644
--- a/exec.c
+++ b/exec.c
@@ -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++;
+ }
+}
+