test_loadstore1.py: begin code deduplication
authorTobias Platen <tplaten@posteo.de>
Fri, 10 Dec 2021 19:30:14 +0000 (20:30 +0100)
committerTobias Platen <tplaten@posteo.de>
Fri, 10 Dec 2021 19:30:14 +0000 (20:30 +0100)
src/soc/experiment/test/test_loadstore1.py

index 6c50cfc0ea1b67bd5b38a608f438918d17a27dd1..366e8e619692201ec39ceab1f3b1aee738601d1e 100644 (file)
@@ -66,6 +66,33 @@ def setup_mmu():
     return m, cmpi
 
 
+def icache_read(dut,addr,priv,virt):
+
+    yield i_in.priv_mode.eq(priv)
+    yield i_in.virt_mode.eq(virt)
+    yield i_in.req.eq(1)
+    yield i_in.nia.eq(addr)
+    yield i_in.stop_mark.eq(0)
+
+    yield i_in.req.eq(1)
+    yield i_in.nia.eq(addr)
+    yield
+    valid = yield i_out.valid
+    failed = yield i_out.fetch_failed
+    while not valid and not failed:
+        yield
+        valid = yield i_out.valid
+        failed = yield i_out.fetch_failed
+    yield i_in.req.eq(0)
+
+    nia   = yield i_out.nia
+    insn  = yield i_out.insn
+    yield
+    yield
+
+    return nia, insn, valid, failed
+
+
 test_exceptions = True
 test_dcbz = True
 test_random = True