diff --git a/.github/workflows/README.md b/.github/workflows/README.md index b03c4972fd..7c532ac21a 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,4 +1,4 @@ -# Github CI Regressions +# GitHub CI Regressions The directory **_typically_** contains YAML files that specify the functional regressions for core-v-verif projects. We are currently transitioning to a new CI flow and so for now this directory is empty. @@ -86,5 +86,5 @@ on: ``` --> -####end +#### end diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml new file mode 100644 index 0000000000..b8839c1901 --- /dev/null +++ b/.github/workflows/aws.yml @@ -0,0 +1,28 @@ +name: aws +on: push + +# on: +# push: +# branches: +# - 'dev' + +jobs: + aws: + name: AWS Pipeline (private) + if: github.actor == 'davideschiavone' || github.actor == 'MikeOpenHWGroup' || github.actor == 'zarubaf' + runs-on: ubuntu-latest + # These permissions are needed to interact with GitHub's OIDC Token endpoint. + permissions: + id-token: write + contents: read + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: eu-west-1 + - name: Run AWS Pipeline + uses: aws-actions/aws-codebuild-run-build@v1 + with: + project-name: core-v-verif + hide-cloudwatch-logs: true diff --git a/bin/ci_check b/bin/ci_check index 42cf58c127..cd9f6fbbe4 100755 --- a/bin/ci_check +++ b/bin/ci_check @@ -57,6 +57,7 @@ if (sys.version_info < (3,0,0)): # Globals.... name_of_ci_check_regression = '_ci_check_dev' # must match the name of one regression list in .metrics.json core_tests = ['misalign', 'illegal', 'dhrystone', 'fibonacci', 'riscv_ebreak_test_0'] +return_code = 1 # signal failure by default try: default_core = os.environ['CV_CORE'] except KeyError: @@ -73,6 +74,7 @@ print('ci_check: topdir : {}'.format(topdir)) parser = argparse.ArgumentParser() parser.add_argument("-s", "--simulator", help="SystemVerilog simulator", choices=['dsim', 'xrun', 'vsim', 'vcs', 'riviera']) parser.add_argument("--core", help="Set the core to test (default: {})".format(default_core), default=default_core) +parser.add_argument("-b", "--batch", help="Run in batch mode (won't prompt for user input)", action="store_true") parser.add_argument("-d", "--debug", help="Display debug messages", action="store_true") parser.add_argument("-p", "--print_command", help="Print commands to stdout, do not run", action="store_true") parser.add_argument("-c", "--check_only", help="Check previosu results (do not run)", action="store_true") @@ -120,6 +122,7 @@ def check_uvm_results(check_only=0): fail_count = 0 expct_fail = 0 pass_count = 0 + global return_code if os.path.exists(sim_results_dir): fails = subprocess.Popen('grep "SIMULATION FAILED" `find {} -name "*.log" -print`'.format(sim_results_dir), @@ -153,9 +156,11 @@ def check_uvm_results(check_only=0): elif ((fail_count == 0) and (pass_count >=3)): print ('\nCI Check PASSED with no failures.') print ('OK to issue a pull-request.\n') + return_code = 0 elif (fail_count == expct_fail): print ('\nCI Check PASSED with KNOWN failure(s).') print ('OK to issue a pull-request.\n') + return_code = 0 else: print ('\nCI Check FAILED with unknown failures.') print ('Please fix before issuing a pull-request.\n') @@ -163,6 +168,7 @@ def check_uvm_results(check_only=0): print ('\nCI Check FAILED with non-existent sim directory: {}'.format(sim_results_dir)) print ('Please fix before issuing a pull-request.\n') + exit(return_code) def check_core_results(run_count): core_runs = subprocess.Popen('grep "EXIT SUCCESS" -R -I ../{}/sim/core/simulation_results'.format(args.core.lower()), @@ -187,9 +193,10 @@ def check_core_results(run_count): # This script may do some unexpected things, so give the user an escape hatch. def ask_user(): - txt = input("Is this what you want [Y/N]? ") - if not ((txt == 'Y') or (txt == 'y')): - exit(1) + if (not args.batch): + txt = input("Is this what you want [Y/N]? ") + if not ((txt == 'Y') or (txt == 'y')): + exit(1) # Load regression YAML def load_regress_yaml(regression): @@ -233,7 +240,7 @@ if (args.check_only): check_core_results(len(core_tests)+1) # +1 because 'make' runs hello-world if not (args.no_uvm): check_uvm_results(args.check_only) - exit(0) + exit(return_code) if (args.no_uvm): uvm = 0 @@ -242,10 +249,10 @@ if (args.verilator): veril = 1 elif (args.simulator == None): print ('Must specify a simulator. Type `ci_check -h` to see how') - exit(0) + exit(1) elif (not(shutil.which(args.simulator))): print ('ERROR: simulator='+args.simulator+' but executable not found') - exit(0) + exit(1) else: svtool = args.simulator @@ -254,16 +261,16 @@ print('ci_check: core : {}'.format(args.core)) print('ci_check: name_of_ci_check_regression : {}'.format(name_of_ci_check_regression)) os.environ['CV_CORE'] = args.core.upper() -# --print_command is set: do not actually _do_ anything +# if --print_command is set: do not actually _do_ anything if not (prcmd): if (args.keep): print ('Keeping previously cloned version of the RTL plus any previously generated files') ask_user() else: - print ('This will delete your previously cloned RTL repo plus all previously generated files') + print ('Deleting your previously cloned RTL repo plus all previously generated files') ask_user() os.chdir(os.path.abspath(os.path.join(topdir, args.core.lower(), 'sim/uvmt'))) - os.system('make clean_all') + os.system('make clean_all SIMULATOR={}'.format(args.simulator)) os.chdir(os.path.join(topdir, '{}/sim/core'.format(args.core.lower()))) os.system('make clean_all') os.chdir(os.path.join(topdir, 'bin')) @@ -319,7 +326,7 @@ if (uvm): os.chdir(topdir) # cmd in .metrics.json assumes all cmds start from here else: print ('ERROR: cannot find build command in .metrics.json') - exit(0) + exit(1) # Get the simulation command(s) for key in metrics_dict: diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000000..475a5cf0d5 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,37 @@ +# Copyright 2023, OpenHW Group +# SPDX-License-Identifier:Apache-2.0 WITH SHL-2.0 +# +# Build-specification for the aws.yml workflow. + +version: 0.2 + +phases: + + build: + commands: + - chown -R florian:florian . +# - su florian -c "source /synopsys/scripts/env.sh; echo $PATH" +# VCS environment + - yum -y install gcc gcc-c++ make + - export VCS_HOME=/synopsys/vcs/S-2021.09-SP1 + - export PATH=$VCS_HOME/bin:$PATH + - vcs -id +# - export LM_LICENSE_FILE=29000@ip-172-31-46-244 + - export SNPSLMD_LICENSE_FILE=27020@ip-172-31-46-244.eu-west-1.compute.internal +# Questasim (vsim) environment +# - export QUESTAROOT=/onespin/questasim +# - export LM_LICENSE_FILE=29000@ip-172-31-46-244 +# - export PATH=${QUESTAROOT}/bin:${PATH} +# - export MTI_VCO_MODE=64 +# - wget https://buildbot.embecosm.com/job/corev-gcc-centos7/19/artifact/corev-openhw-gcc-centos7-20230905.tar.gz + - curl -O https://buildbot.embecosm.com/job/corev-gcc-centos7/19/artifact/corev-openhw-gcc-centos7-20230905.tar.gz + - tar xf corev-openhw-gcc-centos7-20230905.tar.gz + - export HERE=`pwd` + - export CV_SW_TOOLCHAIN=$HERE/corev-openhw-gcc-centos7-20230905 + - export CV_SW_PREFIX=riscv32-corev-elf- + - export CV_SW_MARCH=rv32imc_zicsr_zifencei + - corev-openhw-gcc-centos7-20230905/bin/riscv32-corev-elf-gcc --version +# - cd cv32e40p/sim/uvmt +# - make test USE_ISS=0 SIMULATOR=vcs TEST=hello-world + - cd bin + - ./ci_check --batch --iss 0 --simulator vcs --core cv32e40p diff --git a/mk/uvmt/vcs.mk b/mk/uvmt/vcs.mk index 617d30389d..9996111dd7 100644 --- a/mk/uvmt/vcs.mk +++ b/mk/uvmt/vcs.mk @@ -58,6 +58,9 @@ VCS_COMP_FLAGS ?= -lca -sverilog \ $(SV_CMP_FLAGS) $(VCS_UVM_ARGS) $(VCS_TIMESCALE) \ -assert svaext -race=all -ignore unique_checks -full64 +# TODO: make this optional +VCS_COMP_FLAGS += -suppress + VCS_GUI ?= VCS_RUN_COV = -cm line+cond+tgl+fsm+branch+assert -cm_dir $(MAKECMDGOALS).vdb