Skip to content

Commit c8e0a93

Browse files
authored
Merge pull request #68 from riscv-software-src/crd-james
Partially-configured ArchDef, CRD development, extension names for Priv mode features
2 parents 00213d2 + c1d46f7 commit c8e0a93

File tree

419 files changed

+6327
-3365
lines changed

Some content is hidden

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

419 files changed

+6327
-3365
lines changed

.github/workflows/pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ jobs:
6262
- name: Copy RVA Family PDF
6363
run: cp gen/profile_doc/pdf/rva.pdf _site/pdfs/rva.pdf
6464
- name: Create MC-1 PDF Spec
65-
run: ./do gen:csc_crd_pdf[MC-1]
65+
run: ./do gen:crd_pdf[MC-1]
6666
- name: Copy MC-1 PDF
67-
run: cp gen/csc_crd_doc/pdf/MC-1.pdf _site/pdfs/MC-1.pdf
67+
run: cp gen/crd_doc/pdf/MC-1.pdf _site/pdfs/MC-1.pdf
6868
- name: Create MC-1 HTML Spec
69-
run: ./do gen:csc_crd_html[MC-1]
69+
run: ./do gen:crd_html[MC-1]
7070
- name: Copy MC-1 HTML
71-
run: cp gen/csc_crd_doc/html/MC-1.html _site/htmls/MC-1.html
71+
run: cp gen/crd_doc/html/MC-1.html _site/htmls/MC-1.html
7272
- name: Copy manual html
7373
run: cp -R gen/manual/isa/top/all/html _site/manual
7474
- name: Setup Pages

.github/workflows/regress.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
run: ./do validate
3838
- name: Build html documentation for generic_rv64
3939
run: ./do gen:html[generic_rv64]
40+
- name: Build PDF documentation for MockCRD-1
41+
run: ./do gen:crd_pdf[MockCRD-1]
4042
- name: Build PDF documentation for MC-1
41-
run: ./do gen:csc_crd_pdf[MC-1]
43+
run: ./do gen:crd_pdf[MC-1]
4244
- name: Build PDF documentation for RVA Profile Family
4345
run: ./do gen:profile_pdf[rva]

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ group :development do
2323
gem "solargraph"
2424
gem 'rubocop-minitest'
2525
gem 'ruby-prof'
26+
gem "ruby-prof-flamegraph"
2627
end

Gemfile.lock

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ GEM
107107
rubocop-minitest (0.35.1)
108108
rubocop (>= 1.61, < 2.0)
109109
rubocop-ast (>= 1.31.1, < 2.0)
110-
ruby-prof (1.7.0)
110+
ruby-prof (0.18.0)
111+
ruby-prof-flamegraph (0.3.0)
112+
ruby-prof (~> 0.13)
111113
ruby-progressbar (1.13.0)
112114
ruby-rc4 (0.1.5)
113115
simpleidn (0.2.3)
@@ -152,6 +154,7 @@ DEPENDENCIES
152154
rouge
153155
rubocop-minitest
154156
ruby-prof
157+
ruby-prof-flamegraph
155158
ruby-progressbar (~> 1.13)
156159
solargraph
157160
treetop (= 1.6.12)

Rakefile

Lines changed: 80 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require "etc"
4+
35
$root = Pathname.new(__FILE__).dirname.realpath
46
$lib = $root / "lib"
57

