From f937e31ee967b47b0bbd92680917911d9e50fb90 Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Tue, 1 Oct 2024 12:08:39 -0700 Subject: [PATCH] Remove bpred-sim.py --- sim/bpred-sim.py | 194 ----------------------------------------------- 1 file changed, 194 deletions(-) delete mode 100755 sim/bpred-sim.py diff --git a/sim/bpred-sim.py b/sim/bpred-sim.py deleted file mode 100755 index 45c0965a1..000000000 --- a/sim/bpred-sim.py +++ /dev/null @@ -1,194 +0,0 @@ -#!/usr/bin/env python3 -################################## -# -# regression-wally -# David_Harris@Hmc.edu 25 January 2021 -# Modified by Jarred Allen -# -# Run a regression with multiple configurations in parallel and exit with -# non-zero status code if an error happened, as well as printing human-readable -# output. -# -################################## -import sys,os,shutil -import argparse - -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - -from collections import namedtuple -regressionDir = os.path.dirname(os.path.abspath(__file__)) -os.chdir(regressionDir) - -TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr']) -# name: the name of this test configuration (used in printing human-readable -# output and picking logfile names) -# cmd: the command to run to test (should include the logfile as '{}', and -# the command needs to write to that file) -# grepstr: the string to grep through the log file for. The test succeeds iff -# grep finds that string in the logfile (is used by grep, so it may -# be any pattern grep accepts, see `man 1 grep` for more info). - -# edit this list to add more test cases -configs = [ - TestCase( - name="lints", - variant="all", - cmd="./lint-wally | tee {}", - grepstr="All lints run with no errors or warnings" - ) -] - - -import os -from multiprocessing import Pool, TimeoutError - -def search_log_for_text(text, logfile): - """Search through the given log file for text, returning True if it is found or False if it is not""" - grepcmd = "grep -e '%s' '%s' > /dev/null" % (text, logfile) - return os.system(grepcmd) == 0 - -def run_test_case(config): - """Run the given test case, and return 0 if the test suceeds and 1 if it fails""" - logname = "logs/"+config.variant+"_"+config.name+".log" - cmd = config.cmd.format(logname) - print(cmd) - os.chdir(regressionDir) - os.system(cmd) - if search_log_for_text(config.grepstr, logname): - print(f"{bcolors.OKGREEN}%s_%s: Success{bcolors.ENDC}" % (config.variant, config.name)) - return 0 - else: - print(f"{bcolors.FAIL}%s_%s: Failures detected in output{bcolors.ENDC}" % (config.variant, config.name)) - print(" Check %s" % logname) - return 1 - -def main(): - """Run the tests and count the failures""" - TIMEOUT_DUR = 10800 # 3 hours - - global configs - try: - os.chdir(regressionDir) - os.mkdir("logs") - #print(os.getcwd()) - #print(regressionDir) - except: - pass - try: - shutil.rmtree("wkdir") - except: - pass - finally: - os.mkdir("wkdir") - - parser = argparse.ArgumentParser(description='Runs embench with sweeps of branch predictor sizes and types.') - mode = parser.add_mutually_exclusive_group() - mode.add_argument('-r', '--ras', action='store_const', help='Sweep size of return address stack (RAS).', default=False, const=True) - mode.add_argument('-d', '--direction', action='store_const', help='Sweep size of direction prediction (2-bit, Gshare, local, etc).', default=False, const=True) - mode.add_argument('-t', '--target', action='store_const', help='Sweep size of branch target buffer (BTB).', default=False, const=True) - mode.add_argument('-c', '--iclass', action='store_const', help='Sweep size of classification (BTB) Same as -t.', default=False, const=True) - - args = parser.parse_args() - - if(args.direction): - # for direction predictor size sweep - bpdSize = [6, 8, 10, 12, 14, 16] - #bpdType = ['twobit', 'gshare', 'global', 'gshare_basic', 'global_basic', 'local_basic'] - bpdType = ['twobit', 'gshare'] - for CurrBPType in bpdType: - for CurrBPSize in bpdSize: - name = CurrBPType+str(CurrBPSize) - configOptions = "+define+INSTR_CLASS_PRED=0 +define+BPRED_OVERRIDE +define+BPRED_TYPE=" + str(bpdType.index(CurrBPType)) + "+define+BPRED_SIZE=" + str(CurrBPSize) - tc = TestCase( - name=name, - variant="rv32gc", - cmd="vsim > {} -c < {} -c < {} -c < {} -c < {} -c <