diff --git a/.clang-format b/.clang-format index e655c54104..458c0c9703 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,7 @@ BasedOnStyle: Google IndentWidth: 2 Language: Cpp +ColumnLimit: 100 # AlignConsecutiveAssignments: true # AlignConsecutiveDeclarations: true # AlignEscapedNewlines: Right diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f708c60c03..1b1556707d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,27 +5,39 @@ ENV DEBIAN_FRONTEND=noninteractive WORKDIR /workspace RUN export DEBIAN_FRONTEND=noninteractive -RUN apt-get update -RUN apt-get install -y --no-install-recommends git \ - gh \ - less \ - python3 \ - python3.12-venv \ - python3-pip \ - build-essential \ - ruby \ - ruby-dev \ - bundler \ - nodejs \ - npm \ - ditaa \ - libyaml-dev \ - cmake \ - g++ \ - clang-format \ - clang-tidy \ - libelf-dev \ - gcc-riscv64-unknown-elf + +# please keep pkgs sorted +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends --fix-missing \ + build-essential \ + bundler \ + clang-format \ + clang-tidy \ + cmake \ + ditaa \ + g++ \ + gcc-riscv64-linux-gnu \ + gcc-riscv64-unknown-elf \ + gdb \ + gh \ + git \ + less \ + libc6-dev-riscv64-cross \ + libelf-dev \ + libgmp-dev \ + libnewlib-dev\ + libyaml-dev \ + nodejs \ + npm \ + parallel \ + python3 \ + python3-pip \ + python3.12-venv \ + ruby \ + ruby-dev \ + shellcheck + RUN apt-get clean autoclean RUN apt-get autoremove -y RUN rm -rf /var/lib/{apt,dpkg,cache,log}/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 819513e07d..5a1efad6eb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,13 +25,13 @@ "asciidoc.antora.showEnableAntoraPrompt": true }, "extensions": [ - "castwide.solargraph", - "redhat.vscode-yaml", "asciidoctor.asciidoctor-vscode", - "zhwu95.riscv", - "mathematic.vscode-pdf", + "castwide.solargraph", "CraigMaslowski.erb", - "HowerLimited.udb-extension-pack-vscode" + "HowerLimited.udb-extension-pack-vscode", + "mathematic.vscode-pdf", + "redhat.vscode-yaml", + "zhwu95.riscv" ] } }, diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 065543ac93..57faab89b4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,5 @@ # default for all files -* @dhower-qc +* @dhower-qc @ThinkOpenly -# TODO: get more code owners +# eclipse Xtext project owned by Ajit Dingankar +tools/eclipse @adingank-qualcomm @dhower-qc diff --git a/.github/actions/singularity-setup/action.yml b/.github/actions/singularity-setup/action.yml new file mode 100644 index 0000000000..40f2d8ce52 --- /dev/null +++ b/.github/actions/singularity-setup/action.yml @@ -0,0 +1,28 @@ +name: Singularity Setup +description: All steps to use/build Singularity container +runs: + using: composite + steps: + - name: Setup apptainer + uses: eWaterCycle/setup-apptainer@v2.0.0 + - name: Get container from cache + id: cache-sif + uses: actions/cache@v4 + with: + path: .singularity/image.sif + key: ${{ hashFiles('container.def', 'bin/.container-tag') }} + - name: Get gems and node files from cache + id: cache-bundle-npm + uses: actions/cache@v4 + with: + path: | + .home/.gems + node_modules + key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} + - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} + name: Build container + run: ./bin/build_container + shell: bash + - name: Setup project + run: ./bin/setup + shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..342d1286a3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +--- +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100755 index 0000000000..e08b2dae5d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,478 @@ +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# This workflow runs when: +# (a) A PR changes (the regression tests) +# (b) A PR reaches the head of the merge queue, and +# (c) After a PR has been pushed to main +# +# However, it does something different in each case: +# (a) All jobs are no-ops +# (b) All jobs run, but output is not uploaded/GitHub pages is not updated +# (c) All jobs run, results are uploaded, and GitHub pages is updated + +name: Deployment actions +permissions: + contents: read + pull-requests: write +on: + merge_group: + types: [checks_requested] + workflow_dispatch: + workflow_call: + inputs: + dry-run: + required: true + type: boolean + push: + branches: + - main +env: + SINGULARITY: 1 + DEPLOY_DIR: _site +jobs: + build-reuse-manifest: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: run reuse + run: ./bin/reuse spdx -o reuse_bom.txt + - name: Upload Reuse Manifest + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: reuse-manifest + path: reuse_bom.txt + retention-days: 1 + build-udb-api-doc: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate UDB API Docs + run: ./do gen:udb:api_doc + - name: Upload UDB API Docs + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: udb-api + path: gen/udb_api_doc + include-hidden-files: true + retention-days: 1 + resolve-unconfig: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Resolve unconfig + run: ./do gen:resolved_arch + - name: Tar unconfig + run: tar czf gen/resolved_spec/_resolved_spec.tar.gz gen/resolved_spec/_ && mv gen/resolved_spec/_resolved_spec.tar.gz gen/resolved_spec/_/resolved_spec.tar.gz + - name: Upload resolved spec + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: resolved-spec + path: gen/resolved_spec/_ + include-hidden-files: true + retention-days: 1 + build-isa-explorer-csr: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate ISA Explorer CSR + run: ./do gen:isa_explorer_browser_csr + - name: Upload ISA Explorer CSR + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: isa-explorer-csr + path: gen/isa_explorer/browser + retention-days: 1 + build-isa-explorer-ext: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate ISA Explorer Extension + run: ./do gen:isa_explorer_browser_ext + - name: Upload ISA Explorer Extension + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: isa-explorer-ext + path: gen/isa_explorer/browser + retention-days: 1 + build-isa-explorer-inst: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate ISA Explorer Instructions + run: ./do gen:isa_explorer_browser_inst + - name: Upload ISA Explorer Instructions + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: isa-explorer-inst + path: gen/isa_explorer/browser + retention-days: 1 + build-isa-explorer-spreadsheet: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate ISA Explorer Spreadsheet + run: ./do gen:isa_explorer_spreadsheet + - name: Upload ISA Explorer Spreadsheet + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: isa-explorer-spreadsheet + path: gen/isa_explorer/spreadsheet + build-html-isa-manual: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + env: + MANUAL_NAME: isa + VERSIONS: all + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate HTML ISA manual + run: ./do gen:html_manual + - name: Upload HTML ISA manual + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: isa-html-manual + path: gen/manual/isa/top/all/html + build-html-cfg-isa-manual: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate HTML ISA manual for a config + run: ./do gen:html[example_rv64_with_overlay] + - name: Upload HTML ISA manual for a config + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: cfg-html-manual + path: gen/cfg_html_doc/example_rv64_with_overlay/html + build-instruction-appendix: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate instruction appendix + run: ./do gen:instruction_appendix + - name: Upload instruction appendix + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: inst-appendix + path: gen/instructions_appendix/instructions_appendix.pdf + build-rvi20-profile: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVI20 + run: ./do gen:profile_release_pdf[RVI20] + - name: Upload RVI20 + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rvi20 + path: gen/profile/pdf/RVI20ProfileRelease.pdf + build-rva20-profile: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVA20 + run: ./do gen:profile_release_pdf[RVA20] + - name: Upload RVA20 + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rva20 + path: gen/profile/pdf/RVA20ProfileRelease.pdf + build-rva22-profile: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVA22 + run: ./do gen:profile_release_pdf[RVA22] + - name: Upload RVA22 + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rva22 + path: gen/profile/pdf/RVA22ProfileRelease.pdf + build-rva23-profile: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVA23 + run: ./do gen:profile_release_pdf[RVA23] + - name: Upload RVA23 + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rva23 + path: gen/profile/pdf/RVA23ProfileRelease.pdf + build-rvb23-profile: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVB23 + run: ./do gen:profile_release_pdf[RVB23] + - name: Upload RVB23 + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rvb23 + path: gen/profile/pdf/RVB23ProfileRelease.pdf + build-ac100-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate AC100 CRD + run: ./do gen:proc_crd_pdf[AC100] + - name: Upload AC100 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: ac100-crd + path: gen/proc_crd/pdf/AC100-CRD.pdf + build-ac200-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate AC200 CRD + run: ./do gen:proc_crd_pdf[AC200] + - name: Upload AC200 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: ac200-crd + path: gen/proc_crd/pdf/AC200-CRD.pdf + build-mc100-32-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC100-32 CRD + run: ./do gen:proc_crd_pdf[MC100-32] + - name: Upload MC100-32 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc100-32-crd + path: gen/proc_crd/pdf/MC100-32-CRD.pdf + build-mc100-64-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC100-64 CRD + run: ./do gen:proc_crd_pdf[MC100-64] + - name: Upload MC100-64 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc100-64-crd + path: gen/proc_crd/pdf/MC100-64-CRD.pdf + build-mc200-32-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC200-32 CRD + run: ./do gen:proc_crd_pdf[MC200-32] + - name: Upload MC200-32 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc200-32-crd + path: gen/proc_crd/pdf/MC200-32-CRD.pdf + build-mc200-64-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC200-64 CRD + run: ./do gen:proc_crd_pdf[MC200-64] + - name: Upload MC200-64 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc200-64-crd + path: gen/proc_crd/pdf/MC200-64-CRD.pdf + build-mc300-32-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC300-32 CRD + run: ./do gen:proc_crd_pdf[MC300-32] + - name: Upload MC300-32 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc300-32-crd + path: gen/proc_crd/pdf/MC300-32-CRD.pdf + build-mc300-64-crd: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC300-64 CRD + run: ./do gen:proc_crd_pdf[MC300-64] + - name: Upload MC300-64 CRD + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc300-64-crd + path: gen/proc_crd/pdf/MC300-64-CRD.pdf + build-rvi20-32-ctp: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVI20-32 CTP + run: ./do gen:proc_ctp_pdf[RVI20-32] + - name: Upload RVI20-32 CTP + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rvi20-32-ctp + path: gen/proc_ctp/pdf/RVI20-32-CTP.pdf + build-rvi20-64-ctp: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate RVI20-64 CTP + run: ./do gen:proc_ctp_pdf[RVI20-64] + - name: Upload RVI20-64 CTP + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: rvi20-64-ctp + path: gen/proc_ctp/pdf/RVI20-64-CTP.pdf + build-mc100-32-ctp: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate MC100-32 CTP + run: ./do gen:proc_ctp_pdf[MC100-32] + - name: Upload MC100-32 CTP + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: mc100-32-ctp + path: gen/proc_ctp/pdf/MC100-32-CTP.pdf + build-idl-doc: + if: (github.event_name == 'merge_queue') || (inputs.dry-run == false) + runs-on: ubuntu-latest + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Build IDL doc + run: ./bin/bundle exec asciidoctor -r idl_highlighter -a toc=left -a source-highlighter=rouge -o idl.html doc/idl.adoc + - name: Upload IDL Doc + uses: actions/upload-artifact@v4 + if: (github.event_name == 'push') && (github.ref_name == 'main') + with: + name: idl-doc + path: idl.html diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 23e3c72ac1..d222c5c8fc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -31,26 +31,7 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container - - name: Setup project - run: ./bin/setup + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Run regression run: ./do test:nightly diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 2f8b77ec6a..5f9fd4dd01 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,8 +1,9 @@ name: Deploy pages on: - push: - branches: - - main + workflow_run: + workflows: [Deployment actions] + types: [completed] + branches: [main] workflow_dispatch: permissions: contents: read @@ -14,6 +15,7 @@ concurrency: jobs: pages: runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} env: SINGULARITY: 1 environment: @@ -22,29 +24,211 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container - - name: Setup project - run: ./bin/setup - - name: Create deploy dir - run: /bin/bash lib/deploy.sh + - name: singularity setup + uses: ./.github/actions/singularity-setup + + - name: Make _site + run: mkdir _site + - name: Download reuse BOM + uses: actions/download-artifact@v5 + with: + name: reuse-manifest + path: _site/ + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download resolved spec + uses: actions/download-artifact@v5 + with: + name: resolved-spec + path: _site/resolved_spec + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download UDB API Docs + uses: actions/download-artifact@v5 + with: + name: udb-api + path: _site/htmls/udb_api_doc + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download ISA Explorer CSR + uses: actions/download-artifact@v5 + with: + name: isa-explorer-csr + path: _site/isa_explorer + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download ISA Explorer Extension + uses: actions/download-artifact@v5 + with: + name: isa-explorer-ext + path: _site/isa_explorer + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download ISA Explorer Inst + uses: actions/download-artifact@v5 + with: + name: isa-explorer-inst + path: _site/isa_explorer + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download ISA Explorer Spreadsheet + uses: actions/download-artifact@v5 + with: + name: isa-explorer-spreadsheet + path: _site/isa_explorer + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download HTML ISA Manual + uses: actions/download-artifact@v5 + with: + name: isa-html-manual + path: _site/manual/html + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download HTML ISA Manual + uses: actions/download-artifact@v5 + with: + name: cfg-html-manual + path: _site/example_cfg/html + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download Instruction Appendix + uses: actions/download-artifact@v5 + with: + name: inst-appendix + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVI20 + uses: actions/download-artifact@v5 + with: + name: rvi20 + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVA20 + uses: actions/download-artifact@v5 + with: + name: rva20 + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVA22 + uses: actions/download-artifact@v5 + with: + name: rva22 + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVA23 + uses: actions/download-artifact@v5 + with: + name: rva23 + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVB23 + uses: actions/download-artifact@v5 + with: + name: rvb23 + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download AC100 + uses: actions/download-artifact@v5 + with: + name: ac100-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download AC200 + uses: actions/download-artifact@v5 + with: + name: ac200-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC100-32 + uses: actions/download-artifact@v5 + with: + name: mc100-32-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC100-64 + uses: actions/download-artifact@v5 + with: + name: mc100-64-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC200-32 + uses: actions/download-artifact@v5 + with: + name: mc200-32-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC200-64 + uses: actions/download-artifact@v5 + with: + name: mc200-64-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC300-32 + uses: actions/download-artifact@v5 + with: + name: mc300-32-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC300-64 + uses: actions/download-artifact@v5 + with: + name: mc300-64-crd + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVI20-32 CTP + uses: actions/download-artifact@v5 + with: + name: rvi20-32-ctp + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download RVI20-64 CTP + uses: actions/download-artifact@v5 + with: + name: rvi20-64-ctp + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download MC100-32 CTP + uses: actions/download-artifact@v5 + with: + name: mc100-32-ctp + path: _site/pdfs + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Download IDL Doc + uses: actions/download-artifact@v5 + with: + name: idl-doc + path: idl.html + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Create index + env: + PAGES_URL: https://riscv-software-src.github.io/riscv-unified-db + run: > + cp doc/udb-block.svg _site/ && + ruby -r erb -r date + -e "File.write('_site/index.html', + ERB.new(File.read('tools/scripts/pages.html.erb'), + trim_mode: '-').result(binding))" + + - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact diff --git a/.github/workflows/pr_title_check.yml b/.github/workflows/pr_title_check.yml new file mode 100644 index 0000000000..26aaf75464 --- /dev/null +++ b/.github/workflows/pr_title_check.yml @@ -0,0 +1,46 @@ +name: 'Lint PR' + +on: + # This allows the action to be used in a fork-based workflow, where + # e.g. you want to accept pull requests in a public repository. + # In this case, the configuration from the main branch of your repository will be used for the + # check. This means that you need to have this configuration in the main branch for the action to + # run at all (e.g. it won't run within a PR that adds the action initially). + # Also if you change the configuration in a PR, the changes will not be reflected for the current + # PR – only subsequent ones after the changes are in the main branch. + pull_request_target: + types: + - opened + - edited + - reopened + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: amannn/action-semantic-pull-request@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Configure that a scope is optional + requireScope: false + # Configure additional validation for the subject based on a regex. + # This ensures the subject doesn't start with an uppercase character. + subjectPattern: ^(?![A-Z]).+$ + # If `subjectPattern` is configured, you can use this property to override + # the default error message that is shown when the pattern doesn't match. + # The variables `subject` and `title` can be used within the message. + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + doesn't start with an uppercase character. + # If the PR contains one of these newline-delimited labels, the + # validation is skipped. If you want to rerun the validation when + # labels change, you might want to use the `labeled` and `unlabeled` + # event triggers in your workflow. + ignoreLabels: | + bot + ignore-semantic-pull-request diff --git a/.github/workflows/regress.yml b/.github/workflows/regress.yml old mode 100644 new mode 100755 index 1bd50a4096..45420910b2 --- a/.github/workflows/regress.yml +++ b/.github/workflows/regress.yml @@ -1,10 +1,10 @@ name: Regression test +permissions: + contents: read + pull-requests: write on: - push: - branches: - - main - merge_group: # this is a new line - types: [checks_requested] # this is a new line + merge_group: + types: [checks_requested] pull_request: branches: - main @@ -17,35 +17,33 @@ jobs: - uses: actions/setup-python@v5 - uses: pre-commit/action@v3.0.1 regress-smoke: + needs: build-llvm runs-on: ubuntu-latest env: SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm + - name: Get current LLVM submodule commit SHA + id: get-llvm-sha + run: echo "LLVM_SHA=$(git ls-tree HEAD ext/llvm-project | awk '{print $3}')" >> $GITHUB_ENV + - name: Restore cache RISC-V JSON + id: cache-riscv uses: actions/cache@v4 with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container - - name: Setup project - run: ./bin/setup + path: ext/llvm-project/riscv.json + key: ${{ runner.os }}-riscv-json-${{ env.LLVM_SHA }} + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Run smoke run: ./do test:smoke + - name: Upload idlc coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + disable_search: true + files: tools/ruby-gems/idlc/coverage/coverage.xml + flags: idlc regress-gen-isa-manual: runs-on: ubuntu-latest env: @@ -55,27 +53,23 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Generate HTML ISA manual run: ./do gen:html_manual + regress-gen-instruction-appendix: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate instruction appendix asciidoc + run: ./do gen:instruction_appendix_adoc + - name: Check instruction appendix result + run: ./do test:instruction_appendix regress-cfg-manual: runs-on: ubuntu-latest env: @@ -83,25 +77,8 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Generate HTML ISA manual run: ./do gen:html[example_rv64_with_overlay] regress-gen-ext-pdf: @@ -114,25 +91,8 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Generate extension PDF run: ./do gen:ext_pdf regress-gen-certificate: @@ -142,27 +102,10 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 - with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm - uses: actions/cache@v4 - with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container + - name: singularity setup + uses: ./.github/actions/singularity-setup - name: Generate extension PDF - run: ./do gen:cert_model_pdf[MockCertificateModel] + run: ./do gen:proc_crd_pdf[MockProcessor] regress-gen-profile: runs-on: ubuntu-latest env: @@ -170,24 +113,117 @@ jobs: steps: - name: Clone Github Repo Action uses: actions/checkout@v4 - - name: Setup apptainer - uses: eWaterCycle/setup-apptainer@v2.0.0 - - name: Get container from cache - id: cache-sif - uses: actions/cache@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate extension PDF + run: ./do gen:profile_release_pdf[Mock] + build-llvm: + runs-on: ubuntu-latest + steps: + - name: Check out repository (no submodules, shallow fetch) + uses: actions/checkout@v4 with: - path: .singularity/image.sif - key: ${{ hashFiles('container.def', 'bin/.container-tag') }} - - name: Get gems and node files from cache - id: cache-bundle-npm + submodules: false + fetch-depth: 1 + - name: Get current LLVM submodule commit SHA + id: get-llvm-sha + run: echo "LLVM_SHA=$(git ls-tree HEAD ext/llvm-project | awk '{print $3}')" >> $GITHUB_ENV + - name: Cache RISC-V JSON + id: cache-riscv uses: actions/cache@v4 with: - path: | - .home/.gems - node_modules - key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} - - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} - name: Build container - run: ./bin/build_container - - name: Generate extension PDF - run: ./do gen:profile[MockProfileRelease] + path: ext/llvm-project/riscv.json + key: ${{ runner.os }}-riscv-json-${{ env.LLVM_SHA }} + - name: Initialize LLVM submodule (shallow + sparse) + if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }} + run: | + rm -rf ext/llvm-project + git submodule sync --recursive + git submodule update --init --recursive --depth=1 ext/llvm-project + - name: Check for required directories and files + if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }} + run: | + ls -l ext/llvm-project/llvm/include + ls -l ext/llvm-project/llvm/lib/Target/RISCV + ls -l ext/llvm-project/llvm/lib/Target/RISCV/RISCV.td + - name: Configure and build llvm-tblgen + if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }} + run: | + cmake -S ext/llvm-project/llvm -B ext/llvm-project/build -DCMAKE_BUILD_TYPE=Release + cmake --build ext/llvm-project/build --target llvm-tblgen + - name: Generate RISC-V JSON + if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }} + run: | + chmod +x ./ext/llvm-project/build/bin/llvm-tblgen + ./ext/llvm-project/build/bin/llvm-tblgen \ + -I ext/llvm-project/llvm/include \ + -I ext/llvm-project/llvm/lib/Target/RISCV \ + ext/llvm-project/llvm/lib/Target/RISCV/RISCV.td \ + --dump-json \ + -o ext/llvm-project/riscv.json + - name: Show riscv.json output + run: ls -l ext/llvm-project/riscv.json + - name: Upload RISC-V JSON as Artifact + uses: actions/upload-artifact@v4 + with: + name: riscv-json + path: ext/llvm-project/riscv.json + regress-gen-go: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate Go code + run: ./do gen:go + regress-gen-c-header: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Generate c_header code + run: ./do gen:c_header + regress-cpp-unit: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Run cpp unit tests + run: ./do test:cpp_hart CONFIG=rv64 JOBS=4 + regress-riscv-tests: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Run riscv-tests + run: ./do test:riscv_tests CONFIG=rv32 JOBS=4 + regress-xqci-doc: + runs-on: ubuntu-latest + env: + SINGULARITY: 1 + steps: + - name: Clone Github Repo Action + uses: actions/checkout@v4 + - name: singularity setup + uses: ./.github/actions/singularity-setup + - name: Run cpp unit tests + run: ./do gen:ext_pdf EXT=Xqci CFG=qc_iu.yaml VERSION=latest + call-deploy: + uses: ./.github/workflows/deploy.yml + with: + dry-run: true diff --git a/.gitignore b/.gitignore index 8f6230a0b8..64473e9784 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ .asciidoctor .vscode/* !.vscode/launch.json +!.vscode/extensions.json +!.vscode/settings.json .container-type diag-ditaa-* arch/manual/isa/**/riscv-isa-manual @@ -16,4 +18,15 @@ gen node_modules _site images +__pycache__/ +*.pyc +.pytest_cache/ +*.bak *.log +sorbet +!tools/ruby-gems/idlc/sorbet +!tools/ruby-gems/udb/sorbet +coverage + +# emacs backup files +*~ diff --git a/.gitmessage b/.gitmessage new file mode 100644 index 0000000000..b632c7dd3c --- /dev/null +++ b/.gitmessage @@ -0,0 +1,29 @@ +# (): +# No line more than 80 chars. #### 80 chars is here: # + +# Body: Explain *what* and *why* (not *how*). +# + +# Conventional Footer: required if this is a breaking change +# BREAKING CHANGE: +# +# + +# At the end: Include Co-authored-by if relevant. +# Co-authored-by: name + +# common title types: +# build: build system +# ci: continous integration +# docs: improves documentation +# feat: adds a new feature +# fix: fixes a code bug +# perf: performance improvement +# refactor: changes code, neither a fix nor feature +# revert: reverts a prior commit(s) +# style: style update + +# common title scopes: +# data: Database information +# schema: Database schema +# ruby: Ruby code diff --git a/.gitmodules b/.gitmodules index dca08ddbfe..8b4533e0e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,13 @@ [submodule "ext/riscv-isa-manual"] path = ext/riscv-isa-manual url = https://github.com/riscv/riscv-isa-manual +[submodule "ext/llvm-project"] + path = ext/llvm-project + url = https://github.com/llvm/llvm-project.git + branch = main [submodule "ext/riscv-tests"] path = ext/riscv-tests url = https://github.com/riscv-software-src/riscv-tests.git +[submodule "ext/rbi-central"] + path = ext/rbi-central + url = https://github.com/Shopify/rbi-central diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 index 00d1ce8e7b..59245b291e --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,50 +8,85 @@ repos: rev: v5.0.0 hooks: - id: check-ast + stages: [pre-commit] - id: check-builtin-literals + stages: [pre-commit] - id: check-case-conflict + stages: [pre-commit] - id: check-docstring-first + stages: [pre-commit] - id: check-symlinks + stages: [pre-commit] - id: end-of-file-fixer + stages: [pre-commit] + exclude: \.((golden\.adoc)|svg)$ - id: trailing-whitespace + stages: [pre-commit] args: [--markdown-linebreak-ext=md] + exclude: \.svg$ - id: check-merge-conflict + stages: [pre-commit] args: ["--assume-in-merge"] exclude: \.adoc$ # sections titles Level 6 "=======" get flagged otherwise - id: check-json + stages: [pre-commit] exclude: ^\.devcontainer/ # Uses JSONC (comments) - id: check-yaml + stages: [pre-commit] - repo: https://github.com/rbubley/mirrors-prettier rev: v3.5.3 hooks: - id: prettier - files: \.(json|yml|yaml)$ + stages: [pre-commit] + files: \.(json|toml|yml|yaml)$ exclude: schemas/json-schema-draft-07.json - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.31.3 + rev: 0.33.0 hooks: - id: check-jsonschema + name: Validate instruction files with jsonschema + stages: [pre-commit] alias: check-jsonschema-inst files: ^arch/inst/.*\.(yaml|yml)$ args: ["--schemafile", "schemas/inst_schema.json"] - id: check-jsonschema + name: Validate CSR files with jsonschema + stages: [pre-commit] alias: check-jsonschema-csr files: ^arch/csr/.*\.(yaml|yml)$ args: ["--schemafile", "schemas/csr_schema.json"] - id: check-jsonschema + name: Validate extension files with jsonschema + stages: [pre-commit] alias: check-jsonschema-ext files: ^arch/ext/.*\.(yaml|yml)$ args: ["--schemafile", "schemas/ext_schema.json"] - id: check-jsonschema + name: Validate cert model files with jsonschema + stages: [pre-commit] alias: check-jsonschema-cert-model - files: ^arch/certificate_model/.*\.(yaml|yml)$ - args: ["--schemafile", "schemas/cert_model_schema.json"] + files: ^arch/proc_cert_model/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/proc_cert_model_schema.json"] - id: check-jsonschema + name: Validate cert class files with jsonschema + stages: [pre-commit] alias: check-jsonschema-cert-class - files: ^arch/certificate_class/.*\.(yaml|yml)$ - args: ["--schemafile", "schemas/cert_class_schema.json"] + files: ^arch/proc_cert_class/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/proc_cert_class_schema.json"] + - id: check-jsonschema + name: Validate profile family files with jsonschema + stages: [pre-commit] + alias: check-jsonschema-profile-family + files: ^arch/profile_family/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/profile_family_schema.json"] + - id: check-jsonschema + name: Validate profile release files with jsonschema + stages: [pre-commit] + alias: check-jsonschema-profile-release + files: ^arch/profile_release/.*\.(yaml|yml)$ + args: ["--schemafile", "schemas/profile_release_schema.json"] # Commenting because throwing errors and not sure this is complete yet # - id: check-jsonschema # alias: check-jsonschema-manual-version @@ -59,32 +94,48 @@ repos: # args: ["--schemafile", "schemas/manual_version_schema.json"] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v18.1.3" + rev: "v20.1.0" hooks: - id: clang-format + stages: [pre-commit] types_or: [c++, c] files: \.(hpp|cpp)$ + # TEMPORARILY DISABLE CLANG-FORMAT IN LIBHART + # WIll RE-ENABLE WHEN NEXT PATCH COMES THROUGH + exclude: backends/cpp_hart_gen - repo: https://github.com/psf/black-pre-commit-mirror rev: 25.1.0 hooks: - id: black + stages: [pre-commit] - repo: https://github.com/asottile/pyupgrade rev: v3.19.1 hooks: - id: pyupgrade + stages: [pre-commit] - # - repo: https://github.com/koalaman/shellcheck-precommit - # rev: v0.10.0 - # hooks: - # - id: shellcheck - # args: ["--severity=error"] + - repo: local + hooks: + - id: shellcheck + name: shellcheck + types: [shell] + language: system + entry: shellcheck + args: ["--severity=error"] - repo: https://github.com/scop/pre-commit-shfmt rev: v3.11.0-1 hooks: - id: shfmt + stages: [pre-commit] args: - --indent - "2" - --case-indent + + - repo: https://github.com/fsfe/reuse-tool + rev: v5.0.2 + hooks: + - id: reuse-lint-file + exclude: COMMIT_EDITMSG|MERGE_MSG diff --git a/.rubocop.yml b/.rubocop.yml index 3d27e703b6..e9937a7635 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,11 @@ -require: rubocop-minitest +plugins: + - rubocop-minitest + - rubocop-performance + - rubocop-sorbet + +inherit_gem: + rubocop-github: + - config/default.yml AllCops: TargetRubyVersion: 3.2.3 diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..5647544637 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "asciidoctor.asciidoctor-vscode", + "castwide.solargraph", + "CraigMaslowski.erb", + "HowerLimited.udb-extension-pack-vscode", + "mathematic.vscode-pdf", + "redhat.vscode-yaml", + "zhwu95.riscv" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json index ccaf87153d..a5aebc6bd5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,30 +1,186 @@ { "version": "0.2.0", "configurations": [ + { + "name": "ISS debug Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/gen/cpp_hart_gen/rv32_Debug/build/iss", + "args": ["-m", "rv32", "-c", "${workspaceFolder}/cfgs/mc100-32-riscv-tests.yaml", "${workspaceFolder}/ext/riscv-tests/isa/rv32ui-p-addi"], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "${workspaceFolder}/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + }, + { + "description": "Set default value display to hex", + "text": "-gdb-set output-radix 16", + "ignoreFailures": true + } + ] + }, + { + "type": "rdbg", + "name": "Smoke test", + "request": "launch", + "command": "bundle exec rake", + "script": "test:smoke", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "Regression test", + "request": "launch", + "command": "bundle exec rake", + "script": "test:regress", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "Manual", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:html_manual MANUAL_NAME=isa VERSIONS=all", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MC100-32-CRD", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_crd_pdf[MC100-32]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MC100-32-CTP", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_ctp_pdf[MC100-32]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MC200-32-CRD", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_crd_pdf[MC200-32]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "AC100-CRD", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_crd_pdf[AC100]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "AC200-CRD", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_crd_pdf[AC200]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MockCRD", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_crd_pdf[MockProcessor]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MockCTP", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:proc_ctp_pdf[MockProcessor]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "portfolios", + "request": "launch", + "command": "bundle exec rake", + "script": "portfolios", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "MockProfile", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:profile_release_pdf[Mock]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "RVI20", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:profile_release_pdf[RVI20]", + "args": [], + "askParameters": false + }, + { + "type": "rdbg", + "name": "ISA Explorer Browser Extension Generator", + "request": "launch", + "command": "bundle exec rake", + "script": "gen:isa_explorer_browser_ext", + "args": [], + "askParameters": false + }, { "type": "rdbg", - "name": "MC100-32", + "name": "ISA Explorer Browser Instruction Generator", "request": "launch", "command": "bundle exec rake", - "script": "gen:cert_model_pdf[MC100-32]", + "script": "gen:isa_explorer_browser_inst", "args": [], "askParameters": false }, { "type": "rdbg", - "name": "MC200-32", + "name": "ISA Explorer Browser CSR Generator", "request": "launch", "command": "bundle exec rake", - "script": "gen:cert_model_pdf[MC200-32]", + "script": "gen:isa_explorer_browser_csr", "args": [], "askParameters": false }, { "type": "rdbg", - "name": "RVA20", + "name": "ISA Explorer Spreadsheet Generator", "request": "launch", "command": "bundle exec rake", - "script": "gen:profile[RVA20]", + "script": "gen:isa_explorer_spreadsheet", "args": [], "askParameters": false }, diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..acb6844585 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,70 @@ +{ + "solargraph.bundlerPath": "bin/bundle", + "solargraph.useBundler": true, + "sorbet.lspConfigs": [ + + { + "id": "container", + "name": "Sorbet (UDB)", + "description": "Sorbet in the UDB container", + "command": [ + "/local/mnt/workspace/dhower/riscv-unified-db/worktrees/udbgem/bin/bundle", + "exec", + "srb", + "tc", + "--lsp", + "--dir", + "tools/gems", + "--ignore", + "api_doc", + "--ignore", + "doc", + "--ignore", + "ext", + "--ignore", + "python", + "-v", + "3", + "--debug-log-file=srb-lsp.out", + "--disable-watchman" + ] + }, + { + "id": "host", + "name": "Sorbet (Host)", + "description": "Sorbet on the host", + "command": [ + "/usr2/dhower/.rbenv/shims/bundle", + "exec", + "srb", + "typecheck", + "--lsp", + "--dir", + "tools/gems", + "--ignore", + "api_doc", + "--ignore", + "doc", + "--ignore", + "ext", + "--ignore", + "python", + "--disable-watchman" + ] + }, + { + "id": "experimental", + "name": "Sorbet (Experimental)", + "description": "Experimental Sorbet Ruby IDE features (warning: crashy, for developers only)", + "command": [ + "bundle", + "exec", + "srb", + "typecheck", + "--lsp", + "--enable-all-experimental-lsp-features" + ] + } + ], + "sorbet.selectedLspConfigId": "host" +} diff --git a/CODE_OF_CONDUCT.adoc b/CODE_OF_CONDUCT.adoc new file mode 100644 index 0000000000..5e1f93785b --- /dev/null +++ b/CODE_OF_CONDUCT.adoc @@ -0,0 +1,57 @@ += UnifiedDB Code of Conduct + +UnifiedDB follows the RISC-V International Code of Conduct. + +== Our Pledge +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +== Our Standards +Examples of behavior that contributes to creating a positive environment include: + +Using welcoming and inclusive language +Being respectful of differing viewpoints and experiences +Gracefully accepting constructive criticism +Focusing on what is best for the community +Showing empathy towards other community members +Examples of unacceptable behavior by participants include: + +The use of sexualized language or imagery and unwelcome sexual attention or advances +Trolling, insulting/derogatory comments, and personal or political attacks +Trafficking in disinformation, unsubstantiated slanderous rumors, and conspiracy theories +Public or private harassment +Publishing others' private information, such as a physical or electronic address, without explicit permission +Other conduct which could reasonably be considered inappropriate in a professional setting +Our Responsibilities +RISC-V International is responsible for clarifying the standards of acceptable behavior and is expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. RISC-V International has the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +== Scope +This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +== Enforcement +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting RISC-V International at conduct@riscv.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. RISC-V International is obligated to maintain confidentiality with regard to the reporter of an incident. + +== Enforcement Guidelines +RISC-V International will follow these guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +=== 1. Correction +Community Impact:: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +Consequence:: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. Moderation of postings may be used if applicable. + +=== 2. Warning +Community Impact:: A violation through a single incident or series of actions. + +Consequence:: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +=== 3. Temporary Ban +Community Impact:: A serious violation of community standards, including sustained inappropriate behavior. + +Consequence:: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +=== 4. Permanent Ban +Community Impact:: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +Consequence:: A permanent ban from any sort of public interaction within the community. + +== Attribution +This Code of Conduct is based on the https://www.contributor-covenant.org/version/2/1/code_of_conduct/[Contributor Covenant, version 2.1]. For answers to common questions about this code of conduct, see the Contributor Covenant https://www.contributor-covenant.org/faq[FAQ]. diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc new file mode 100644 index 0000000000..b5dacfbcc4 --- /dev/null +++ b/CONTRIBUTING.adoc @@ -0,0 +1,180 @@ += UnifiedDB Contribution Guide + +Thank you for your interest in contributing to UnifiedDB! +We welcome all contributions that meet our xref:CODE_OF_CONDUCT.adoc[code of conduct]. + +== Ways to contribute + +=== Bug Reports + +Bug reports should be filed as a https://github.com/riscv-software-src/riscv-unified-db/issues[GitHub Issue] using the `Bug report` template. + +=== Feature Requests + +Feature requests should be filed as a https://github.com/riscv-software-src/riscv-unified-db/issues[GitHub Issue] using the `Feature request` template. + +=== Bug Fixes + +Bug fixes should be submitted as a Pull Request. + +There should be a corresponding https://github.com/riscv-software-src/riscv-unified-db/issues[GitHub Issue] for the PR. Ensure the two are linked by adding "closes #" in the PR description. + +=== New data, tools, and features + +New data (for example, adding an extension), tools, or features should be submitted as a Pull Request. + +There should be a corresponding https://github.com/riscv-software-src/riscv-unified-db/issues[GitHub Issue] for the PR. Ensure the two are linked by adding "closes #" in the PR description. + +== Submitting a Pull Request + +All patches must meet the UnifiedDB code standards. This includes: + +* Pass regression tests (run locally as `./do test:regress`) +* Use appropriate commit messages +* Go through code review as a Pull Request + +=== Regression tests + +All contributions must pass the full suite of regression tests. +Tests are documented more in xref:doc/ci.adoc[Continuous Integration]. + +=== Commit messages + +UnifiedDB adheres to https://www.conventionalcommits.org/en/v1.0.0[Conventional Commits v1.0.0]. + +The guidelines below are adapted from https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md[the Angular commit message guidelines]. + +Every commit message consists of a mandatory *header*, a mandatory *body*, and an optional *footer*. + +``` +
+ + + +