From b6ecd15eff7327e45d6cc3475abecefc42f966e9 Mon Sep 17 00:00:00 2001 From: Limnanthes Serafini Date: Tue, 11 Apr 2023 19:28:28 -0700 Subject: [PATCH] Cleanup + success message added to CacheSim --- bin/CacheSim.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/CacheSim.py b/bin/CacheSim.py index 5669b35c1..d7ff1517f 100755 --- a/bin/CacheSim.py +++ b/bin/CacheSim.py @@ -200,8 +200,9 @@ if __name__ == "__main__": args = parser.parse_args() cache = Cache(args.numlines, args.numways, args.addrlen, args.taglen) - #numtests = -1 extfile = os.path.expanduser(args.file) + nofails = True + with open(extfile, "r") as f: for ln in f: ln = ln.strip() @@ -212,7 +213,6 @@ if __name__ == "__main__": # trying TRAIN clears instead cache.invalidate() # a new test is starting, so 'empty' the cache cache.clear_pLRU() - #numtests +=1 if args.verbose: print("New Test") @@ -233,9 +233,7 @@ if __name__ == "__main__": tag, setnum, offset = cache.splitaddr(addr) print(hex(addr), hex(tag), hex(setnum), hex(offset), lninfo[2], result) if not result == lninfo[2]: - print("Result mismatch at address", lninfo[0], ". Wally:", lninfo[2],", Sim:", result) #, "in test", numtests) - - - - - + print("Result mismatch at address", lninfo[0]+ ". Wally:", lninfo[2]+", Sim:", result) + nofails = False + if nofails: + print("SUCCESS! There were no mismatches between Wally and the sim.") \ No newline at end of file