Skip to content

Commit 2812852

Browse files
Merge branch 'riscv-software-src:main' into ruby_test
2 parents 2106d8a + a2d3f40 commit 2812852

21 files changed

+2602
-1365
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
BasedOnStyle: Google
33
IndentWidth: 2
44
Language: Cpp
5+
ColumnLimit: 100
56
# AlignConsecutiveAssignments: true
67
# AlignConsecutiveDeclarations: true
78
# AlignEscapedNewlines: Right

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
3+
version: 2
4+
updates:
5+
- package-ecosystem: gitsubmodule
6+
directory: /
7+
schedule:
8+
interval: daily

.github/workflows/regress.yml

100644100755
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: Regression test
2+
permissions:
3+
contents: read
4+
pull-requests: write
25
on:
36
push:
47
branches:
@@ -17,12 +20,24 @@ jobs:
1720
- uses: actions/setup-python@v5
1821
- uses: pre-commit/[email protected]
1922
regress-smoke:
23+
needs: build-llvm
2024
runs-on: ubuntu-latest
2125
env:
2226
SINGULARITY: 1
2327
steps:
2428
- name: Clone Github Repo Action
2529
uses: actions/checkout@v4
30+
- name: Get current LLVM submodule commit SHA
31+
id: get-llvm-sha
32+
run: echo "LLVM_SHA=$(git ls-tree HEAD ext/llvm-project | awk '{print $3}')" >> $GITHUB_ENV
33+
- name: Restore cache RISC-V JSON
34+
id: cache-riscv
35+
uses: actions/cache@v4
36+
with:
37+
path: ext/llvm-project/riscv.json
38+
key: ${{ runner.os }}-riscv-json-${{ env.LLVM_SHA }}
39+
restore-keys: |
40+
${{ runner.os }}-riscv-json-
2641
- name: singularity setup
2742
uses: ./.github/actions/singularity-setup
2843
- name: Run smoke
@@ -98,6 +113,54 @@ jobs:
98113
uses: ./.github/actions/singularity-setup
99114
- name: Generate extension PDF
100115
run: ./do gen:profile_release_pdf[Mock]
116+
build-llvm:
117+
runs-on: ubuntu-latest
118+
steps:
119+
- name: Check out repository (no submodules, shallow fetch)
120+
uses: actions/checkout@v4
121+
with:
122+
submodules: false
123+
fetch-depth: 1
124+
- name: Get current LLVM submodule commit SHA
125+
id: get-llvm-sha
126+
run: echo "LLVM_SHA=$(git ls-tree HEAD ext/llvm-project | awk '{print $3}')" >> $GITHUB_ENV
127+
- name: Cache RISC-V JSON
128+
id: cache-riscv
129+
uses: actions/cache@v4
130+
with:
131+
path: ext/llvm-project/riscv.json
132+
key: ${{ runner.os }}-riscv-json-${{ env.LLVM_SHA }}
133+
restore-keys: |
134+
${{ runner.os }}-riscv-json-
135+
- name: Initialize LLVM submodule (shallow + sparse)
136+
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
137+
run: |
138+
git submodule sync --recursive
139+
git submodule update --init --recursive --depth=1 ext/llvm-project
140+
141+
- name: Check for required directories and files
142+
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
143+
run: |
144+
ls -l ext/llvm-project/llvm/include
145+
ls -l ext/llvm-project/llvm/lib/Target/RISCV
146+
ls -l ext/llvm-project/llvm/lib/Target/RISCV/RISCV.td
147+
- name: Configure and build llvm-tblgen
148+
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
149+
run: |
150+
cmake -S ext/llvm-project/llvm -B ext/llvm-project/build -DCMAKE_BUILD_TYPE=Release
151+
cmake --build ext/llvm-project/build --target llvm-tblgen
152+
- name: Generate RISC-V JSON
153+
if: ${{ steps.cache-riscv.outputs.cache-hit != 'true' }}
154+
run: |
155+
chmod +x ./ext/llvm-project/build/bin/llvm-tblgen
156+
./ext/llvm-project/build/bin/llvm-tblgen \
157+
-I ext/llvm-project/llvm/include \
158+
-I ext/llvm-project/llvm/lib/Target/RISCV \
159+
ext/llvm-project/llvm/lib/Target/RISCV/RISCV.td \
160+
--dump-json \
161+
-o ext/llvm-project/riscv.json
162+
- name: Show riscv.json output
163+
run: ls -l ext/llvm-project/riscv.json
101164
regress-gen-go:
102165
runs-on: ubuntu-latest
103166
env:
@@ -109,3 +172,14 @@ jobs:
109172
uses: ./.github/actions/singularity-setup
110173
- name: Generate Go code
111174
run: ./do gen:go
175+
regress-cpp-unit:
176+
runs-on: ubuntu-latest
177+
env:
178+
SINGULARITY: 1
179+
steps:
180+
- name: Clone Github Repo Action
181+
uses: actions/checkout@v4
182+
- name: singularity setup
183+
uses: ./.github/actions/singularity-setup
184+
- name: Run cpp unit tests
185+
run: ./do test:cpp_hart CONFIG=rv64

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ gen
1616
node_modules
1717
_site
1818
images
19+
__pycache__/
20+
*.pyc
21+
.pytest_cache/
1922
*.bak
2023
*.log
2124
coverage

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
[submodule "ext/riscv-isa-manual"]
88
path = ext/riscv-isa-manual
99
url = https://github.com/riscv/riscv-isa-manual
10+
[submodule "ext/llvm-project"]
11+
path = ext/llvm-project
12+
url = https://github.com/llvm/llvm-project.git
13+
branch = main
1014
[submodule "ext/riscv-tests"]
1115
path = ext/riscv-tests
1216
url = https://github.com/riscv-software-src/riscv-tests.git

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ repos:
6464
- id: clang-format
6565
types_or: [c++, c]
6666
files: \.(hpp|cpp)$
67+
# TEMPORARILY DISABLE CLANG-FORMAT IN LIBHART
68+
# WIll RE-ENABLE WHEN NEXT PATCH COMES THROUGH
69+
exclude: backends/cpp_hart_gen
6770
- repo: https://github.com/psf/black-pre-commit-mirror
6871
rev: 25.1.0
6972
hooks:

Rakefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ namespace :serve do
157157
end
158158

159159
namespace :test do
160+
161+
# "Run the cross-validation against LLVM"
162+
task :llvm do
163+
begin
164+
sh "#{$root}/.home/.venv/bin/python3 -m pytest ext/auto-inst/test_parsing.py -v"
165+
rescue => e
166+
raise unless e.message.include?("status (5)") # don't fail on skipped tests
167+
end
168+
end
160169
# "Run the IDL compiler test suite"
161170
task :idl_compiler do
162171
t = Minitest::TestTask.new(:lib_test)
@@ -430,6 +439,8 @@ namespace :test do
430439
Rake::Task["test:idl"].invoke
431440
puts "UPDATE: Running test:inst_encodings"
432441
Rake::Task["test:inst_encodings"].invoke
442+
puts "UPDATE: Running test:llvm"
443+
Rake::Task["test:llvm"].invoke
433444
puts "UPDATE: Done test:smoke"
434445
end
435446

0 commit comments

Comments
 (0)