Skip to content

Commit 1a6174b

Browse files
Merge branch 'main' into 181-move-priv-modes-present-from-crd-family-to-crd
2 parents 8c611b1 + 9f4d95e commit 1a6174b

File tree

10 files changed

+106
-39
lines changed

10 files changed

+106
-39
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Bug report
3+
about: Report a bug in one or more tools
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. On branch B,
16+
1. Run '...'
17+
18+
**Text output/Error Messages**
19+
If any
20+
21+
**Screenshots**
22+
If applicable, add screenshots to help explain your problem.
23+
24+
**Additional context**
25+
Add any other context about the problem here.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Data Error
3+
about: Report a data error in the database
4+
title: ''
5+
labels: data error
6+
assignees: ''
7+
8+
---
9+
10+
**Current value and location**
11+
Where is this data?
12+
13+
**Expected value**
14+
What do you think the value(s) should be?
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

arch/csr/mie.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ mie:
156156
157157
Alias of `sie.SSIE` when `mideleg.SSI` is set. Otherwise, `sie.SSIE` is read-only 0.
158158
type: RW
159+
definedBy: S
159160
reset_value: 0
160161
VSSIE:
161162
location: 2
@@ -188,6 +189,7 @@ mie:
188189
189190
Alias of `sip.STIE` when `mideleg.STI` is set. Otherwise, `sip.STIE` is read-only 0.
190191
type: RW
192+
definedBy: S
191193
reset_value: 0
192194
VSTIE:
193195
location: 6
@@ -220,6 +222,7 @@ mie:
220222
221223
Alias of `sie.SEIE` when `mideleg.SEI` is set. Otherwise, `sie.SEIE` is read-only 0.
222224
type: RW
225+
definedBy: S
223226
reset_value: 0
224227
VSEIE:
225228
location: 10

