Skip to content

Commit eea0ba5

Browse files
authored
Merge branch 'main' into 88-add-exceptions-analysis-back-in-generators
Signed-off-by: dhower-qc <[email protected]>
2 parents eb0a71e + ce35896 commit eea0ba5

File tree

24 files changed

+553
-384
lines changed

24 files changed

+553
-384
lines changed

.github/workflows/regress.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,5 @@ jobs:
3131
run: ./bin/build_container
3232
- name: Setup project
3333
run: ./bin/setup
34-
- name: Run IDL tests
35-
run: ./do idl_test
36-
- name: Run validator
37-
run: ./do validate
38-
- name: Build html documentation for generic_rv64
39-
run: ./do gen:html[generic_rv64]
40-
- name: Build PDF documentation for MockCRD-1
41-
run: ./do gen:crd_pdf[MockCRD-1]
42-
- name: Build PDF documentation for MC-1
43-
run: ./do gen:crd_pdf[MC-1]
44-
- name: Build PDF documentation for RVA Profile Family
45-
run: ./do gen:profile_pdf[rva]
34+
- name: Run regression
35+
run: ./do regress

.yardopts

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ Quick start:
107107
== More info
108108

109109
* xref:arch/README.adoc[Architecture specification format]
110-
* xref:arch/README.adoc[Documentation for the generator tool and IDL]
111-
** https://riscv-software-src.github.io/riscv-unified-db/ruby/index.html[YARD docs for the generator tool and IDL]
110+
* xref:_site/ruby/arch_def/index.html[Ruby database object model documentation]
111+
* xref:_site/ruby/idl/index.html[IDL Compiler documentation]

Rakefile

Lines changed: 22 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ namespace :gen do
3131
desc "Generate documentation for the ruby tooling"
3232
task tool_doc: "#{$root}/.stamps/dev_gems" do
3333
Dir.chdir($root) do
34-
sh "bundle exec yard doc"
34+
sh "bundle exec yard doc --yardopts arch_def.yardopts"
35+
sh "bundle exec yard doc --yardopts idl.yardopts"
3536
end
3637
end
3738
end
@@ -97,71 +98,6 @@ namespace :validate do
9798

9899
arch_def_64.type_check
99100

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
165101
puts "All IDL passed type checking"
166102
end
167103
end
@@ -325,3 +261,23 @@ namespace :gen do
325261
end
326262
end
327263
end
264+
265+
desc <<~DESC
266+
Run the regression tests
267+
268+
These tests must pass before a commit will be allowed in the main branch on GitHub
269+
DESC
270+
task :regress do
271+
Rake::Task["idl_test"].invoke
272+
Rake::Task["validate"].invoke
273+
ENV["MANUAL_NAME"] = "isa"
274+
ENV["VERSIONS"] = "all"
275+
Rake::Task["gen:html_manual"].invoke
276+
Rake::Task["gen:html"].invoke("generic_rv64")
277+
Rake::Task["gen:crd_pdf"].invoke("MockCRD-1")
278+
Rake::Task["gen:crd_pdf"].invoke("MC-1")
279+
Rake::Task["gen:profile_pdf"].invoke("rva")
280+
281+
puts
282+
puts "Regression test PASSED"
283+
end

arch/ext/Sm.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,8 @@ Sm:
415415
TODO: GitHub issue 53
416416
schema:
417417
type: integer
418-
# GitHub issue 53
419-
# when:
420-
# version: ">= 1.12.0"
418+
when:
419+
version: ">= 1.12.0"
421420
PMA_GRANULARITY:
422421
description: |
423422
log2 of the smallest supported PMA region.

arch_def.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-o _site/ruby/arch_def --no-private --embed-mixins --readme 'lib/DB_MODEL.README.adoc' 'lib/arch_obj_models/*.rb' lib/arch_def.rb

backends/arch_gen/lib/arch_gen.rb

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,33 +129,39 @@ def ext?(name)
129129

130130
# checks any "extra_validation" given by parameter definitions
131131
def params_extra_validation
132-
fork do
133-
# add parameters as a constant
134-
params.each do |key, value|
135-
self.class.const_set(key, value)
136-
end
137132

138-
@implemented_extensions.each do |ext|
139-
ext_name = ext["name"]
140-
gen_ext_path = @gen_dir / "arch" / "ext" / "#{ext_name}.yaml"
141-
ext_yaml = YAML.safe_load gen_ext_path.read
142-
unless ext_yaml[ext_name]["params"].nil?
143-
ext_yaml[ext_name]["params"].each do |param_name, param_data|
144-
next unless param_data.key?("extra_validation")
145-
begin
146-
eval param_data["extra_validation"]
147-
rescue StandardError => e
148-
warn "While checking extension parameter #{ext_name}::#{param_name}.extra_validation"
149-
warn param_data["extra_validation"]
150-
warn e
151-
exit 1
152-
end
133+
agen = self
134+
135+
eval_context = Class.new do
136+
end
137+
138+
eval_context.class.define_method(:ext?) { |name| agen.send(:ext?, name) }
139+
eval_context.class.define_method(:assert) { |cond| agen.send(:assert, cond) }
140+
141+
# add parameters as a constant
142+
params.each do |key, value|
143+
eval_context.const_set(key, value)
144+
end
145+
146+
147+
@implemented_extensions.each do |ext|
148+
ext_name = ext["name"]
149+
gen_ext_path = @gen_dir / "arch" / "ext" / "#{ext_name}.yaml"
150+
ext_yaml = YAML.safe_load gen_ext_path.read
151+
unless ext_yaml[ext_name]["params"].nil?
152+
ext_yaml[ext_name]["params"].each do |param_name, param_data|
153+
next unless param_data.key?("extra_validation")
154+
begin
155+
eval_context.class_eval param_data["extra_validation"]
156+
rescue StandardError => e
157+
warn "While checking extension parameter #{ext_name}::#{param_name}.extra_validation"
158+
warn param_data["extra_validation"]
159+
warn e
160+
exit 1
153161
end
154162
end
155163
end
156164
end
157-
Process.wait
158-
exit 1 unless $CHILD_STATUS.success?
159165
end
160166
private :params_extra_validation
161167

0 commit comments

Comments
 (0)