@@ -82,45 +84,84 @@ namespace :validate do
8284
end
8385
puts "All files validate against their schema"
8486
end
85-
task idl: "gen:arch" do
86-
puts "Type checking IDL code..."
87-
arch_def = arch_def_for("_")
88-
progressbar = ProgressBar.create(title: "Instructions", total: arch_def.instructions.size)
89-
arch_def.instructions.each do |inst|
90-
progressbar.increment
91-
inst.type_checked_operation_ast(arch_def.idl_compiler, arch_def.sym_table_32, 32) if inst.rv32?
92-
inst.type_checked_operation_ast(arch_def.idl_compiler, arch_def.sym_table_64, 64) if inst.rv64?
93-
# also need to check for an RV64 machine running with effective XLEN of 32
94-
inst.type_checked_operation_ast(arch_def.idl_compiler, arch_def.sym_table_64, 32) if inst.rv64? && inst.rv32?
95-
end
96-
progressbar = ProgressBar.create(title: "CSRs", total: arch_def.csrs.size)
97-
arch_def.csrs.each do |csr|
98-
progressbar.increment
99-
if csr.has_custom_sw_read?
100-
csr.type_checked_sw_read_ast(arch_def.sym_table_32) if csr.defined_in_base32?
101-
csr.type_checked_sw_read_ast(arch_def.sym_table_64) if csr.defined_in_base64?
102-
end
103-
csr.fields.each do |field|
104-
unless field.type_ast(arch_def.idl_compiler).nil?
105-
field.type_checked_type_ast(arch_def.sym_table_32) if csr.defined_in_base32? && field.defined_in_base32?
106-
field.type_checked_type_ast(arch_def.sym_table_64) if csr.defined_in_base64? && field.defined_in_base64?
107-
end
108-
unless field.reset_value_ast(arch_def.idl_compiler).nil?
109-
field.type_checked_reset_value_ast(arch_def.sym_table_32) if csr.defined_in_base32? && field.defined_in_base32?
110-
field.type_checked_reset_value_ast(arch_def.sym_table_64) if csr.defined_in_base64? && field.defined_in_base64?
111-
end
112-
unless field.sw_write_ast(arch_def.idl_compiler).nil?
113-
field.type_checked_sw_write_ast(arch_def.sym_table_32, 32) if csr.defined_in_base32? && field.defined_in_base32?
114-
field.type_checked_sw_write_ast(arch_def.sym_table_64, 64) if csr.defined_in_base64? && field.defined_in_base64?
115-
end
116-
end
117-
end
118-
progressbar = ProgressBar.create(title: "Functions", total: arch_def.functions.size)
119-
arch_def.functions.each do |func|
120-
progressbar.increment
121-
func.type_check_body(arch_def.sym_table_32)
122-
func.type_check_body(arch_def.sym_table_64)
123-
end
87+
task idl: ["gen:arch", "#{$root}/.stamps/arch-gen-_32.stamp", "#{$root}/.stamps/arch-gen-_64.stamp"] do
88+
print "Parsing IDL code for RV32..."
89+
arch_def_32 = arch_def_for("_32")
90+
puts "done"
91+
92+
arch_def_32.type_check
93+
94+
print "Parsing IDL code for RV64..."
95+
arch_def_64 = arch_def_for("_64")
96+
puts "done"
97+
98+
arch_def_64.type_check
99+
100+
# arch_def_64 = arch_def_for("_64")
101+
# arch_def_64.type_check
102+
103+
# puts "Type checking IDL code..."
104+
# progressbar = ProgressBar.create(title: "Instructions", total: arch_def_32.instructions.size + arch_def_64.instructions.size)
105+
# arch_def_32.instructions.each do |inst|
106+
# progressbar.increment
107+
# inst.type_checked_operation_ast(arch_def_32.idl_compiler, arch_def_32.symtab, 32) if inst.rv32?
108+
# end
109+
# arch_def_64.instructions.each do |inst|
110+
# progressbar.increment
111+
# inst.type_checked_operation_ast(arch_def_64.idl_compiler, arch_def_64.symtab, 64) if inst.rv64?
112+
# # also need to check for an RV64 machine running with effective XLEN of 32
113+
# inst.type_checked_operation_ast(arch_def_64.idl_compiler, arch_def_64.symtab, 32) if inst.rv64? && inst.rv32?
114+
# end
115+
116+
# progressbar = ProgressBar.create(title: "CSRs", total: arch_def_32.csrs.size + arch_def_64.csrs.size)
117+
# arch_def_32.csrs.each do |csr|
118+
# progressbar.increment
119+
# profile = RubyProf::Profile.new
120+
# result = profile.profile do
121+
# if csr.has_custom_sw_read?
122+
# csr.type_checked_sw_read_ast(arch_def_32.symtab) if csr.defined_in_base32?
123+
# end
124+
# csr.fields.each do |field|
125+
# unless field.type_ast(arch_def_32.symtab).nil?
126+
# field.type_checked_type_ast(arch_def_32.symtab) if csr.defined_in_base32? && field.defined_in_base32?
127+
# end
128+
# unless field.reset_value_ast(arch_def_32.symtab).nil?
129+
# field.type_checked_reset_value_ast(arch_def_32.symtab) if csr.defined_in_base32? && field.defined_in_base32?
130+
# end
131+
# unless field.sw_write_ast(arch_def_32.symtab).nil?
132+
# field.type_checked_sw_write_ast(arch_def_32.symtab, 32) if csr.defined_in_base32? && field.defined_in_base32?
133+
# end
134+
# end
135+
# end
136+
# RubyProf::GraphHtmlPrinter.new(result).print(File.open("#{csr.name}-prof.html", "w+"), {})
137+
# end
138+
# arch_def_64.csrs.each do |csr|
139+
# progressbar.increment
140+
# if csr.has_custom_sw_read?
141+
# csr.type_checked_sw_read_ast(arch_def_64.symtab) if csr.defined_in_base64?
142+
# end
143+
# csr.fields.each do |field|
144+
# unless field.type_ast(arch_def_64.symtab).nil?
145+
# field.type_checked_type_ast(arch_def_64.symtab) if csr.defined_in_base64? && field.defined_in_base64?
146+
# end
147+
# unless field.reset_value_ast(arch_def_64.symtab).nil?
148+
# field.type_checked_reset_value_ast(arch_def_64.symtab) if csr.defined_in_base64? && field.defined_in_base64?
149+
# end
150+
# unless field.sw_write_ast(arch_def_64.symtab).nil?
151+
# field.type_checked_sw_write_ast(arch_def_64.symtab, 32) if csr.defined_in_base32? && field.defined_in_base32?
152+
# field.type_checked_sw_write_ast(arch_def_64.symtab, 64) if csr.defined_in_base64? && field.defined_in_base64?
153+
# end
154+
# end
155+
# end
156+
# progressbar = ProgressBar.create(title: "Functions", total: arch_def_32.functions.size + arch_def_64.functions.size)
157+
# arch_def_32.functions.each do |func|
158+
# progressbar.increment
159+
# func.type_check(arch_def_32.symtab)
160+
# end
161+
# arch_def_64.functions.each do |func|
162+
# progressbar.increment
163+
# func.type_check(arch_def_64.symtab)
164+
# end
124165
puts "All IDL passed type checking"
125166
end
126167
end

