Skip to content

Commit

Permalink
Merge pull request #586 from strichmo/strichmo/pr/master_merge_from_rel
Browse files Browse the repository at this point in the history
Merge release branches to master
  • Loading branch information
MikeOpenHWGroup authored May 7, 2021
2 parents 70db285 + 2a7fb6f commit 50824ac
Show file tree
Hide file tree
Showing 90 changed files with 5,153 additions and 649 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ cva6/tests/riscv-compliance/
cva6/tests/riscv-tests/
uvm/riscv-dv/
riviera_results/
*/vendor_lib/dpi_dasm_spike/
16 changes: 8 additions & 8 deletions .metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
{
"name": "uvmt_cv32e40p",
"image": "cv32-simulation-tools:20200720.11.0-19102020",
"cmd": "cd cv32e40p/sim/uvmt; make corev-dv CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40p SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40p/sim/uvmt; make corev-dv CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40p SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
"cmd": "cd cv32e40p/sim/uvmt; make corev-dv CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40p/sim/uvmt; make corev-dv CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
},
{
"name": "uvmt_cv32e40p_compliance_build",
"image": "cv32-simulation-tools:20200720.11.0-19102020",
"cmd": "cd cv32e40p/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40p SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40p/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40p SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
"cmd": "cd cv32e40p/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40p/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40p SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
},
{
"name": "uvmt_cv32e40x",
"image": "cv32-simulation-tools:20200720.11.0-19102020",
"cmd": "cd cv32e40x/sim/uvmt; make corev-dv CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40x SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40x/sim/uvmt; make corev-dv CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40x SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
"cmd": "cd cv32e40x/sim/uvmt; make corev-dv CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40x/sim/uvmt; make corev-dv CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results; make comp CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
},
{
"name": "uvmt_cv32e40x_compliance_build",
"image": "cv32-simulation-tools:20200720.11.0-19102020",
"cmd": "cd cv32e40x/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40x SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40x/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40x SIMULATOR=dsim USE_ISS=YES DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
"cmd": "cd cv32e40x/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results",
"wavesCmd": "cd cv32e40x/sim/uvmt; make all_compliance; make comp CV_CORE=cv32e40x SIMULATOR=dsim DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1"
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ simulator for the purposes of ensuring a pull-request can be safely made. Note
be able to be executed in any directory where previously it required the user to *cd* to ci/. Please
refer to *ci_check*'s help utility for more details on options

If required, the step and compare ISS can be disabled for this regression by setting _--iss=0_

*Examples:*
> \# Run CI sanity regression on Xcelium<br>
% ci_check -s xrun<br>
> \# Run CI sanity regression on Xcelium with the ISS disabled<br>
% ci_check -s xrun --iss=0<br>
> \# Get help of all available options<br>
% ci_check --help

Expand Down
8 changes: 7 additions & 1 deletion bin/cfgyaml2make
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ def read_file(file):

stream = open(matches[0], 'r')
logger.debug('Reading cfg specification: {}'.format(matches[0]))
cfg_spec = yaml.load(stream)
# Newer PyYAMLs must specify explicit loader (policy) or will issue warnings
# Older PyYAMLs will not support the Loader argument
# So try the new way first, then catch to the old way
try:
cfg_spec = yaml.load(stream, Loader=yaml.FullLoader)
except AttributeError:
cfg_spec = yaml.load(stream)
stream.close()

# Validation
Expand Down
23 changes: 18 additions & 5 deletions bin/ci_check
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ parser.add_argument("-c", "--check_only", help="Check previosu results (do no
parser.add_argument("-k", "--keep", help="Keep previous cloned or generated files", action="store_true")
parser.add_argument("-v", "--verilator", help="Run Verilator on the CORE testbench", action="store_true")
parser.add_argument("-u", "--no_uvm", help="DO NOT run CI regression on the UVM testbench", action="store_true")
parser.add_argument('--iss', help='Force USE_ISS flag to each test run (use 0 or 1), default: Enabled')
parser.add_argument("--repo", help="Use this repo for the RTL, not one in Makefile", type=str)
parser.add_argument("--branch", help="Use this branch for the RTL, not one in Makefile", type=str)
parser.add_argument("--hash", help="Use this hash for the RTL, not one in Makefile", type=str)
Expand Down Expand Up @@ -183,7 +184,13 @@ def load_regress_yaml(regression):
'''Load the regression yaml and return the dictionary'''
full_regression = os.path.join(topdir, '{}/regress'.format(args.core.lower()), regression + '.yaml')
fh = open(full_regression, 'r')
dict = yaml.load(fh)
# Newer PyYAMLs must specify explicit loader (policy) or will issue warnings
# Older PyYAMLs will not support the Loader argument
# So try the new way first, then catch to the old way
try:
dict = yaml.load(fh, Loader=yaml.FullLoader)
except AttributeError:
dict = yaml.load(fh)
fh.close()

return dict
Expand Down Expand Up @@ -339,10 +346,16 @@ if (uvm):
except KeyError:
num = 1

try:
iss = key['iss']
except KeyError:
iss = 1
# The iss command-line switch takes precedence,
# Otherwise use what is in the regression yaml if defined
# Otherwise set to 1
if args.iss != None:
iss = int(args.iss)
else:
try:
iss = key['iss']
except KeyError:
iss = 1

for n in range(num):
# Add directory
Expand Down
46 changes: 21 additions & 25 deletions bin/cv_regress
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,6 @@ def check_valid_test(project, name):
logger.fatal('Test name: {} is not valid'.format(name))
os.sys.exit(2)

def is_test_indexed(project, name):
'''Determine if a test requires an index or not. Required for metrics test directory finding'''
test_dirs = (os.path.join(get_project_path(project), 'tests/programs/corev-dv'),
os.path.join(get_project_path(project), 'tests/programs/custom'),
)

for t in test_dirs:
test_yaml = os.path.join(t, name, 'test.yaml')
if os.path.exists(test_yaml):
test_spec = yaml.load(open(test_yaml))
if '<RUN_INDEX>' in test_spec['name']:
return True
else:
return False

logger.fatal('Fell through is_test_indexed for project: {}, name {}'.format(project, name))
os.sys.exit(2)

def get_filter_dir():
'''Fetch Vmanager filter path using project'''
return os.path.abspath(os.path.join(os.path.dirname(__file__), 'vmgr'))
Expand All @@ -104,8 +86,14 @@ def read_file(args, file):
'''Read a YAML definition filelist'''
full_regress_file = os.path.join(get_regress_path(args.project), file)
stream = open(full_regress_file, 'r')
logger.info('Reading regression: {}'.format(full_regress_file))
testlist = yaml.load(stream)
logger.info('Reading regression: {}'.format(full_regress_file))
# Newer PyYAMLs must specify explicit loader (policy) or will issue warnings
# Older PyYAMLs will not support the Loader argument
# So try the new way first, then catch to the old way
try:
testlist = yaml.load(stream, Loader=yaml.FullLoader)
except AttributeError:
testlist = yaml.load(stream)
stream.close()
pp = pprint.PrettyPrinter()
logger.debug('Read YAML:')
Expand Down Expand Up @@ -152,16 +140,17 @@ def read_file(args, file):
test.set_cov()
if args.make:
test.sub_make(args.make)
if args.iss != None:
test.iss = args.iss

# Determine if a test is valid, skip for compliance tests
# Since it is not possible to determine apriori if a compliance test is valid
if not 'compliance' in test.cmd:
check_valid_test(args.project, test.name)

# Determine if a test is indexed for setting test iterations
test.indexed = is_test_indexed(args.project, test.name)
if test.indexed and test.num > 1 and args.num:
test.num = int(args.num)
# Determine if a test is indexed for setting test iterations
if args.num:
test.num = int(args.num)

regression.add_test(test)

Expand All @@ -171,8 +160,12 @@ def read_file(args, file):
VALID_SIMULATORS = ('dsim', 'vsim', 'vcs', 'xrun')
DEFAULT_SIMULATOR = 'dsim'
VALID_PROJECTS = ('cv32e40p', 'cv32e40x', 'cv64')
DEFAULT_PROJECT = 'cv32e40p'
try:
DEFAULT_PROJECT = os.environ['CV_CORE']
except KeyError:
DEFAULT_PROJECT = 'cv32e40p'
DEFAULT_CFG = 'default'
DEFAULT_PARALLEL = '30'

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
Expand All @@ -185,6 +178,8 @@ parser.add_argument('-d', '--debug', help='Emit debug messages from logger', act
parser.add_argument('-s', '--simulator', help='Select simulator', choices=VALID_SIMULATORS, default=DEFAULT_SIMULATOR)
parser.add_argument('-c', '--cov', help='Enable coverage', action='store_true')
parser.add_argument('--cfg', default=DEFAULT_CFG, help='Test configuration to test')
parser.add_argument('--iss', default=None, help='Force USE_ISS flag to each test run')
parser.add_argument('--parallel', default=DEFAULT_PARALLEL, help='For VSIF only, set number of parallel jobs')
parser.add_argument('-m', '--metrics', help='Select Metrics waves output', action='store_true')
parser.add_argument('-n', '--num', help='Force number of iterations for tests with multiple iteration')
parser.add_argument('--lsf', help='If applicable for output format, set LSF args to dispatch jobs')
Expand Down Expand Up @@ -266,6 +261,7 @@ if args.vsif:
out_fh.write(template.render(session=os.path.splitext(os.path.basename(args.outfile))[0],
results_path=get_results_path(args.project),
project=args.project,
parallel=args.parallel,
cfg=args.cfg,
regressions=regressions,
makeargs=' '.join(args.makearg) if args.makearg else '',
Expand Down
18 changes: 17 additions & 1 deletion bin/run_embench.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import sys
import subprocess
import jinja2
import glob
import re


Expand Down Expand Up @@ -216,7 +217,10 @@ def main():
#Check if benchmark run succeeded
if not run_passed(res.stdout, args.type):
logging.fatal(f"EMBench benchmark run failed")

log_file = get_log_file(args.core, paths, args.type)
if log_file:
logging.info('For more debug check EMBench log: {}'.format(log_file))
sys.exit(1)

if check_result(res.stdout, args.target, args.type) and args.target != 0:
print(f"Benchmark run met target")
Expand Down Expand Up @@ -324,6 +328,7 @@ def build_paths(core):
paths['libcfg'] = paths['core'] + '/tests/embench/config/corev32'
paths['libpy'] = paths['core'] + '/tests/embench/pylib'
paths['vlib'] = paths['core'] + '/vendor_lib'
paths['emb_logs'] = paths['core'] + '/vendor_lib/embench/logs'
paths['make'] = paths['core'] + '/sim/uvmt'
paths['embench'] = paths['vlib'] + '/embench'
paths['emcfg'] = paths['embench'] + '/config/corev32'
Expand Down Expand Up @@ -390,6 +395,17 @@ def check_python_version(major, minor):
log.error('ERROR: Requires Python {mjr}.{mnr} or later'.format(mjr=major, mnr=minor))
sys.exit(1)

def get_log_file(core, paths, log_type):
'''Find the log file from EMBench by looking for the latest touched file'''
last_mtime = 0
file = None
for f in glob.glob(os.path.join(paths['emb_logs'], '{}-*.log'.format(log_type))):
if last_mtime < os.stat(f).st_mtime:
last_mtime = os.stat(f).st_mtime
file = f

print('Latest log = {}'.format(file))
return file

#run main
if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions bin/templates/metrics.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

{% import 'regress_macros.j2' as regress_macros %}

{% set common_dsim_make_vars = "CV_CORE=" + project + " DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results" %}
{% set common_dsim_make_vars_waves = "CV_CORE=" + project + " DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1" %}
{% set common_dsim_make_vars = "CV_CORE=" + project + " COMP=0 DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results" %}
{% set common_dsim_make_vars_waves = "CV_CORE=" + project + " COMP=0 DSIM_WORK=/mux-flow/build/repo/dsim_work DSIM_RESULTS=/mux-flow/build/results WAVES=1" %}
[
{% for r in regressions %}
{% for t in r.tests.values()|sort(attribute='name') %}
Expand Down
2 changes: 1 addition & 1 deletion bin/templates/regress_macros.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{%- macro yesorno(val) -%}
{%- if val -%}YES{%- else -%}NO{%- endif -%}
{%- if val == '0' -%}NO{%- elif val == '1' -%}YES{%- elif val == True-%}YES{%- else -%}{{val}}{%- endif -%}
{%- endmacro -%}
2 changes: 1 addition & 1 deletion bin/templates/regress_sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ incr_test_counts () {

{% for b in unique_builds.values() %}
# Build:{{b.name}} {{b.description}}
{% set cmd = b.cmd + ' CV_CORE=' + project + ' CFG=' + cfg + ' SIMULATOR=' + b.simulator + ' USE_ISS=' + regress_macros.yesorno(b.iss) + ' COV=' + regress_macros.yesorno(b.cov) + makeargs %}
{% set cmd = b.cmd + ' CV_CORE=' + project + ' CFG=' + cfg + ' SIMULATOR=' + b.simulator + ' COV=' + regress_macros.yesorno(b.cov) + makeargs %}
echo "{{session}}: Running build: [cd {{b.abs_dir}} && {{cmd}}]"
pushd {{b.abs_dir}} > /dev/null
{{cmd}}
Expand Down
6 changes: 3 additions & 3 deletions bin/templates/regress_vsif.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ session {{session}} {
top_dir: {{results_path}}/vmgr_sessions;
{% if lsf %}
drm: lsf;
max_runs_in_parallel: 30;
max_runs_in_parallel: {{parallel}};
queuing_policy: round_robin;
default_dispatch_parameters: <text>{{lsf}}</text>;
{% endif %}
}

group cv32e40p {
group {{project}} {
{% if sve %}
sve_name: {{sve}};
{% endif %}
{% for b in unique_builds.values() %}
// Build:{{b.name}} {{b.description}}
pre_group_script: 'cd {{b.abs_dir}} && {{b.cmd}} CV_CORE={{project}} CFG={{cfg}} CV_SIM_PREFIX= SIMULATOR={{b.simulator}} USE_ISS={{b.iss}} COV={{regress_macros.yesorno(b.cov)}} {{makeargs}}';
pre_group_script: 'cd {{b.abs_dir}} && {{b.cmd}} CV_CORE={{project}} CFG={{cfg}} CV_SIM_PREFIX= SIMULATOR={{b.simulator}} COV={{regress_macros.yesorno(b.cov)}} {{makeargs}}';

{% endfor %}
{% for r in regressions %}
Expand Down
16 changes: 11 additions & 5 deletions bin/yaml2make
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ def read_file(test, type, run_index):

stream = open(matches[0], 'r')
logger.debug('Reading test specification: {}'.format(matches[0]))
test_spec = yaml.load(stream)
# Newer PyYAMLs must specify explicit loader (policy) or will issue warnings
# Older PyYAMLs will not support the Loader argument
# So try the new way first, then catch to the old way
try:
test_spec = yaml.load(stream, Loader=yaml.FullLoader)
except AttributeError:
test_spec = yaml.load(stream)
stream.close()
test_spec['test_dir'] = os.path.dirname(matches[0])

Expand Down Expand Up @@ -123,12 +129,12 @@ def emit_make(test_spec, prefix):
# Command-line arguments

parser = argparse.ArgumentParser()
parser.add_argument('-t', '--test', help='Test to look for')
parser.add_argument('-d', '--debug', action='store_true', help='Display debug messages')
parser.add_argument('--yaml', choices=VALID_YAMLS, help='Name of YAML test specification to find')
parser.add_argument('--prefix', help='Prefix to add to make variables generated')
parser.add_argument('-t', '--test', help='Required: Test to look for')
parser.add_argument('--yaml', choices=VALID_YAMLS, help='Required: Name of YAML test specification to find')
parser.add_argument('--core', default=DEFAULT_CORE, help='Default core to test')
parser.add_argument('--prefix', help='Prefix to add to make variables generated')
parser.add_argument('--run-index', default='0', help='Add a run index to append to test specifications')
parser.add_argument('-d', '--debug', action='store_true', help='Display debug messages')
args = parser.parse_args()

if args.debug:
Expand Down
5 changes: 2 additions & 3 deletions cv32e40p/regress/cv32e40p_debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ builds:
uvmt_cv32e40p:
# required: the make command to create the build
cmd: make comp
dir: cv32e40p/sim/uvmt
iss: 1

dir: cv32e40p/sim/uvmt

# List of tests
tests:
debug_test:
Expand Down
3 changes: 1 addition & 2 deletions cv32e40p/regress/cv32e40p_interrupt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ builds:
uvmt_cv32e40p:
# required: the make command to create the build
cmd: make comp
dir: cv32e40p/sim/uvmt
iss: 1
dir: cv32e40p/sim/uvmt

# List of tests
tests:
Expand Down
9 changes: 6 additions & 3 deletions cv32e40p/sim/Common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export SHELL = /bin/bash

CV_CORE_REPO ?= https://github.com/openhwgroup/cv32e40p
CV_CORE_BRANCH ?= master
CV_CORE_HASH ?= 120ac3e
CV_CORE_TAG ?= cv32e40p_v1.0.0
#CV32E40P_TAG ?= none
CV_CORE_HASH ?= a8a3847
CV_CORE_TAG ?= none
# The CV_CORE_HASH above points to an equivalent RTL with respect to v1.0.0 RTL freeze version
# There are some implementation and testbench updates in the above hash
# Set CV_CORE_TAG as below to point to the exact cv32e40p repo as that used at RTL freeze
#CV_CORE_TAG ?= cv32e40p_v1.0.0

RISCVDV_REPO ?= https://github.com/google/riscv-dv
RISCVDV_BRANCH ?= master
Expand Down
Loading

0 comments on commit 50824ac

Please sign in to comment.