Skip to content

Commit 79c80cc

Browse files
authored
Merge branch 'main' into crd_arch_def
2 parents 278d09d + d4597d6 commit 79c80cc

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

arch/ext/Sm.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ Sm:
277277
to process the load/store, which determines how/which exceptions will be reported
278278
279279
Options:
280+
280281
* by_byte: The load/store appears to be broken into byte-sized accesses that processed sequentially from smallest address to largest address
281282
* custom: Something else. Will result in a call to unpredictable() in the execution
282283
schema:
@@ -291,9 +292,18 @@ Sm:
291292
type: boolean
292293
TRAP_ON_UNIMPLEMENTED_INSTRUCTION:
293294
description: |
294-
When true, fetching an unimplemented instruction will cause an `IllegalInstruction` exception.
295+
When true, fetching an unimplemented instruction from the custom encoding space will cause
296+
an `IllegalInstruction` exception.
297+
298+
When false, fetching an unimplemented instruction is `UNPREDICTABLE`.
299+
schema:
300+
type: boolean
301+
TRAP_ON_RESERVED_INSTRUCTION:
302+
description: |
303+
When true, fetching an unimplemented and/or undefined instruction from the standard/reserved
304+
encoding space will cause an `IllegalInstruction` exception.
295305
296-
When false, fetching an unimplemented instruction is `unpredictable`.
306+
When false, fetching such an instruction is `UNPREDICTABLE`.
297307
schema:
298308
type: boolean
299309
TRAP_ON_UNIMPLEMENTED_CSR:

backends/arch_gen/tasks.rake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,29 @@ file "#{$root}/.stamps/arch-gen.stamp" => (
125125
FileUtils.touch(t.name)
126126
end
127127

128+
obj_model_files = Dir.glob($root / "lib" / "arch_obj_models" / "*.rb")
129+
obj_model_files << ($root / "lib" / "arch_def.rb")
130+
131+
arch_files = Dir.glob($root / "arch" / "**" / "*.yaml")
132+
128133
# stamp to indicate completion of Arch Gen for a given config
129134
rule %r{#{$root}/\.stamps/arch-gen-.*\.stamp} => proc { |tname|
130135
config_name = Pathname.new(tname).basename(".stamp").sub("arch-gen-", "")
131-
arch_files = Dir.glob($root / "arch" / "**" / "*.yaml")
132136
config_files =
133137
Dir.glob($root / "cfgs" / config_name / "arch_overlay" / "**" / "*.yaml") +
134138
[($root / "cfgs" / config_name / "params.yaml").to_s]
135139
[
136140
"#{$root}/.stamps",
137141
"#{ARCH_GEN_DIR}/lib/arch_gen.rb",
138142
"#{$root}/lib/idl/ast.rb",
139-
"#{ARCH_GEN_DIR}/tasks.rake"
140-
] + arch_files + config_files
143+
"#{ARCH_GEN_DIR}/tasks.rake",
144+
arch_files,
145+
config_files,
146+
147+
# the stamp file is not actually dependent on the Ruby object model,
148+
# but in general we want to rebuild anything using this stamp when the object model changes
149+
obj_model_files.map(&:to_s)
150+
].flatten
141151
} do |t|
142152
config_name = Pathname.new(t.name).basename(".stamp").sub("arch-gen-", "")
143153

cfgs/generic_rv64/params.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ params:
234234
# when false, writing an illegal value to a WLRL CSR field is ignored
235235
TRAP_ON_ILLEGAL_WLRL: true
236236
TRAP_ON_UNIMPLEMENTED_INSTRUCTION: true
237+
TRAP_ON_RESERVED_INSTRUCTION: true
237238
TRAP_ON_UNIMPLEMENTED_CSR: true
238239

239240
# Whether or not a real hardware `time` CSR exists. Implementations can either provide a real

lib/idl/ast.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5682,6 +5682,7 @@ def freeze_tree(symtab)
56825682
@value = nil
56835683
end
56845684
@type = calc_type(symtab)
5685+
@archdef = symtab.archdef # remember archdef, used in gen_adoc pass
56855686
freeze
56865687
end
56875688
@@ -5813,6 +5814,12 @@ def initialize(input, interval, idx)
58135814
@idx = idx
58145815
end
58155816
5817+
def freeze_tree(symtab)
5818+
@archdef = symtab.archdef # remember archdef, used by gen_adoc pass
5819+
@idx.freeze_tree(symtab)
5820+
freeze
5821+
end
5822+
58165823
# @!macro type
58175824
def type(symtab)
58185825
archdef = symtab.archdef

lib/idl/passes/gen_adoc.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ def gen_adoc(indent = 0, indent_spaces: 2)
295295
if idx_text =~ /[0-9]+/
296296
"#{' '*indent}#{csr_text}"
297297
else
298-
"#{' '*indent}%%LINK%csr_field;#{idx_text}.#{@field_name};#{csr_text}%%"
298+
if @archdef.csr(csr_text).nil?
299+
"#{' '*indent}#{csr_text}"
300+
else
301+
"#{' '*indent}%%LINK%csr_field;#{idx_text}.#{@field_name};#{csr_text}%%"
302+
end
299303
end
300304
end
301305
end
@@ -314,7 +318,11 @@ def gen_adoc(indent = 0, indent_spaces: 2)
314318
# we don't have the symtab to map this to a csr name
315319
"#{' '*indent}#{csr_text}"
316320
else
317-
"#{' '*indent}%%LINK%csr;#{idx_text};#{csr_text}%%"
321+
if @archdef.csr(csr_text).nil?
322+
"#{' '*indent}#{csr_text}"
323+
else
324+
"#{' '*indent}%%LINK%csr;#{idx_text};#{csr_text}%%"
325+
end
318326
end
319327
end
320328
end

0 commit comments

Comments
 (0)