Skip to content

Commit 2ae213d

Browse files
authored
Merge pull request #150 from riscv-software-src/149-update-mc-1-crd-since-risc-v-summit-is-tomorrow
Cleanup of CRD before Summit
2 parents 7e0ba67 + 770ed24 commit 2ae213d

File tree

11 files changed

+24
-75
lines changed

11 files changed

+24
-75
lines changed

arch/crd/MC-1.yaml

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -77,59 +77,4 @@ MC-1:
7777
const: little
7878
XLEN:
7979
schema:
80-
const: 32
81-
82-
requirement_groups:
83-
- name: MC-Unpriv
84-
description: |
85-
The MC-Unpriv defines unprivileged ISA requirements.
86-
Note that unprivileged ISA features are those that are usable in all privilege modes;
87-
they aren't only usable in U-mode (User-mode).
88-
It is unfortunate that both “Unprivileged” and “User” start with the letter “U” but they
89-
aren't the same thing.
90-
91-
requirements:
92-
- name: REQ-UINST-001
93-
description: Should use little-endian byte order
94-
95-
- name: REQ-UCSR-001-a
96-
description: Should raise an Illegal Instruction exception when writing to the `cycle` CSR
97-
98-
- name: REQ-UCSR-001-b
99-
description: Should return the XLEN least-significant bits of the `mcycle` CSR when reading the `cycle` CSR
100-
101-
- name: REQ-UCSR-002-a
102-
description: Should raise an Illegal Instruction exception when writing to the `time` CSR
103-
104-
- name: REQ-UCSR-002-b
105-
description: Should return the XLEN least-significant bits of the `mtime` CSR when reading the `time` CSR
106-
when:
107-
param:
108-
TIME_CSR_IMPLEMENTED: true
109-
110-
- name: REQ-UCSR-002-c
111-
description: Should raise an Illegal Instruction exception when reading the `time` CSR
112-
when:
113-
param:
114-
TIME_CSR_IMPLEMENTED: false
115-
116-
- name: MC-Unpriv-32
117-
when:
118-
xlen: 32
119-
description: |
120-
The MC-Unpriv-32 defines unprivileged ISA requirements specific to 32-bit processors.
121-
requirements:
122-
- name: REQ-M32CSR-001-a
123-
description: Should raise an illegal instruction trap when writing the 'cycleh' CSR
124-
- name: REQ-M32CSR-001-b
125-
description: Should return the most-significant 32-bits of the `mcycle` CSR when reading `cycleh`
126-
- name: REQ-M32CSR-002
127-
description: Should return the most-significant 32-bits of the `minstret` CSR when reading `instreth`
128-
129-
- name: MC-Priv
130-
description: |
131-
The MC-Priv defines Privileged ISA requirements.
132-
requirements:
133-
- name: REQ-PRIV-HARTID
134-
description: |
135-
One hart in system has to have a HARTID of 0. Reading `mhartid` on other CSRs provides some value.
80+
const: 32

arch/csr/mip.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mip:
55
address: 0x344
66
priv_mode: M
77
description: Machine Interrupt Pending bits
8-
length: 64
8+
length: MXLEN
99
definedBy: Sm
1010
fields:
1111
SSIP:

arch/csr/mscratch.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ mscratch:
44
long_name: Machine Scratch Register
55
address: 0x340
66
priv_mode: M
7-
length: 64
7+
length: MXLEN
88
description: Scratch register for software use. Bits are not interpreted by hardware.
9-
definedBy: U # actually, defined by RV64, but must implement U-mode for this CSR to exist
9+
definedBy: Sm
1010
fields:
1111
SCRATCH:
12-
location: 63-0
12+
location_rv32: 31-0
13+
location_rv64: 63-0
1314
description: Scratch value
1415
type: RW
1516
reset_value: 0

arch/csr/mtval.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ mtval:
55
address: 0x343
66
description: Holds trap-specific information
77
priv_mode: M
8-
length: 64
8+
length: MXLEN
99
definedBy: Sm
1010
fields:
1111
VALUE:
12-
location: 63-0
12+
location_rv32: 31-0
13+
location_rv64: 63-0
1314
description: |
1415
Written with trap-specific information when a trap is taken into M-mode.
1516

