Skip to content

Commit

Permalink
Merge pull request #341 from riscv-software-src/332-create-better-pro…
Browse files Browse the repository at this point in the history
…file-comparisons

332 create better profile comparisons
  • Loading branch information
dhower-qc authored Dec 19, 2024
2 parents bc5ec90 + afcc7f8 commit 8d22fe2
Show file tree
Hide file tree
Showing 26 changed files with 303 additions and 162 deletions.
94 changes: 53 additions & 41 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,45 +338,57 @@ namespace :test do
end
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
desc <<~DESC
Generate all portfolio-based PDFs (certificates and profiles).
DESC
task :portfolio_pdfs do
puts ""
puts "==================================="
puts "Generating MC100"
puts "==================================="
puts ""
Rake::Task["#{$root}/gen/certificate_doc/pdf/MC100.pdf"].invoke

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

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

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

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

puts ""
puts "==================================="
puts "Generating MockProfileRelease"
puts "==================================="
puts ""
Rake::Task["#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"].invoke
end

# Shortcut targets for building profiles and certificates.
task MC100: "#{$root}/gen/certificate_doc/pdf/MC100.pdf"
task MockCertificateModel: "#{$root}/gen/certificate_doc/pdf/MockCertificateModel.pdf"
task RVI20: "#{$root}/gen/profile_doc/pdf/RVI20.pdf"
task RVA20: "#{$root}/gen/profile_doc/pdf/RVA20.pdf"
task RVA22: "#{$root}/gen/profile_doc/pdf/RVA22.pdf"
task MockProfileRelease: "#{$root}/gen/profile_doc/pdf/MockProfileRelease.pdf"
3 changes: 2 additions & 1 deletion arch/csr/menvcfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ name: menvcfg
address: 0x30A
long_name: Machine Environment Configuration
description: |
Contains bits to enable/disable extensions
Contains fields that control certain characteristics of the execution environment
for modes less privileged than M-mode.
The `menvcfg` CSR controls
certain characteristics of the execution environment for modes less
Expand Down
7 changes: 4 additions & 3 deletions arch/csr/senvcfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ kind: csr
name: senvcfg
address: 0x10A
long_name: Supervisor Environment Configuration
description: Contains bits to enable/disable extensions
description: |
Contains fields that control certain characteristics of the U-mode execution environment.
priv_mode: S
length: 64
definedBy:
allOf:
- name: Sm
version: ">=1.12"
- name: S
version: ">=1.12"
- name: U
fields:
CBZE:
location: 7
Expand Down
18 changes: 12 additions & 6 deletions arch/ext/S.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ name: S
type: privileged
long_name: Supervisor mode
versions:
- version: "1.12.0"
state: ratified
ratification_date: 2021-12
requires:
name: U
version: "= 1.12.0"
- version: "1.11.0"
state: ratified
ratification_date: 2019-06
requires:
name: U
version: "= 1.0.0"
- version: "1.12.0"
state: ratified
ratification_date: 2021-12
requires:
name: U
version: "= 1.0.0"
description: |
This chapter describes the RISC-V supervisor-level architecture, which
contains a common core that is used with various supervisor-level
Expand Down
1 change: 1 addition & 0 deletions arch/ext/Sm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ params:
schema:
type: string
enum: [little, big, dynamic]
# TODO: Only little available in Sm 1.11
MISA_CSR_IMPLEMENTED:
description: |
Whether or not the `misa` CSR returns zero or a non-zero value.
Expand Down
4 changes: 2 additions & 2 deletions arch/ext/Sstc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
$schema: "ext_schema.json#"
kind: extension
name: Sstc
long_name: Superivisor mode timer interrupts
description: Superivisor mode timer interrupts
long_name: Supervisor-mode timer interrupts
description: Supervisor-mode timer interrupts
type: privileged
versions:
- version: "0.9.0"
Expand Down
2 changes: 1 addition & 1 deletion arch/ext/Sv32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ type: privileged
versions:
- version: "1.12.0"
state: ratified
ratification_date: unknown
ratification_date: null
url: https://github.com/riscv/riscv-isa-manual/releases/download/Priv-v1.12/riscv-privileged-20211203.pdf
2 changes: 1 addition & 1 deletion arch/ext/Sv39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ type: privileged
versions:
- version: "1.12.0"
state: ratified
ratification_date: unknown
ratification_date: null
url: https://github.com/riscv/riscv-isa-manual/releases/download/Priv-v1.12/riscv-privileged-20211203.pdf
2 changes: 1 addition & 1 deletion arch/ext/Sv48.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type: privileged
versions:
- version: "1.12.0"
state: ratified
ratification_date: unknown
ratification_date: null
url: https://github.com/riscv/riscv-isa-manual/releases/download/Priv-v1.12/riscv-privileged-20211203.pdf
requires:
name: Sv39
Expand Down
2 changes: 1 addition & 1 deletion arch/ext/Sv57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type: privileged
versions:
- version: "1.12.0"
state: ratified
ratification_date: unknown
ratification_date: null
url: https://github.com/riscv/riscv-isa-manual/releases/download/Priv-v1.12/riscv-privileged-20211203.pdf
requires:
name: Sv48
Expand Down
12 changes: 7 additions & 5 deletions arch/ext/U.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
$schema: "ext_schema.json#"
kind: extension
name: U
long_name: User-level privilege mode
description: User-level privilege mode
long_name: User-mode privilege level
description: |
User-mode privilege level is supported by an implementation if the U extension is present.
Note that the RISC-V ISA doens't formally define a U extension and it is only discussed in the Privileged ISA manual.
type: privileged
versions:
- version: "1.12.0"
state: ratified
ratification_date: 2019-12
- version: "1.0.0"
state: ratified
ratification_date: 2019-12
params:
MUTABLE_MISA_U:
description: |
Expand Down
2 changes: 1 addition & 1 deletion arch/ext/Zihpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ type: unprivileged
versions:
- version: "2.0.0"
state: ratified
ratification_date: unknown
ratification_date: null
requires:
name: Smhpm
3 changes: 3 additions & 0 deletions arch/profile/MP-S-64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ extensions:
optional: transitory
version: "= 1.11"
note: Made this a transitory option
Xmock:
presence: mandatory
version: "~> 0.9.9"
extra_notes:
- presence: mandatory
text: |
Expand Down
7 changes: 7 additions & 0 deletions arch/profile/RVA20S64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ introduction: |
processors. RVA20S64 is based on privileged architecture version 1.11.
extensions:
$inherits: "profile/RVI20U64.yaml#/extensions"
U:
presence: mandatory
version: "~> 1.0"
param_constraints:
U_MODE_ENDIANESS:
schema:
const: little``
S:
presence: mandatory
version: "= 1.11"
Expand Down
13 changes: 8 additions & 5 deletions backends/certificate_doc/tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ Dir.glob("#{$root}/arch/certificate_model/*.yaml") do |f|
__FILE__
] do |t|
# TODO: schema validation
cfg_arch = cfg_arch_for("rv#{base}")
cert_model = cfg_arch.cert_model(cert_model_name)
raise "No certificate model defined for #{cert_model_name}" if cert_model.nil?
base_cert_model = cfg_arch_for("rv#{base}").cert_model(cert_model_name)
raise "No certificate model named '#{cert_model_name}'" if base_cert_model.nil?