arch/csc_crd/MC-1.yaml renamed to arch/crd/MC-1.yaml

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -29,71 +29,56 @@ MC-1:
2929

3030
# XXX - Remove version information since specifying priv/unpriv ISA manual should imply this.
3131
extensions:
32-
mandatory:
33-
- name: I
34-
version: "~> 2.1"
35-
- name: C
36-
version: "~> 2.2"
37-
param_constraints:
38-
MUTABLE_MISA_C:
39-
schema:
40-
const: false
41-
- name: M
42-
version: "~> 2.0"
43-
- name: Zicsr
44-
version: "~> 2.0"
45-
- name: Zicntr
46-
version: "~> 2.0"
47-
- name: Sm
48-
version: "~> 1.11"
49-
param_constraints:
50-
MTVEC_BASE_ALIGNMENT_DIRECT: {} # Unconstrained
51-
MTVEC_BASE_ALIGNMENT_VECTORED: {} # Unconstrained
52-
ARCH_ID: {} # Unconstrained
53-
IMP_ID: {} # Unconstrained
54-
VENDOR_ID_BANK: {} # Unconstrained
55-
VENDOR_ID_OFFSET: {} # Unconstrained
56-
MISA_CSR_IMPLEMENTED: {} # Unconstrained
57-
TIME_CSR_IMPLEMENTED: {} # Unconstrained
58-
MTVAL_WIDTH: {} # Unconstrained
59-
PHYS_ADDR_WIDTH: {} # Unconstrained
60-
PRECISE_SYNCHRONOUS_EXCEPTIONS:
61-
schema:
62-
const: true
63-
TRAP_ON_ECALL_FROM_M:
64-
schema:
65-
const: true
66-
TRAP_ON_EBREAK:
67-
schema:
68-
const: true
69-
REPORT_VA_IN_MTVAL_ON_BREAKPOINT:
70-
schema:
71-
const: true
72-
REPORT_VA_IN_MTVAL_ON_INSTRUCTION_ACCESS_FAULT:
73-
schema:
74-
const: true
75-
REPORT_VA_IN_MTVAL_ON_LOAD_ACCESS_FAULT:
76-
schema:
77-
const: true
78-
REPORT_VA_IN_MTVAL_ON_STORE_AMO_ACCESS_FAULT:
79-
schema:
80-
const: true
81-
REPORT_ENCODING_IN_MTVAL_ON_ILLEGAL_INSTRUCTION:
82-
schema:
83-
const: true
84-
M_MODE_ENDIANESS:
85-
schema:
86-
const: little
87-
XLEN:
88-
schema:
89-
const: 32
90-
CONFIG_PTR_ADDRESS:
91-
schema:
92-
const: 0
93-
#XXX optional: {} # None
94-
optional:
95-
- name: Zifencei
96-
note: "This is just for testing. Zifencei extension isn't really optional for MC-1."
32+
- name: I
33+
version: "~> 2.1"
34+
presence: mandatory
35+
- name: C
36+
version: "~> 2.2"
37+
presence: mandatory
38+
- name: M
39+
version: "~> 2.0"
40+
presence: mandatory
41+
- name: Zicsr
42+
version: "~> 2.0"
43+
presence: mandatory
44+
- name: Zicntr
45+
version: "~> 2.0"
46+
presence: mandatory
47+
parameters:
48+
TIME_CSR_IMPLEMENTED: {} # Unconstrained
49+
- name: Sm
50+
version: "~> 1.11"
51+
presence: mandatory
52+
parameters:
53+
MTVEC_BASE_ALIGNMENT_DIRECT: {} # Unconstrained
54+
MTVEC_BASE_ALIGNMENT_VECTORED: {} # Unconstrained
55+
ARCH_ID: {} # Unconstrained
56+
IMP_ID: {} # Unconstrained
57+
VENDOR_ID_BANK: {} # Unconstrained
58+
VENDOR_ID_OFFSET: {} # Unconstrained
59+
MISA_CSR_IMPLEMENTED: {} # Unconstrained
60+
MTVAL_WIDTH: {} # Unconstrained
61+
MTVEC_MODES: {} # Unconstrained
62+
PHYS_ADDR_WIDTH: {} # Unconstrained
63+
CONFIG_PTR_ADDRESS:
64+
schema:
65+
const: 0xdeadbeef
66+
note: "This parameter and its associated CSR shouldn't be here. See GitHub issue #53."
67+
PRECISE_SYNCHRONOUS_EXCEPTIONS:
68+
schema:
69+
const: true
70+
TRAP_ON_ECALL_FROM_M:
71+
schema:
72+
const: true
73+
TRAP_ON_EBREAK:
74+
schema:
75+
const: true
76+
M_MODE_ENDIANESS:
77+
schema:
78+
const: little
79+
XLEN:
80+
schema:
81+
const: 32
9782

9883
requirement_groups:
9984
- name: MC-Unpriv

0 commit comments

Comments
 (0)