arch/ext/Sm.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Sm:
231231
description: |
232232
Does the implementation perform non-atomic misaligned loads and stores to main memory
233233
(does *not* affect misaligned support to device memory)?
234-
If not, the implementation throws a misaligned exception.
234+
If not, the implementation always throws a misaligned exception.
235235
schema:
236236
type: boolean
237237
MISALIGNED_LDST_EXCEPTION_PRIORITY:
@@ -247,21 +247,21 @@ Sm:
247247
! high ! Misaligned load/store/AMO exceptions are always higher priority than load/store/AMO page-fault and access-fault exceptions.
248248
!===
249249
250-
MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE
250+
MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE
251251
is non-zero, since the atomicity of an access cannot be determined in that case until after
252252
address translation.
253253
schema:
254254
type: string
255255
enum: ["low", "high"]
256256
extra_validation: |
257-
assert (MISALIGNED_LDST_EXCEPTION_PRIORITY == "low") if MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE.positive?
258-
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE:
257+
assert (MISALIGNED_LDST_EXCEPTION_PRIORITY == "low") if MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE.positive?
258+
MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE:
259259
description: |
260260
The maximum granule size, in bytes, that the hart can atomically perform a
261-
misaligned load/store/AMO without raising a Misaligned exception. When MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE is 0, the hart
261+
misaligned load/store/AMO without raising a Misaligned exception. When MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE is 0, the hart
262262
cannot atomically perform a misaligned load/store/AMO. When a power of two, the hart can
263263
atomically load/store/AMO a misaligned access that is fully contained in a
264-
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE-aligned region.
264+
MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE-aligned region.
265265
266266
[NOTE]
267267
Even if the hart is capable of performing a misaligned load/store/AMO atomically,

arch/isa/globals.isa

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,7 @@ function misaligned_is_atomic? {
23672367
body {
23682368
# if the hart doesn't support Misligned Atomicity Granules,
23692369
# then this misligned access is not atomic
2370-
return false if MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE == 0;
2370+
return false if MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE == 0;
23712371

23722372
if (pma_applies?(PmaAttribute::MAG16, physical_address, N) &&
23732373
in_naturally_aligned_region?<128>(physical_address, N)) {
@@ -2434,7 +2434,7 @@ function read_memory {
24342434
# access isn't naturally aligned, but it still might be atomic if this hart supports
24352435
# Misliagned Atomicity Granules. We won't know that, though, until after translation since PMAs
24362436
# apply to physical addresses
2437-
if (MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE > 0) {
2437+
if (MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE > 0) {
24382438
# sanity check that the implementation isn't expecting a Misaligned exception
24392439
# before an access/page fault exception (that would be an invalid config)
24402440
assert(MISALIGNED_LDST_EXCEPTION_PRIORITY == "low", "Invalid config: can't mix low-priority misaligned exceptions with large atomicity granule");
@@ -2758,7 +2758,7 @@ function write_memory {
27582758
# access isn't naturally aligned, but it still might be atomic if this hart supports
27592759
# Misliagned Atomicity Granules. We won't know that, though, until after translation since PMAs
27602760
# apply to physical addresses
2761-
if (MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE > 0) {
2761+
if (MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE > 0) {
27622762
# sanity check that the implementation isn't expecting a Misaligned exception
27632763
# before an access/page fault exception (that would be an invalid config)
27642764
assert(MISALIGNED_LDST_EXCEPTION_PRIORITY == "low", "Invalid config: can't mix low-priority misaligned exceptions with large atomicity granule");

backends/crd_doc/templates/crd.adoc.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ None
209209
<% end # do -%>
210210
|===
211211
212+
<% unless crd.requirement_groups.empty? -%>
212213
== Additional Requirements
213214
214215
This section contains requirements in addition to those already specified related to extensions and parameters.
@@ -239,6 +240,7 @@ Requirement <%= req.name %> only apply when <%= req.when_pretty %>.
239240
|===
240241
241242
<% end -%>
243+
<% end # unless requirement_groups.empty? -%>
242244
243245
[appendix]
244246
== Extension Details

cfgs/generic_rv64/params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ params:
2424

2525
MISALIGNED_LDST_EXCEPTION_PRIORITY: high
2626

27-
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE: 0
27+
MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE: 0
2828

2929
MISALIGNED_SPLIT_STRATEGY: by_byte
3030

lib/DB_MODEL.README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A YAML file with values for parameters defined by the implemented extensions. Pa
4242
params:
4343
MISALIGNED_LDST: true
4444
MISALIGNED_LDST_EXCEPTION_PRIORITY: high
45-
MAX_MISALIGNED_ATOMICITY_GRANULE_SIZE: 0
45+
MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE: 0
4646
MISALIGNED_SPLIT_STRATEGY: by_byte
4747
# ...
4848
----

lib/arch_obj_models/crd.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def requirement_groups
473473
return @requirement_groups unless @requirement_groups.nil?
474474

475475
@requirement_groups = []
476-
@data["requirement_groups"].each do |req_group|
476+
@data["requirement_groups"]&.each do |req_group|
477477
@requirement_groups << RequirementGroup.new(req_group, @arch_def)
478478
end
479479
@requirement_groups

0 commit comments

Comments
 (0)