# Switch to the generated certificate arch def
# Ask base certification model to create an in-memory config arch for this model.
# XXX - Add this to profile releases
cfg_arch = cert_model.to_cfg_arch
cfg_arch = base_cert_model.to_cfg_arch

# Set globals for ERB template.
cert_model = cfg_arch.cert_model(cert_model_name)
cert_class = cert_model.cert_class
portfolio = cert_model
portfolio_class = cert_class

version = File.basename(t.name, '.adoc').split('-')[1..].join('-')

Expand Down
14 changes: 2 additions & 12 deletions backends/certificate_doc/templates/certificate.adoc.erb
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,11 @@ None
== Instruction Summary
<%
insts = cert_model.in_scope_extensions.map { |ext_cert_model| ext_cert_model.instructions }.flatten.uniq
insts.sort_by!(&:name)
-%>

[%autowidth]
|===
| Name | Long Name
<% insts.each do |inst| -%>
<% portfolio.in_scope_instructions.each do |inst| -%>
| <%= link_to_inst(inst.name) %>
| <%= inst.long_name %>
<% end # do -%>
Expand Down Expand Up @@ -387,12 +382,7 @@ The following instructions are added by this extension:
[appendix]
== Instruction Details
<%=
insts = cert_model.in_scope_extensions.map { |ext_cert_model| ext_cert_model.instructions }.flatten.uniq
insts.sort_by!(&:name)
-%>

<% insts.each do |inst| -%>
<% portfolio.in_scope_instructions.each do |inst| -%>
<<<
<%= anchor_for_inst(inst.name) %>
=== <%= inst.name %>
Expand Down
4 changes: 3 additions & 1 deletion backends/profile_doc/tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ rule %r{#{$root}/gen/profile_doc/adoc/.*\.adoc} => [
Dir.glob("#{$root}/arch/profile_release/**/*.yaml")
].flatten do |t|
profile_release_name = Pathname.new(t.name).basename(".adoc").to_s

profile_release = cfg_arch_for("_").profile_release(profile_release_name)
raise ArgumentError, "No profile release named '#{profile_release_name}'" if profile_release.nil?

# Set globals for ERB template.
profile_class = profile_release.profile_class
portfolio_class = profile_class
portfolio = profile_release

template_path = Pathname.new "#{$root}/backends/profile_doc/templates/profile.adoc.erb"
erb = ERB.new(template_path.read, trim_mode: "-")
Expand Down
Loading

0 comments on commit 8d22fe2

Please sign in to comment.