Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dhower-qc committed Dec 10, 2024
2 parents 5c9e0a9 + f91ce90 commit 667c999
Show file tree
Hide file tree
Showing 1,380 changed files with 11,101 additions and 4,869 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/onCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

npm i
npm i
bundle install
54 changes: 54 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Regression test

on:
schedule:
- cron: '30 2 * * *'
workflow_dispatch:

jobs:
# check_date from: https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}

- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
nightly:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
steps:
- name: Clone Github Repo Action
uses: actions/checkout@v4
- name: Setup apptainer
uses: eWaterCycle/[email protected]
- name: Get container from cache
id: cache-sif
uses: actions/cache@v3
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@v3
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: Run regression
run: ./do test:nightly
4 changes: 2 additions & 2 deletions .github/workflows/regress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup project
run: ./bin/setup
- name: Run smoke
run: ./do smoke
run: ./do test:smoke
regress-gen-isa-manual:
runs-on: ubuntu-latest
needs: regress-smoke
Expand Down Expand Up @@ -146,4 +146,4 @@ jobs:
name: Build container
run: ./bin/build_container
- name: Generate extension PDF
run: ./do gen:profile[MockProfileRelease]
run: ./do gen:profile[MockProfileRelease]
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
exclude: ^docs/ruby/ # All generated code

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-merge-conflict
args: ["--assume-in-merge"]
exclude: \.adoc$ # sections titles Level 6 "=======" get flagged otherwise
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ Quick start:
## examples
# validate against the schema
./do validate
# run smoke tests
./do test:smoke
# generate all versions of ISA manual, as an Antora static website
./do gen:html_manual MANUAL_NAME=isa VERSIONS=all
Expand Down
194 changes: 112 additions & 82 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,22 @@ namespace :serve do
end
end

desc "Run the IDL compiler test suite"
task :idl_test do
t = Minitest::TestTask.new(:lib_test)
t.test_globs = ["#{$root}/lib/idl/tests/test_*.rb"]
t.process_env
ruby t.make_test_cmd
end
namespace :test do
# "Run the IDL compiler test suite"
task :idl_compiler do
t = Minitest::TestTask.new(:lib_test)
t.test_globs = ["#{$root}/lib/idl/tests/test_*.rb"]
t.process_env
ruby t.make_test_cmd
end

desc "Run the Ruby library test suite"
task :lib_test do
t = Minitest::TestTask.new(:lib_test)
t.test_globs = ["#{$root}/lib/test/test_*.rb"]
t.process_env
ruby t.make_test_cmd
# "Run the Ruby library test suite"
task :lib do
t = Minitest::TestTask.new(:lib_test)
t.test_globs = ["#{$root}/lib/test/test_*.rb"]
t.process_env
ruby t.make_test_cmd
end
end

desc "Clean up all generated files"
Expand All @@ -105,7 +107,7 @@ task :clean do
FileUtils.rm_rf $root / ".stamps"
end

namespace :validate do
namespace :test do
task :insts do
puts "Checking instruction encodings..."
inst_paths = Dir.glob("#{$root}/arch/inst/**/*.yaml").map { |f| Pathname.new(f) }
Expand Down Expand Up @@ -136,9 +138,6 @@ namespace :validate do
end
end

desc "Validate the arch docs"
task validate: ["validate:schema", "validate:idl", "validate:insts"]

def insert_warning(str, from)
# insert a warning on the second line
lines = str.lines
Expand Down Expand Up @@ -284,70 +283,101 @@ namespace :gen do
end
end

desc <<~DESC
Run the regression tests
These tests must pass before a commit will be allowed in the main branch on GitHub
DESC
task :regress do
Rake::Task["idl_test"].invoke
Rake::Task["lib_test"].invoke
Rake::Task["validate"].invoke
ENV["MANUAL_NAME"] = "isa"
ENV["VERSIONS"] = "all"
Rake::Task["gen:html_manual"].invoke
Rake::Task["gen:html"].invoke("generic_rv64")
ENV["EXT"] = "B"
ENV["VERSION"] = "latest"
Rake::Task["gen:ext_pdf"].invoke
Rake::Task["#{$root}/gen/certificate_doc/pdf/MockCertificateModel.pdf"].invoke
Rake::Task["#{$root}/gen/certificate_doc/pdf/MC100.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA20.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA22.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVI20.pdf"].invoke

puts
puts "Regression test PASSED"
namespace :test do
desc <<~DESC
Run smoke tests
These are basic but fast-running tests to check the database and tools
DESC
task :smoke do
Rake::Task["test:idl_compiler"].invoke
Rake::Task["test:lib"].invoke
Rake::Task["test:schema"].invoke
Rake::Task["test:idl_model"].invoke
end

desc <<~DESC
Run the regression tests
These tests must pass before a commit will be allowed in the main branch on GitHub
DESC
task :regress do
Rake::Task["test:smoke"].invoke

ENV["MANUAL_NAME"] = "isa"
ENV["VERSIONS"] = "all"
Rake::Task["gen:html_manual"].invoke