arch/csr/misa.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ misa:
2323
Writing 0 to this field will cause all atomic instructions to raise an `IllegalInstruction` exception.
2424
type(): |
2525
return (implemented?(ExtensionName::A) && MUTABLE_MISA_A) ? CsrFieldType::RW : CsrFieldType::RO;
26-
reset_value(): |
27-
return implemented?(ExtensionName::A) ? 1 : 0;
26+
definedBy: A
27+
reset_value: 1
2828
B:
2929
location: 1
3030
description: |
@@ -34,8 +34,8 @@ misa:
3434
Writing 0 to this field will cause all bitmanip instructions to raise an `IllegalInstruction` exception.
3535
type(): |
3636
return (implemented?(ExtensionName::B) && MUTABLE_MISA_B) ? CsrFieldType::RW : CsrFieldType::RO;
37-
reset_value(): |
38-
return implemented?(ExtensionName::B) ? 1 : 0;
37+
definedBy: B
38+
reset_value: 1
3939
C:
4040
location: 2
4141
description: |
@@ -46,8 +46,8 @@ misa:
4646
Additionally, IALIGN becomes 32.
4747
type(): |
4848
return (implemented?(ExtensionName::C) && MUTABLE_MISA_C) ? CsrFieldType::RW : CsrFieldType::RO;
49-
reset_value(): |
50-
return implemented?(ExtensionName::C) ? 1 : 0;
49+
definedBy: C
50+
reset_value: 1
5151
D:
5252
location: 3
5353
description: |
@@ -61,8 +61,8 @@ misa:
6161
--
6262
type(): |
6363
return (implemented?(ExtensionName::D) && MUTABLE_MISA_D) ? CsrFieldType::RW : CsrFieldType::RO;
64-
reset_value(): |
65-
return implemented?(ExtensionName::D) ? 1 : 0;
64+
definedBy: D
65+
reset_value: 1
6666
F:
6767
location: 5
6868
description: |
@@ -76,8 +76,8 @@ misa:
7676
--
7777
type(): |
7878
return (implemented?(ExtensionName::F) && MUTABLE_MISA_F) ? CsrFieldType::RW : CsrFieldType::RO;
79-
reset_value(): |
80-
return implemented?(ExtensionName::F) ? 1 : 0;
79+
definedBy: F
80+
reset_value: 1
8181
sw_write(csr_value): |
8282
if (csr_value.F == 0 && csr_value.D == 1) {
8383
return UNDEFINED_LEGAL_DETERMINISTIC;
@@ -115,13 +115,14 @@ misa:
115115
Writing 0 to this field will cause all attempts to enter VS- or VU- mode, execute a hypervisor instruction, or access a hypervisor CSR to raise an `IllegalInstruction` fault.
116116
type(): |
117117
return (implemented?(ExtensionName::H) && MUTABLE_MISA_H) ? CsrFieldType::RW : CsrFieldType::RO;
118-
reset_value(): |
119-
return implemented?(ExtensionName::H) ? 1 : 0;
118+
definedBy: H
119+
reset_value: 1
120120
I:
121121
location: 8
122122
description: |
123123
Indicates support for the `I` (base) extension.
124124
type: RO
125+
definedBy: I
125126
reset_value: 1
126127
M:
127128
location: 13
@@ -132,8 +133,8 @@ misa:
132133
Writing 0 to this field will cause all attempts to execute an integer multiply or divide instruction to raise an `IllegalInstruction` exception.
133134
type(): |
134135
return (implemented?(ExtensionName::M) && MUTABLE_MISA_M) ? CsrFieldType::RW : CsrFieldType::RO;
135-
reset_value(): |
136-
return implemented?(ExtensionName::M) ? 1 : 0;
136+
definedBy: M
137+
reset_value: 1
137138
S:
138139
location: 19
139140
description: |
@@ -143,8 +144,8 @@ misa:
143144
Writing 0 to this field will cause all attempts to enter S-mode or access S-mode state to raise an exception.
144145
type(): |
145146
return (implemented?(ExtensionName::S) && MUTABLE_MISA_S) ? CsrFieldType::RW : CsrFieldType::RO;
146-
reset_value(): |
147-
return implemented?(ExtensionName::S) ? 1 : 0;
147+
definedBy: S
148+
reset_value: 1
148149
U:
149150
location: 21
150151
description: |
@@ -154,19 +155,18 @@ misa:
154155
Writing 0 to this field will cause all attempts to enter U-mode to raise an exception.
155156
type(): |
156157
return (implemented?(ExtensionName::U) && MUTABLE_MISA_U) ? CsrFieldType::RW : CsrFieldType::RO;
157-
reset_value(): |
158-
return implemented?(ExtensionName::U) ? 1 : 0;
158+
definedBy: U
159+
reset_value: 1
159160
V:
160161
location: 22
161162
description: |
162163
Indicates support for the `V` (vector) extension.
163164
164-
[when,"MUTABLE_MISA_S == true"]
165+
[when,"MUTABLE_MISA_V == true"]
165166
Writing 0 to this field will cause all attempts to execute a vector instruction to raise an `IllegalInstruction` trap.
166167
type: RO
167-
reset_value: 0 # TODO
168-
# reset_value(): |
169-
# return implemented?(ExtensionName::V) ? 1 : 0;
168+
definedBy: V
169+
reset_value: 1
170170
sw_read(): |
171171
return (
172172
(CSR[misa].MXL << 62) |

arch/prose/idl.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ There are several aliases of Bits<N> available, as shown below.
144144
|===
145145
| Alias | Type
146146

147-
| `XReg` | `Bits<XLEN>`, where XLEN is configuratin-dependent
147+
| `XReg` | `Bits<XLEN>`, where XLEN is configuration-dependent
148148
| `U64` | `Bits<64>`
149149
| `U32` | `Bits<32>`
150150
|===
@@ -249,7 +249,7 @@ Arrays are declared by appending the size of the array in brackets after the var
249249
.Array declarations
250250
[source,idl]
251251
----
252-
Bitx<32> array_of_words[10]; # array of ten words
252+
Bits<32> array_of_words[10]; # array of ten words
253253
Boolean array_of_bools[12]; # array of twelve booleans
254254
Bits<32> matrix_of_words[32][32]; # array of arrays of 32 words
255255
----
@@ -264,7 +264,7 @@ array_of_bools[3] # Boolean type; the third word in array_of_bools
264264
matrix_of_words[3][4] # Bits<32> type; the fourth word in the third array of matrix_of_words
265265
----
266266

267-
Arrays cannot be casted to Bits<N> type, so the storage order is irrelant and unspecified.
267+
Arrays cannot be casted to Bits<N> type, so the storage order is irrelevant and unspecified.
268268

269269
==== Tuples
270270

@@ -309,7 +309,7 @@ Literals may contain any number of underscores after the initial digit for clari
309309
4'sb1101 # -3 decimal, signed, 4-bit wide
310310
-4'sb1101 # 3 decimal, signed, 4-bit wide
311311
312-
32'h80000000 # 0x8000000, unsigned, 32-bit wide
312+
32'h80000000 # 0x80000000, unsigned, 32-bit wide
313313
32'h8000_0000 # same as above (underscores ignored)
314314
315315
8'13 # 13 decimal, 8-bit wide (default radix is 10)
@@ -340,7 +340,7 @@ Literals may contain any number of underscores after the initial digit for clari
340340
0x0fff # 4095 decimal, unsigned 12-bit wide (leading zeros have no impact)
341341
0 # 0 decimal, unsigned, 1-bit wide (0 is specially defined to be 1-bit wide)
342342
343-
0x80000000 # 0x8000000, unsigned, 32-bit wide
343+
0x80000000 # 0x80000000, unsigned, 32-bit wide
344344
0x8000_0000 # same as above (underscores ignored)
345345
346346
# negative literals
@@ -360,7 +360,7 @@ Array literals are composed of a list of comma-separated values in brackets, sim
360360
.Array literals
361361
[source,idl]
362362
----
363-
Bitx<32> array_of_words[10] = [0,1,2,3,4,5,6,7,8,9];
363+
Bits<32> array_of_words[10] = [0,1,2,3,4,5,6,7,8,9];
364364
Boolean array_of_bools[12] =
365365
[
366366
true,true,true,true,true,true,
@@ -509,7 +509,7 @@ Variables may be optionally initialized when they are declared using the assignm
509509
[source,idl]
510510
----
511511
Boolean condition; # declare condition, initialized to false
512-
XReg address = 0x8000_0000; # declare address, initialized to 0x800000000
512+
XReg address = 0x8000_0000; # declare address, initialized to 0x80000000
513513
Bits<8> pmpCfg0; # declare pmpCfg0, initialized to 8'd0
514514
Bits<8> pmp_cfg_0; # declare pmp_cfg_0, initialized to 8'd0
515515
Bits<8> ary[2]; # declare ary, initialized to [8'd0, 8'd0]
@@ -550,8 +550,8 @@ Note that many global constants, such are configuration parameters, are implicit
550550
[source,idl]
551551
----
552552
Boolean I_LIKE_CHEESE = true; # declare I_LIKE_CHEESE, initialized to true
553-
XReg Address = 0x8000_0000; # declare Address, initialized to 0x800000000
554-
XReg AddressAlias = Address; # declare AddressAlias, initialized to 0x800000000
553+
XReg Address = 0x8000_0000; # declare Address, initialized to 0x80000000
554+
XReg AddressAlias = Address; # declare AddressAlias, initialized to 0x80000000
555555
556556
# Bits<8> pmpCfg; # constant names must start with a lowercase letter. pmpCfg would be a variable
557557
@@ -592,7 +592,7 @@ Bitfields can be converted to a `Bits<N>` type, where N is the width of the bitf
592592

593593
== Casting
594594

595-
There are two explicit cast operators in IDL: `$isgned` and `$bits`.
595+
There are two explicit cast operators in IDL: `$isigned` and `$bits`.
596596

597597
Unsigned Bits<N> values may be cast to signed values using the `$signed` cast operator.
598598

backends/crd_doc/templates/crd.adoc.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ h| Privilege Mode | <%= csr.priv_mode %>
544544
.<%= csr.name %> format
545545
[wavedrom, ,svg,subs='attributes',width="100%"]
546546
....
547-
<%= JSON.dump csr.wavedrom_desc(arch_def, csr.base.nil? ? 32 : csr.base, optional_type: 3) %>
547+
<%= JSON.dump csr.wavedrom_desc(arch_def, csr.base.nil? ? 32 : csr.base, optional_type: 2) %>
548548
....
549549
<% else -%>
550550
<%# CSR has a dynamic length, or a field has a dynamic location,
@@ -554,13 +554,13 @@ This CSR format changes dynamically with XLEN.
554554
.<%= csr.name %> Format when <%= csr.length_cond32 %>
555555
[wavedrom, ,svg,subs='attributes',width="100%"]
556556
....
557-
<%= JSON.dump csr.wavedrom_desc(arch_def, 32, optional_type: 3) %>
557+
<%= JSON.dump csr.wavedrom_desc(arch_def, 32, optional_type: 2) %>
558558
....
559559

560560
.<%= csr.name %> Format when <%= csr.length_cond64 %>
561561
[wavedrom, ,svg,subs='attributes',width="100%"]
562562
....
563-
<%= JSON.dump csr.wavedrom_desc(arch_def, 64, optional_type: 3) %>
563+
<%= JSON.dump csr.wavedrom_desc(arch_def, 64, optional_type: 2) %>
564564
....
565565

566566

lib/arch_obj_models/csr.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def pruned_sw_read_ast(arch_def)
512512
# @param exclude_unimplemented [Boolean] If true, do not create include unimplemented fields in the figure
513513
# @param optional_type [Integer] Wavedrom type (Fill color) for fields that are optional (not mandatory) in a partially-specified arch_def
514514
# @return [Hash] A representation of the WaveDrom drawing for the CSR (should be turned into JSON for wavedrom)
515-
def wavedrom_desc(arch_def, effective_xlen, exclude_unimplemented: false, optional_type: 2)
515+
def wavedrom_desc(arch_def, effective_xlen, exclude_unimplemented: false, optional_type: 3)
516516
desc = {
517517
"reg" => []
518518
}
@@ -536,9 +536,10 @@ def wavedrom_desc(arch_def, effective_xlen, exclude_unimplemented: false, option
536536
desc["reg"] << { "bits" => n, type: 1 }
537537
end
538538
if arch_def.partially_configured? && field.optional_in_cfg?(arch_def)
539+
puts "#{name}.#{field.name} is OPTIONAL"
539540
desc["reg"] << { "bits" => field.location(arch_def, effective_xlen).size, "name" => field.name, type: optional_type }
540541
else
541-
desc["reg"] << { "bits" => field.location(arch_def, effective_xlen).size, "name" => field.name, type: 2 }
542+
desc["reg"] << { "bits" => field.location(arch_def, effective_xlen).size, "name" => field.name, type: 3 }
542543
end
543544
last_idx = field.location(arch_def, effective_xlen).max
544545
end
@@ -570,7 +571,7 @@ def optional_in_cfg?(arch_def)
570571
raise "optional_in_cfg? should only be used by a partially-specified arch def" unless arch_def.partially_configured?
571572

572573
exists_in_cfg?(arch_def) &&
573-
arch_def.mandatory_extensions.none? do |ext_req|
574+
arch_def.mandatory_extensions.all? do |ext_req|
574575
ext_req.satisfying_versions(arch_def).none? { |ext_ver| defined_by?(ext_ver) }
575576
end
576577
end

lib/arch_obj_models/csr_field.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def optional_in_cfg?(arch_def)
5252
exists_in_cfg?(arch_def) &&
5353
(
5454
parent.optional_in_cfg?(arch_def) ||
55-
(data["definedBy"].nil? || arch_def.mandatory_extensions.none? do |ext_req|
55+
(data["definedBy"].nil? || arch_def.mandatory_extensions.all? do |ext_req|
5656
ext_req.satisfying_versions(arch_def).none? { |ext_ver| defined_by?(ext_ver) }
5757
end)
5858
)

lib/arch_obj_models/extension.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ def params(arch_def)
316316
ext(arch_def).params.select { |p| p.defined_in_extension_version?(@version) }
317317
end
318318

319+
def to_s
320+
"#{name}@#{version}"
321+
end
322+
319323
# @overload ==(other)
320324
# @param other [String] An extension name
321325
# @return [Boolean] whether or not this ExtensionVersion is named 'other'

0 commit comments

Comments
 (0)