Skip to content

Commit f6dc761

Browse files
Change raise to puts
1 parent a962e90 commit f6dc761

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

backends/certificate_doc/tasks.rake

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@ Dir.glob("#{$root}/arch/certificate_model/*.yaml") do |f|
2424
"#{CERT_DOC_DIR}/templates/certificate.adoc.erb",
2525
__FILE__
2626
] do |t|
27+
puts "UPDATE: Creating bootstrap objects for #{cert_model_name}"
28+
2729
# Create bootstrap ConfiguredArchitecture object which also creates and contains
2830
# a PartialConfig object for the rv32/rv64 configuration.
29-
base_cfg_arch = cfg_arch_for("rv#{base}")
31+
bootstrap_cfg_arch = cfg_arch_for("rv#{base}")
3032

31-
# Creates CertModel object for every certificate model in database
33+
# Creates CertModel object for every certificate model in the database
3234
# using rv32/rv64 PartialConfig object and then returns named CertModel object.
33-
base_cert_model = base_cfg_arch.cert_model(cert_model_name)
34-
raise "No certificate model named '#{cert_model_name}'" if base_cert_model.nil?
35+
bootstrap_cert_model = bootstrap_cfg_arch.cert_model(cert_model_name)
36+
raise "No certificate model named '#{cert_model_name}'" if bootstrap_cert_model.nil?
3537

36-
# Ask base certification model to create an in-memory ConfiguredArchitecture for this model.
37-
cfg_arch = base_cert_model.to_cfg_arch
38+
puts "UPDATE: Creating real objects for #{cert_model_name}"
3839

39-
# Set globals for ERB template.
40+
# Use bootstrap CertModel to create a ConfiguredArchitecture for this CertModel
41+
# to use instead of the the bootstrap one created based on the rv32/rv64 configuration.
42+
cfg_arch = bootstrap_cert_model.to_cfg_arch
43+
44+
# Use model-specific ConfiguredArchitecture to create CertModel objects again
45+
# for every certificate model in the database and then return named CertModel object.
4046
cert_model = cfg_arch.cert_model(cert_model_name)
47+
48+
# Set globals for ERB template.
4149
portfolio = cert_model
4250
cert_class = cert_model.cert_class
4351
portfolio = cert_model

cert_flow.txt

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
backends/certificate_doc/tasks.rake
2-
base_cfg_arch = cfg_arch_for("rv#{base}") # rv32 or rv64
2+
bootstrap_cfg_arch = cfg_arch_for("rv#{base}") # rv32 or rv64
33
Rakefile
44
Calls ConfiguredArchitecture.new("gen/resolved_arch/rv32")
55
Calls Architecture.new # Parent class
@@ -8,7 +8,7 @@ base_cfg_arch = cfg_arch_for("rv#{base}") # rv32 or rv64
88
Calls PartialConfig.new(cfg path, @data) # Uses Ruby send() method
99
@mxlen = @data["params"].xlen
1010
@name = "rv32"
11-
base_cert_model = base_cfg_arch.cert_model(cert_model_name = "MC100-32")
11+
bootstrap_cert_model = bootstrap_cfg_arch.cert_model(cert_model_name = "MC100-32")
1212
Calls self.generate_obj_methods("cert_model", "certificate_model", CertModel) in Architecture # Magic
1313
Calls define_method("cert_model")
1414
Calls define_method("cert_models")
@@ -19,3 +19,65 @@ base_cert_model = base_cfg_arch.cert_model(cert_model_name = "MC100-32")
1919
@data = yaml
2020
@cfg_arch = arch # rv32 (nil if Architecture object provided)
2121
@specification = arch # rv32
22+
cfg_arch = bootstrap_cert_model.to_cfg_arch # In Portfolio class
23+
Creates hash with mandatory extensions (with version requirement) and params
24+
Uses in_scope_ext_reqs() and all_in_scope_ext_params() in Portfolio
25+
Writes hash to yaml file in /tmp/.../MC100-32/cfg.yaml
26+
Passes yaml file to ConfiguredArchitecture.new()
27+
Creates Architecture (base class), Config, and PartialConfig again (see above)
28+
cert_model = cfg_arch.cert_model(cert_model_name)
29+
Creates CertModel for every model in the database and stores it in the real ConfiguredArchitecture object
30+
Calls ERB template
31+
Converts ERB result to ASCIIDOC
32+
33+
34+
==============================================================================================
35+
Actual rv32/cfg.yaml
36+
---
37+
$schema: config_schema.json#
38+
kind: architecture configuration
39+
type: partially configured
40+
name: rv32
41+
description: A generic RV32 system; only MXLEN is known
42+
params:
43+
XLEN: 32
44+
mandatory_extensions:
45+
- name: "I"
46+
version: ">= 0"
47+
- name: "Sm"
48+
version: ">= 0"
49+
===============================================================================================
50+
Example of /tmp/.../MC100-32/cfg.yaml
51+
---
52+
"$schema": config_schema.json
53+
type: partially configured
54+
kind: architecture configuration
55+
name: MC100-32
56+
description: A partially configured architecture definition corresponding to the MC100-32
57+
portfolio.
58+
mandatory_extensions:
59+
- name: I
60+
version:
61+
- "~> 2.1"
62+
- name: C
63+
version:
64+
- "~> 2.2"
65+
- name: M
66+
version:
67+
- "~> 2.0"
68+
- name: Zicsr
69+
version:
70+
- "~> 2.0"
71+
- name: Zicntr
72+
version:
73+
- "~> 2.0"
74+
- name: Sm
75+
version:
76+
- "~> 1.11.0"
77+
params:
78+
MISALIGNED_SPLIT_STRATEGY: by_byte
79+
PRECISE_SYNCHRONOUS_EXCEPTIONS: true
80+
TRAP_ON_ECALL_FROM_M: true
81+
TRAP_ON_EBREAK: true
82+
M_MODE_ENDIANESS: little
83+
XLEN: 32

lib/arch_obj_models/certificate.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def initialize(obj_yaml, yaml_path, arch: nil)
2929
unless arch.is_a?(ConfiguredArchitecture)
3030
raise ArgumentError, "For #{name} arch is a #{arch.class} but must be a ConfiguredArchitecture"
3131
end
32+
33+
puts "UPDATE: Creating CertModel object for #{name} using cfg #{cfg_arch.name}"
3234
end
3335

3436
def unpriv_isa_manual_revision = @data["unpriv_isa_manual_revision"]

lib/arch_obj_models/portfolio.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def initialize(obj_yaml, yaml_path, arch: nil)
6767

6868
if (obj_yaml["base"] != arch.mxlen)
6969
bad_base = obj_yaml["base"]
70-
raise "For #{name} called with ConfigureArchitecture #{arch.name} with mxlen=#{arch.mxlen} but my base is #{bad_base}"
70+
#puts "UPDATE: ConfigureArchitecture #{arch.name} has mxlen=#{arch.mxlen} but base for #{name} is #{bad_base}"
7171
end
7272
end
7373

0 commit comments

Comments
 (0)