Skip to content

Commit c59841d

Browse files
Back out code to attempt to ensure required extension versions are in the DB.
1 parent db874da commit c59841d

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

arch/csr/menvcfg.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ name: menvcfg
66
address: 0x30A
77
long_name: Machine Environment Configuration
88
description: |
9-
Contains bits to enable/disable extensions
9+
Contains fields that control certain characteristics of the execution environment
10+
for modes less privileged than M-mode.
1011
1112
The `menvcfg` CSR controls
1213
certain characteristics of the execution environment for modes less

arch/csr/senvcfg.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ kind: csr
55
name: senvcfg
66
address: 0x10A
77
long_name: Supervisor Environment Configuration
8-
description: Contains bits to enable/disable extensions
8+
description: |
9+
Contains fields that control certain characteristics of the U-mode execution environment.
910
priv_mode: S
1011
length: 64
1112
definedBy:
1213
allOf:
13-
- name: Sm
14-
version: ">=1.12"
1514
- name: S
15+
version: ">=1.12"
16+
- name: U
1617
fields:
1718
CBZE:
1819
location: 7

arch/ext/S.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ name: S
66
type: privileged
77
long_name: Supervisor mode
88
versions:
9+
- version: "1.11.0"
10+
state: ratified
11+
ratification_date: 2019-06
12+
requires:
13+
name: U
14+
version: ">= 1.0.0"
915
- version: "1.12.0"
1016
state: ratified
1117
ratification_date: 2021-12
1218
requires:
1319
name: U
14-
version: "= 1.12.0"
20+
version: ">= 1.0.0"
1521
description: |
1622
This chapter describes the RISC-V supervisor-level architecture, which
1723
contains a common core that is used with various supervisor-level

arch/ext/Sm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ params:
460460
schema:
461461
type: string
462462
enum: [little, big, dynamic]
463+
# TODO: Only little available in Sm 1.11
463464
MISA_CSR_IMPLEMENTED:
464465
description: |
465466
Whether or not the `misa` CSR returns zero or a non-zero value.

lib/arch_obj_models/extension.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,6 @@ def satisfying_versions(archdef)
637637
ext.versions.select { |v| @requirement.satisfied_by?(v.version) }
638638
end
639639

640-
# @return [Boolean] True if any extension version satifies this requirement
641-
# @param [Extension] The extension object that contains one or more versions
642-
def satisfied_by_ext?(ext)
643-
return false if ext.nil?
644-
645-
ext.versions.any? { |v| @requirement.satisfied_by?(v.version) }
646-
end
647-
648640
# @overload
649641
# @param extension_version [ExtensionVersion] A specific extension version
650642
# @return [Boolean] whether or not the extension_version meets this requirement

lib/arch_obj_models/portfolio.rb

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,23 @@ def in_scope_ext_reqs(desired_presence = nil)
136136
missing_ext = false
137137

138138
@data["extensions"]&.each do |ext_name, ext_data|
139+
# Does extension even exist?
140+
# If not, don't raise an error right away so we can find all of the missing extensions and report them all.
141+
ext = arch_def.extension(ext_name)
142+
if ext.nil?
143+
puts "Extension #{ext_name} for #{name} not found in database"
144+
missing_ext = true
145+
end
146+
139147
actual_presence = ext_data["presence"] # Could be a String or Hash
140148
raise "Missing extension presence for extension #{ext_name}" if actual_presence.nil?
141149

142150
# Convert presence String or Hash to object.
143151
actual_presence_obj = ExtensionPresence.new(actual_presence)
144152

145153
if desired_presence.nil? || (actual_presence_obj == desired_presence_converted)
146-
version_data = ext_data["version"]
147-
148-
ext_req =
149-
ExtensionRequirement.new(ext_name, version_data, presence: actual_presence_obj,
154+
in_scope_ext_reqs << ExtensionRequirement.new(ext_name, ext_data["version"], presence: actual_presence_obj,
150155
note: ext_data["note"], req_id: "REQ-EXT-" + ext_name)
151-
152-
# Does extension even exist?
153-
# If not, don't raise an error right away so we can find all of the missing extensions and report them all.
154-
ext = arch_def.extension(ext_name)
155-
if ext.nil?
156-
puts "Extension #{ext_name} for #{name} not found in database"
157-
missing_ext = true
158-
else
159-
# Okay, so extension exists. Can the extension requirement be met?
160-
raise "No version of extension #{ext_name} in #{name} satifies the extension requirement #{version_data}" unless ext_req.satisfied_by_ext?(ext)
161-
end
162-
163-
in_scope_ext_reqs << ext_req
164156
end
165157
end
166158

0 commit comments

Comments
 (0)