Skip to content

Commit ce5a74a

Browse files
authored
Merge pull request #103 from riscv-software-src/crd-james
Now that parameters support "when", needed to remove CONFIG_PTR_ADDRESS from MC-1 YAML.
2 parents 8fd3ad1 + 412e25d commit ce5a74a

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

arch/crd/MC-1.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MC-1:
4747
parameters:
4848
TIME_CSR_IMPLEMENTED: {} # Unconstrained
4949
- name: Sm
50-
version: "~> 1.11"
50+
version: "~> 1.11.0"
5151
presence: mandatory
5252
parameters:
5353
MTVEC_BASE_ALIGNMENT_DIRECT: {} # Unconstrained
@@ -60,10 +60,6 @@ MC-1:
6060
MTVAL_WIDTH: {} # Unconstrained
6161
MTVEC_MODES: {} # Unconstrained
6262
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."
6763
PRECISE_SYNCHRONOUS_EXCEPTIONS:
6864
schema:
6965
const: true

lib/arch_obj_models/crd.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ def all_in_scope_ext_params
273273
param_db = ext_db.params.find { |p| p.name == param_name }
274274
raise "There is no param '#{param_name}' in extension '#{ext_crd["name"]}" if param_db.nil?
275275

276+
next unless ext_db.versions.any? do |ver|
277+
Gem::Requirement.new(ext_crd["version"]).satisfied_by?(Gem::Version.new(ver["version"])) &&
278+
param_db.defined_in_extension_version?(ver["version"])
279+
end
280+
276281
@all_in_scope_ext_params <<
277282
InScopeExtensionParameter.new(param_db, param_data["schema"], param_data["note"])
278283
end
@@ -302,6 +307,11 @@ def in_scope_ext_params(ext_req)
302307
ext_param_db = ext_db.params.find { |p| p.name == param_name }
303308
raise "There is no param '#{param_name}' in extension '#{ext_crd["name"]}" if ext_param_db.nil?
304309

310+
next unless ext_db.versions.any? do |ver|
311+
Gem::Requirement.new(ext_crd["version"]).satisfied_by?(Gem::Version.new(ver["version"])) &&
312+
ext_param_db.defined_in_extension_version?(ver["version"])
313+
end
314+
305315
ext_params <<
306316
InScopeExtensionParameter.new(ext_param_db, param_data["schema"], param_data["note"])
307317
end
@@ -315,8 +325,15 @@ def all_out_of_scope_params
315325

316326
@all_out_of_scope_params = []
317327
in_scope_ext_reqs.each do |ext_req|
318-
@arch_def.extension(ext_req.name).params.each do |param_db|
328+
ext_db = @arch_def.extension(ext_req.name)
329+
ext_db.params.each do |param_db|
319330
next if all_in_scope_ext_params.any? { |c| c.param_db.name == param_db.name }
331+
332+
next unless ext_db.versions.any? do |ver|
333+
Gem::Requirement.new(ext_req.version_requirement).satisfied_by?(Gem::Version.new(ver["version"])) &&
334+
param_db.defined_in_extension_version?(ver["version"])
335+
end
336+
320337
@all_out_of_scope_params << param_db
321338
end
322339
end

lib/arch_obj_models/extension.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def initialize(ext, name, data)
6767
def defined_in_extension_version?(version)
6868
return true if @data.dig("when", "version").nil?
6969

70-
Gem::Requirement.new(@data["when"]["version"]).satisfied_by?(version)
70+
Gem::Requirement.new(@data["when"]["version"]).satisfied_by?(Gem::Version.new(version))
7171
end
7272

7373
# @return [String]

0 commit comments

Comments
 (0)