Skip to content

Commit

Permalink
Merge pull request #103 from riscv-software-src/crd-james
Browse files Browse the repository at this point in the history
Now that parameters support "when", needed to remove CONFIG_PTR_ADDRESS from MC-1 YAML.
  • Loading branch information
dhower-qc authored Oct 17, 2024
2 parents 8fd3ad1 + 412e25d commit ce5a74a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 1 addition & 5 deletions arch/crd/MC-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MC-1:
parameters:
TIME_CSR_IMPLEMENTED: {} # Unconstrained
- name: Sm
version: "~> 1.11"
version: "~> 1.11.0"
presence: mandatory
parameters:
MTVEC_BASE_ALIGNMENT_DIRECT: {} # Unconstrained
Expand All @@ -60,10 +60,6 @@ MC-1:
MTVAL_WIDTH: {} # Unconstrained
MTVEC_MODES: {} # Unconstrained
PHYS_ADDR_WIDTH: {} # Unconstrained
CONFIG_PTR_ADDRESS:
schema:
const: 0xdeadbeef
note: "This parameter and its associated CSR shouldn't be here. See GitHub issue #53."
PRECISE_SYNCHRONOUS_EXCEPTIONS:
schema:
const: true
Expand Down
19 changes: 18 additions & 1 deletion lib/arch_obj_models/crd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ def all_in_scope_ext_params
param_db = ext_db.params.find { |p| p.name == param_name }
raise "There is no param '#{param_name}' in extension '#{ext_crd["name"]}" if param_db.nil?

next unless ext_db.versions.any? do |ver|
Gem::Requirement.new(ext_crd["version"]).satisfied_by?(Gem::Version.new(ver["version"])) &&
param_db.defined_in_extension_version?(ver["version"])
end

@all_in_scope_ext_params <<
InScopeExtensionParameter.new(param_db, param_data["schema"], param_data["note"])
end
Expand Down Expand Up @@ -302,6 +307,11 @@ def in_scope_ext_params(ext_req)
ext_param_db = ext_db.params.find { |p| p.name == param_name }
raise "There is no param '#{param_name}' in extension '#{ext_crd["name"]}" if ext_param_db.nil?

next unless ext_db.versions.any? do |ver|
Gem::Requirement.new(ext_crd["version"]).satisfied_by?(Gem::Version.new(ver["version"])) &&
ext_param_db.defined_in_extension_version?(ver["version"])
end

ext_params <<
InScopeExtensionParameter.new(ext_param_db, param_data["schema"], param_data["note"])
end
Expand All @@ -315,8 +325,15 @@ def all_out_of_scope_params

@all_out_of_scope_params = []
in_scope_ext_reqs.each do |ext_req|
@arch_def.extension(ext_req.name).params.each do |param_db|
ext_db = @arch_def.extension(ext_req.name)
ext_db.params.each do |param_db|
next if all_in_scope_ext_params.any? { |c| c.param_db.name == param_db.name }

next unless ext_db.versions.any? do |ver|
Gem::Requirement.new(ext_req.version_requirement).satisfied_by?(Gem::Version.new(ver["version"])) &&
param_db.defined_in_extension_version?(ver["version"])
end

@all_out_of_scope_params << param_db
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/arch_obj_models/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def initialize(ext, name, data)
def defined_in_extension_version?(version)
return true if @data.dig("when", "version").nil?

Gem::Requirement.new(@data["when"]["version"]).satisfied_by?(version)
Gem::Requirement.new(@data["when"]["version"]).satisfied_by?(Gem::Version.new(version))
end

# @return [String]
Expand Down

0 comments on commit ce5a74a

Please sign in to comment.