wb_get: write outputs to seperate logfile too
authorTobias Platen <tplaten@posteo.de>
Wed, 24 Feb 2021 18:43:23 +0000 (19:43 +0100)
committerTobias Platen <tplaten@posteo.de>
Wed, 24 Feb 2021 18:43:23 +0000 (19:43 +0100)
src/soc/experiment/test/test_mmu_dcache.py

index d7b65cec5cedd25697cb75ec22919cf7c185cde9..67ce6258bf7c5879ff86f8daabc9c32eb62964d5 100644 (file)
@@ -57,14 +57,17 @@ def wb_get(c, mem, name):
     """simulator process for getting memory load requests
     """
 
-    global stop
-
+    logfile = open("/tmp/wb_get.log","w")
 
-    mem = mem
+    def log(msg):
+        logfile.write(msg+"\n")
+        print(msg)
 
+    global stop
     while not stop:
         while True: # wait for dc_valid
             if stop:
+                log("stop")
                 return
             cyc = yield (c.wb_out.cyc)
             stb = yield (c.wb_out.stb)
@@ -73,14 +76,14 @@ def wb_get(c, mem, name):
             yield
         addr = (yield c.wb_out.adr) << 3
         if addr not in mem:
-            print ("    %s LOOKUP FAIL %x" % (name, addr))
+            log("%s LOOKUP FAIL %x" % (name, addr))
             stop = True
             return
 
         yield
         data = mem[addr]
         yield c.wb_in.dat.eq(data)
-        print ("    %s get %x data %x" % (name, addr, data))
+        log("%s get %x data %x" % (name, addr, data))
         yield c.wb_in.ack.eq(1)
         yield
         yield c.wb_in.ack.eq(0)