Skip to content

Commit 4bf59f7

Browse files
authored
Many updates: (#4)
* Many updates: * Added pruning pass to remove dead/unreachable code * Added backend to generate an extension-specific document * Removed dependence on riscv-opcodes; all instruction .yaml files have their encoding now * Updated schema to be more version-centric with extensions * Started process of refactoring so that AstNodes don't have any irrelevant SyntaxNodes * Added some unit tests for the IDL compiler * Numerous bug fixes
1 parent 7be4248 commit 4bf59f7

File tree

342 files changed

+35091
-14390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+35091
-14390
lines changed

.github/workflows/regress.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ jobs:
3131
run: ./bin/build_container
3232
- name: Setup project
3333
run: ./bin/setup
34+
- name: Run IDL tests
35+
run: ./do idl_test
3436
- name: Build html documentation for generic_rv64
3537
run: ./do gen:html[generic_rv64]

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require: rubocop-minitest
2+
13
AllCops:
24
TargetRubyVersion: 3.2.3
35

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ source "https://rubygems.org"
66

77
gem "asciidoctor-diagram", "~> 2.2"
88
gem "asciidoctor-multipage"
9+
gem "asciidoctor-pdf"
910
gem "base64"
1011
gem "bigdecimal"
1112
gem "json_schemer", "~> 1.0"
13+
gem "minitest"
1214
gem "rake", "~> 13.0"
1315
gem "slim", "~> 5.1"
1416
gem "treetop", "1.6.12"
@@ -17,4 +19,5 @@ gem "yard"
1719

1820
group :development do
1921
gem "solargraph"
22+
gem 'rubocop-minitest'
2023
end

Gemfile.lock

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
Ascii85 (1.1.1)
5+
addressable (2.8.7)
6+
public_suffix (>= 2.0.2, < 7.0)
7+
afm (0.2.2)
48
asciidoctor (2.0.23)
59
asciidoctor-diagram (2.3.0)
610
asciidoctor (>= 1.5.7, < 3.x)
@@ -13,14 +17,28 @@ GEM
1317
asciidoctor-diagram-batik (~> 1.17)
1418
asciidoctor-multipage (0.0.19)
1519
asciidoctor (>= 2.0.11, < 2.1)
20+
asciidoctor-pdf (2.3.14)
21+
asciidoctor (~> 2.0)
22+
concurrent-ruby (~> 1.1)
23+
matrix (~> 0.4)
24+
prawn (~> 2.4.0)
25+
prawn-icon (~> 3.0.0)
26+
prawn-svg (~> 0.34.0)
27+
prawn-table (~> 0.2.0)
28+
prawn-templates (~> 0.1.0)
29+
treetop (~> 1.6.0)
1630
ast (2.4.2)
1731
backport (1.2.0)
1832
base64 (0.2.0)
1933
benchmark (0.3.0)
2034
bigdecimal (3.1.8)
35+
concurrent-ruby (1.3.3)
36+
css_parser (1.17.1)
37+
addressable
2138
diff-lcs (1.5.1)
2239
e2mmap (0.1.0)
2340
hana (1.3.7)
41+
hashery (2.1.2)
2442
jaro_winkler (1.6.0)
2543
json (2.7.2)
2644
json_schemer (1.0.3)
@@ -32,13 +50,38 @@ GEM
3250
kramdown-parser-gfm (1.1.0)
3351
kramdown (~> 2.0)
3452
language_server-protocol (3.17.0.3)
53+
matrix (0.4.2)
54+
minitest (5.24.1)
3555
nokogiri (1.16.5-x86_64-linux)
3656
racc (~> 1.4)
3757
parallel (1.24.0)
3858
parser (3.3.2.0)
3959
ast (~> 2.4.1)
4060
racc
61+
pdf-core (0.9.0)
62+
pdf-reader (2.12.0)
63+
Ascii85 (~> 1.0)
64+
afm (~> 0.2.1)
65+
hashery (~> 2.0)
66+
ruby-rc4
67+
ttfunk
4168
polyglot (0.3.5)
69+
prawn (2.4.0)
70+
pdf-core (~> 0.9.0)
71+
ttfunk (~> 1.7)
72+
prawn-icon (3.0.0)
73+
prawn (>= 1.1.0, < 3.0.0)
74+
prawn-svg (0.34.2)
75+
css_parser (~> 1.6)
76+
matrix (~> 0.4.2)
77+
prawn (>= 0.11.1, < 3)
78+
rexml (~> 3.2)
79+
prawn-table (0.2.2)
80+
prawn (>= 1.3.0, < 3.0.0)
81+
prawn-templates (0.1.2)
82+
pdf-reader (~> 2.0)
83+
prawn (~> 2.2)
84+
public_suffix (6.0.0)
4285
racc (1.8.0)
4386
rainbow (3.1.1)
4487
rake (13.2.1)
@@ -61,7 +104,11 @@ GEM
61104
unicode-display_width (>= 2.4.0, < 3.0)
62105
rubocop-ast (1.31.3)
63106
parser (>= 3.3.1.0)
107+
rubocop-minitest (0.35.1)
108+
rubocop (>= 1.61, < 2.0)
109+
rubocop-ast (>= 1.31.1, < 2.0)
64110
ruby-progressbar (1.13.0)
111+
ruby-rc4 (0.1.5)
65112
simpleidn (0.2.3)
66113
slim (5.2.1)
67114
temple (~> 0.10.0)
@@ -88,6 +135,8 @@ GEM
88135
tilt (2.3.0)
89136
treetop (1.6.12)
90137
polyglot (~> 0.3)
138+
ttfunk (1.8.0)
139+
bigdecimal (~> 3.1)
91140
unicode-display_width (2.5.0)
92141
webrick (1.8.1)
93142
yard (0.9.36)
@@ -98,10 +147,13 @@ PLATFORMS
98147
DEPENDENCIES
99148
asciidoctor-diagram (~> 2.2)
100149
asciidoctor-multipage
150+
asciidoctor-pdf
101151
base64
102152
bigdecimal
103153
json_schemer (~> 1.0)
154+
minitest
104155
rake (~> 13.0)
156+
rubocop-minitest
105157
slim (~> 5.1)
106158
solargraph
107159
treetop (= 1.6.12)

arch/csr/mtval.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mtval:
2222
! [1] Instruction access fault ! The <% if ext?(:C) %> portion of the <% end %> virtual PC causing the access fault <%- unless ext?(:C) -%>(same as the value written to `mepc`)<%- end -%>.
2323
! [2] Illegal Instruction ! The encoding of the illegal instruction.
2424
! [3] Breakpoint
25-
! <%- if REPORT_EBREAK_PC_IN_TVAL -%>
25+
! <%- if REPORT_VA_IN_MTVAL_ON_BREAKPOINT -%>
2626
When caused by an EBREAK instruction, the virtual PC of the breakpoint instruction.
2727
<%- else -%>
2828
When caused by an EBREAK instruction, zero.

arch/csr/stval.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ stval:
2222
! [1] Instruction access fault ! The <% if ext?(:C) %> portion of the <% end %> virtual PC causing the access fault <%- unless ext?(:C) -%>(same as the value written to `mepc`)<%- end -%>.
2323
! [2] Illegal Instruction ! The encoding of the illegal instruction.
2424
! [3] Breakpoint
25-
! <%- if REPORT_EBREAK_PC_IN_TVAL -%>
25+
! <%- if REPORT_VA_IN_STVAL_ON_BREAKPOINT -%>
2626
When caused by an EBREAK instruction, the virtual PC of the breakpoint instruction.
2727
<%- else -%>
2828
When caused by an EBREAK instruction, zero.

arch/csr/vstval.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# yaml-language-server: $schema=../../schemas/csr_schema.json
2+
3+
vstval:
4+
long_name: Virtual supervisor Trap Value
5+
address: 0x243
6+
virtual_address: 0x143
7+
description: Holds trap-specific information
8+
priv_mode: S
9+
length: VSXLEN
10+
definedBy: H
11+
fields:
12+
VALUE:
13+
location_rv32: 31-0
14+
location_rv64: 63-0
15+
description: |
16+
Written with trap-specific information when a trap is taken into VS-mode.
17+
18+
The values are:
19+
20+
!===
21+
! Exception type ! Value
22+
23+
! [0] Instruction address misaligned ! The misaligned virtual PC (same as the value written to `mepc`).
24+
! [1] Instruction access fault ! The <% if ext?(:C) %> portion of the <% end %> virtual PC causing the access fault <%- unless ext?(:C) -%>(same as the value written to `mepc`)<%- end -%>.
25+
! [2] Illegal Instruction ! The encoding of the illegal instruction.
26+
! [3] Breakpoint
27+
! <%- if REPORT_VA_IN_STVAL_ON_BREAKPOINT -%>
28+
When caused by an EBREAK instruction, the virtual PC of the breakpoint instruction.
29+
<%- else -%>
30+
When caused by an EBREAK instruction, zero.
31+
<%- end -%>
32+
33+
When caused by a data address (_i.e._, watchpoint) breakpoint, the faulting virtual address.
34+
When caused by an instruction address breakpoint, the faulting virtual PC.
35+
! [4] Load address misaligned ! The misaligned virtual load address.
36+
! [5] Load access fault
37+
! The part of virtual load address causing in the access fault.
38+
39+
When the load is misaligned, the reported value is the smallest address on the page causing a fault
40+
(_e.g._, if an 8-byte load is equally split across a page and the fault occurs on the second page,
41+
address + 4 is reported).
42+
43+
(Even though the access fault arises on a physical address, the virtual address is reported)
44+
! [6] Store/AMO address misaligned ! The misaligned virtual store/AMO address.
45+
! [7] Store/AMO access fault
46+
! The virtual store/AMO address causing the access fault.
47+
48+
When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault
49+
(_e.g._, if an 8-byte store is equally split across a page and the fault occurs on the second page,
50+
address + 4 is reported).
51+
52+
(Even though the access fault arises on a physical address, the virtual address is reported)
53+
! [8] Environment call from U-mode <% if ext?(:H) %>or VU-mode<% end %> ! Zero
54+
! [9] Environment call from (H)S-mode ! Zero
55+
<%- if ext?(:H) -%>
56+
! [10] Environment call from VS-mode ! Zero
57+
<%- end -%>
58+
! [12] Instruction page fault
59+
! The <% if ext?(:C) %> portion of the <% end %> virtual PC causing the page fault
60+
<% unless ext?(:C) %>(same as the value written to `mepc`)<% end %>.
61+
! [13] Load page fault
62+
! The part of the virtual load address causing in the page fault.
63+
64+
When the load is misaligned, the reported value is the smallest address on the page causing a fault
65+
(_e.g._, if an 8-byte load is equally split across a page and the fault occurs on the second page, address + 4 is reported).
66+
! [15] Store/AMO page fault
67+
! The virtual store/AMO address causing in the page fault.
68+
69+
When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault
70+
(_e.g._, if an 8-byte store is equally split across a page and the fault occurs on the second page, address + 4 is reported).
71+
<%- if ext?(:H) -%>
72+
! [20] Instruction guest-page fault
73+
! The <% if ext?(:C) %> portion of the <% end %> virtual PC causing the fault <% unless ext?(:C) %>(same as the value written to `mepc`)<% end %>.
74+
75+
The guest physical address is reported in `mtval2`.
76+
! [21] Load guest-page fault
77+
! The part of the virtual address causing the fault.
78+
79+
When the load is misaligned, the reported value is the smallest address on the page causing a fault
80+
(_e.g._, if an 8-byte load is equally split across a page and the fault occurs on the second page, address + 4 is reported).
81+
82+
The guest physical address is reported in `mtval2`.
83+
! [22] Virutal instruction
84+
! The encoding of the faulting virtual instruction.
85+
! [23] Store/AMO guest-page fault
86+
! The part of the virtual address causing the fault.
87+
88+
When the store/AMO is misaligned, the reported value is the smallest address on the page causing a fault
89+
(_e.g._, if an 8-byte store is equally split across a page and the fault occurs on the second page, address + 4 is reported).
90+
91+
The guest physical address is reported in `htval`.
92+
<%- end -%>
93+
!===
94+
95+
type: RW-H
96+
reset_value: 0

arch/ext/A.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A:
44
type: unprivileged
55
versions:
66
- version: 2.1
7+
state: ratified
78
ratification_date: 2019-12
89
implies:
910
- [Zaamo, 1.0]

arch/ext/B.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ B:
44
type: unprivileged
55
versions:
66
- version: 1.0
7+
state: ratified
78
ratification_date: 2024-04
89
url: https://drive.google.com/file/d/1SgLoasaBjs5WboQMaU3wpHkjUwV71UZn/view
910
implies:

arch/ext/C.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ C:
44
type: unprivileged
55
versions:
66
- version: 2.2
7+
state: ratified
78
ratification_date: 2019-12
89
description: |
910
The `C` extension reduces static and dynamic code size by

0 commit comments

Comments
 (0)