Update CacheSim scripts with new wsim and directory structure. Give simulator choice and switch default to verilator.

This commit is contained in:
Jordan Carlin 2024-08-09 21:50:18 -07:00
parent fa772c652a
commit 9a70480ef6
No known key found for this signature in database
3 changed files with 19 additions and 19 deletions

2
.gitignore vendored
View File

@ -123,7 +123,7 @@ sim/test1.rep
sim/questa/vsim.log sim/questa/vsim.log
tests/coverage/*.elf tests/coverage/*.elf
*.elf.memfile *.elf.memfile
sim/*Cache.log sim/*/*Cache.log
sim/branch sim/branch
tests/fp/combined_IF_vectors/IF_vectors/*.tv tests/fp/combined_IF_vectors/IF_vectors/*.tv
/sim/branch-march14.tar.gz /sim/branch-march14.tar.gz

View File

@ -41,7 +41,6 @@
# Add -d or --dist to report the distribution of loads, stores, and atomic ops. # Add -d or --dist to report the distribution of loads, stores, and atomic ops.
# These distributions may not add up to 100; this is because of flushes or invalidations. # These distributions may not add up to 100; this is because of flushes or invalidations.
import sys
import math import math
import argparse import argparse
import os import os

View File

@ -27,7 +27,6 @@
## either express or implied. See the License for the specific language governing permissions ## either express or implied. See the License for the specific language governing permissions
## and limitations under the License. ## and limitations under the License.
################################################################################################ ################################################################################################
import sys
import os import os
import argparse import argparse
@ -57,16 +56,17 @@ tests64gc = ["coverage64gc", "arch64i", "arch64priv", "arch64c", "arch64m",
tests64gc = ["arch64i"] tests64gc = ["arch64i"]
cachetypes = ["ICache", "DCache"] cachetypes = ["ICache", "DCache"]
simdir = os.path.expanduser("~/cvw/sim") simdir = os.path.expandvars("$WALLY/sim")
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Runs the cache simulator on all rv64gc test suites") parser = argparse.ArgumentParser(description="Runs the cache simulator on all rv64gc test suites")
parser.add_argument('-p', "--perf", action='store_true', help="Report hit/miss ratio") parser.add_argument('-p', "--perf", action='store_true', help="Report hit/miss ratio")
parser.add_argument('-d', "--dist", action='store_true', help="Report distribution of operations") parser.add_argument('-d', "--dist", action='store_true', help="Report distribution of operations")
parser.add_argument('-s', "--sim", help="Simulator", choices=["questa", "verilator", "vcs"], default="verilator")
args = parser.parse_args() args = parser.parse_args()
testcmd = "vsim -do \"do wally-batch.do rv64gc {}\" -c > /dev/null" testcmd = "wsim --sim " + args.sim + " rv64gc {} > /dev/null"
cachecmd = "CacheSim.py 64 4 56 44 -f {}" cachecmd = "CacheSim.py 64 4 56 44 -f {}"
if args.perf: if args.perf:
@ -76,8 +76,9 @@ if __name__ == '__main__':
for test in tests64gc: for test in tests64gc:
print(f"{bcolors.HEADER}Commencing test", test+f":{bcolors.ENDC}") print(f"{bcolors.HEADER}Commencing test", test+f":{bcolors.ENDC}")
print(testcmd.format(test))
os.system(testcmd.format(test)) os.system(testcmd.format(test))
for cache in cachetypes: for cache in cachetypes:
print(f"{bcolors.OKCYAN}Running the", cache, f"simulator.{bcolors.ENDC}") print(f"{bcolors.OKCYAN}Running the", cache, f"simulator.{bcolors.ENDC}")
os.system(cachecmd.format(cache+".log")) os.system(cachecmd.format(args.sim+"/"+cache+".log"))
print() print()