loadstore testcase: read at random addresses
authorTobias Platen <tplaten@posteo.de>
Sat, 27 Nov 2021 12:54:22 +0000 (13:54 +0100)
committerTobias Platen <tplaten@posteo.de>
Sat, 27 Nov 2021 12:54:22 +0000 (13:54 +0100)
src/soc/experiment/test/test_loadstore1.py

index 9b121d45ba3b2ba926d0bdf6a587c539cc9f6036..0a92620a113323760769196b40aaa4b91319aadb 100644 (file)
@@ -17,6 +17,7 @@ from soc.experiment.mmu import MMU
 from soc.experiment.test import pagetables
 
 from nmigen.compat.sim import run_simulation
+from random import random
 
 stop = False
 
@@ -190,6 +191,16 @@ def _test_loadstore1(dut, mem):
         print("ld_data",ld_data,exc)
         print("=== no error done ===")
 
+        # test read at random addresses
+        for i in range(0,40):
+            n = int(random()*0x100000)
+            addr = 0x10000 + n*16
+            print("== random addr ==")
+            print("ld[RANDOM]",addr)
+            ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1)
+            print("ld_data[RANDOM]",ld_data,exc,addr)
+            assert(exc==None)
+
     stop = True
 
 def test_loadstore1():