Skip to content

Commit b5d25b9

Browse files
fix: ssrdp.yaml file reference in mop.r.n.yaml (#1066)
Fixes: #1065 Fix incorrect file reference in mop.r.n.yaml hints section ## Problem The `mop.r.n.yaml` file contains an incorrect file reference in its hints section that points to a non-existent file path: ## Solution it should point to Zicfiss, hints: ```yaml - { $ref: inst/Zicfiss/ssrdp.yaml# } # Correct path fixed ``` - Also added validation check , Method: Udb::Instruction#validate - Tests each $ref by dereferencing it - Prevents future broken hint references Ready for Review sir @ThinkOpenly sir @dhower-qc --------- Signed-off-by: Sukuna0007Abhi <[email protected]>
1 parent 914b672 commit b5d25b9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

spec/std/isa/inst/Zimop/mop.r.n.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ data_independent_timing: false
3030
hints:
3131
- { $ref: inst/Zicfilp/sspopchk.x1.yaml# }
3232
- { $ref: inst/Zicfilp/sspopchk.x5.yaml# }
33-
- { $ref: inst/Zicfilp/ssrdp.yaml# }
33+
- { $ref: inst/Zicfiss/ssrdp.yaml# }
3434
pseudoinstructions:
3535
- when: n == 0
3636
to: mop.r.0

tools/ruby-gems/udb/lib/udb/obj/instruction.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,23 @@ def validate(resolver)
327327
Instruction.deprecated_validate_encoding(@data["encoding"]["RV64"], name)
328328
end
329329
end
330+
331+
# Validate hint references
332+
if @data.key?("hints")
333+
@data["hints"].each_with_index do |hint, index|
334+
if hint.key?("$ref")
335+
begin
336+
# Try to dereference the hint to validate it exists
337+
hint_inst = @cfg_arch.ref(hint["$ref"])
338+
if hint_inst.nil?
339+
raise "Invalid hint reference in instruction '#{name}' at hints[#{index}]: '#{hint["$ref"]}' - reference not found"
340+
end
341+
rescue => e
342+
raise "Invalid hint reference in instruction '#{name}' at hints[#{index}]: '#{hint["$ref"]}' - #{e.message}"
343+
end
344+
end
345+
end
346+
end
330347
end
331348

332349
def ==(other)

0 commit comments

Comments
 (0)