mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Update CacheSim scripts with new wsim and directory structure. Give simulator choice and switch default to verilator.
This commit is contained in:
parent
fa772c652a
commit
9a70480ef6
2
.gitignore
vendored
2
.gitignore
vendored
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
## Created: 11 April 2023
|
## Created: 11 April 2023
|
||||||
## Modified: 12 April 2023
|
## Modified: 12 April 2023
|
||||||
##
|
##
|
||||||
## Purpose: Run the cache simulator on each rv64gc test suite in turn.
|
## Purpose: Run the cache simulator on each rv64gc test suite in turn.
|
||||||
##
|
##
|
||||||
## A component of the CORE-V-WALLY configurable RISC-V project.
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
## https://github.com/openhwgroup/cvw
|
## https://github.com/openhwgroup/cvw
|
||||||
@ -16,24 +16,23 @@
|
|||||||
##
|
##
|
||||||
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
##
|
##
|
||||||
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
## may obtain a copy of the License at
|
## may obtain a copy of the License at
|
||||||
##
|
##
|
||||||
## https:##solderpad.org/licenses/SHL-2.1/
|
## https:##solderpad.org/licenses/SHL-2.1/
|
||||||
##
|
##
|
||||||
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
## 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
|
||||||
|
|
||||||
# NOTE: make sure testbench.sv has the ICache and DCache loggers enabled!
|
# NOTE: make sure testbench.sv has the ICache and DCache loggers enabled!
|
||||||
# This does not check the test output for correctness, run regression for that.
|
# This does not check the test output for correctness, run regression for that.
|
||||||
# Add -p or --perf to report the hit/miss ratio.
|
# Add -p or --perf to report the hit/miss ratio.
|
||||||
# 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.
|
||||||
|
|
||||||
@ -48,36 +47,38 @@ class bcolors:
|
|||||||
BOLD = '\033[1m'
|
BOLD = '\033[1m'
|
||||||
UNDERLINE = '\033[4m'
|
UNDERLINE = '\033[4m'
|
||||||
|
|
||||||
# tests64gc = ["coverage64gc", "arch64f", "arch64d", "arch64i", "arch64priv", "arch64c", "arch64m",
|
# tests64gc = ["coverage64gc", "arch64f", "arch64d", "arch64i", "arch64priv", "arch64c", "arch64m",
|
||||||
tests64gc = ["coverage64gc", "arch64i", "arch64priv", "arch64c", "arch64m",
|
tests64gc = ["coverage64gc", "arch64i", "arch64priv", "arch64c", "arch64m",
|
||||||
"arch64zi", "wally64a", "wally64periph", "wally64priv",
|
"arch64zi", "wally64a", "wally64periph", "wally64priv",
|
||||||
"arch64zba", "arch64zbb", "arch64zbc", "arch64zbs",
|
"arch64zba", "arch64zbb", "arch64zbc", "arch64zbs",
|
||||||
"imperas64f", "imperas64d", "imperas64c", "imperas64i"]
|
"imperas64f", "imperas64d", "imperas64c", "imperas64i"]
|
||||||
# arch64i is the most interesting case. Uncomment line below to run just that case
|
# arch64i is the most interesting case. Uncomment line below to run just that case
|
||||||
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:
|
||||||
cachecmd += " -p"
|
cachecmd += " -p"
|
||||||
if args.dist:
|
if args.dist:
|
||||||
cachecmd += " -d"
|
cachecmd += " -d"
|
||||||
|
|
||||||
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user