ENV["EXT"] = "B"
ENV["VERSION"] = "latest"
Rake::Task["gen:ext_pdf"].invoke

Rake::Task["gen:html"].invoke("generic_rv64")

Rake::Task["#{$root}/gen/certificate_doc/pdf/MockCertificateModel.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"].invoke

puts
puts "Regression test PASSED"
end

desc <<~DESC
Run the nightly regression tests
Generally, this tries to build all artifacts
DESC
task :nightly do
Rake::Task["regress"].invoke

Rake::Task["#{$root}/gen/certificate_doc/pdf/MC100.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA20.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA22.pdf"].invoke
Rake::Task["#{$root}/gen/profile_doc/pdf/RVI20.pdf"].invoke

puts
puts "Nightly regression test PASSED"
end
end

desc <<~DESC
Generate all certificates and profile PDFs.
DESC
task :cert_profile_pdfs do
puts "==================================="
puts "cert_profile_pdfs: Generating MC100"
puts " 1st target"
puts "==================================="
Rake::Task["#{$root}/gen/certificate_doc/pdf/MC100.pdf"].invoke

puts "=================================================="
puts "cert_profile_pdfs: Generating MockCertificateModel"
puts " 2nd target"
puts "=================================================="
Rake::Task["#{$root}/gen/certificate_doc/pdf/MockCertificateModel.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVA20"
puts " 3rd target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA20.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVA22"
puts " 4th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA22.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVI20"
puts " 5th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVI20.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating MockProfileRelease"
puts " 6th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"].invoke
end
namespace :gen do
desc <<~DESC
Generate all certificates and profile PDFs.
DESC
task :cert_profile_pdfs do
puts "==================================="
puts "cert_profile_pdfs: Generating MC100"
puts " 1st target"
puts "==================================="
Rake::Task["#{$root}/gen/certificate_doc/pdf/MC100.pdf"].invoke

puts "=================================================="
puts "cert_profile_pdfs: Generating MockCertificateModel"
puts " 2nd target"
puts "=================================================="
Rake::Task["#{$root}/gen/certificate_doc/pdf/MockCertificateModel.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVA20"
puts " 3rd target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA20.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVA22"
puts " 4th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVA22.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating RVI20"
puts " 5th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/RVI20.pdf"].invoke

puts "==================================="
puts "cert_profile_pdfs: Generating MockProfileRelease"
puts " 6th target"
puts "==================================="
Rake::Task["#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"].invoke
end
end
2 changes: 1 addition & 1 deletion arch/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To tame this challenge, this specification generator takes the following approac

The architecture is specified in a series of https://en.wikipedia.org/wiki/YAML[YAML]
files for _Extensions_, _Instructions_, and _Control and Status Registers (CSRs)_.
Each extension/instruction/CSR has its own file.
Each extension/instruction/CSR has its own file.

== Flow

Expand Down
6 changes: 3 additions & 3 deletions arch/certificate_class/MC.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ naming_scheme: |
Where:
* Left & right square braces denote optional.
* Left & right square braces denote optional.
* \<model> is a 3 digit integer. It is changed only when mandatory extensions are added to a CRD.
** The one's digit is incremented when a small mandatory extension is added (e.g., Zicond)
** The ten's digit is incremented when a medium mandatory extension is addded (e.g., PMP)
** The hundreds's digit is incremented when a large mandatory extension is addded (e.g., V or H)
* \<version> is a semantic version (see semver.org) formatted as <major>[.<minor>.[patch]]. If \<version> is omitted, the reference applies equally to all versions.
* \<version> is a semantic version (see semver.org) formatted as <major>[.<minor>.[patch]]. If \<version> is omitted, the reference applies equally to all versions.
** A <major> release indicates support for a new optional extension.
** A <minor> release indicates one or more of the following changes to the certification tests associated with the CRD.
*** Fix test bug or increase test coverage
Expand All @@ -35,4 +35,4 @@ naming_scheme: |
** A <patch> release indicates just CRD specification changes without any difference in functional behavior
mandatory_priv_modes:
- M
- M
4 changes: 2 additions & 2 deletions arch/certificate_model/MC100.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class:
$ref: certificate_class/MC.yaml#

# Semantic versions within the model
versions:
versions:
- version: "1.0.0"

# XLEN used by rakefile
Expand Down Expand Up @@ -139,4 +139,4 @@ extensions:
const: little
XLEN:
schema:
const: 32
const: 32
4 changes: 2 additions & 2 deletions arch/certificate_model/MockCertificateModel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ base: 64
# Semantic versions within the model
versions:
- version: "1.0.0"
- version: "1.1.0"
- version: "1.1.0"

revision_history:
- revision: "0.1.0"
Expand Down Expand Up @@ -222,4 +222,4 @@ recommendations:
- text: |
Implementations are strongly recommended to raise illegal-instruction
exceptions on attempts to execute unimplemented opcodes.
- text: Micky should give Pluto an extra treat
- text: Micky should give Pluto an extra treat
Loading

0 comments on commit 667c999

Please sign in to comment.