diff --git a/spec/std/isa/inst/Zimop/mop.r.n.yaml b/spec/std/isa/inst/Zimop/mop.r.n.yaml index 3c179290b3..f1829d2a4f 100644 --- a/spec/std/isa/inst/Zimop/mop.r.n.yaml +++ b/spec/std/isa/inst/Zimop/mop.r.n.yaml @@ -30,7 +30,7 @@ data_independent_timing: false hints: - { $ref: inst/Zicfilp/sspopchk.x1.yaml# } - { $ref: inst/Zicfilp/sspopchk.x5.yaml# } - - { $ref: inst/Zicfilp/ssrdp.yaml# } + - { $ref: inst/Zicfiss/ssrdp.yaml# } pseudoinstructions: - when: n == 0 to: mop.r.0 diff --git a/tools/ruby-gems/udb/lib/udb/obj/instruction.rb b/tools/ruby-gems/udb/lib/udb/obj/instruction.rb index 27c5f82e8f..9c38f3e6b7 100644 --- a/tools/ruby-gems/udb/lib/udb/obj/instruction.rb +++ b/tools/ruby-gems/udb/lib/udb/obj/instruction.rb @@ -327,6 +327,23 @@ def validate(resolver) Instruction.deprecated_validate_encoding(@data["encoding"]["RV64"], name) end end + + # Validate hint references + if @data.key?("hints") + @data["hints"].each_with_index do |hint, index| + if hint.key?("$ref") + begin + # Try to dereference the hint to validate it exists + hint_inst = @cfg_arch.ref(hint["$ref"]) + if hint_inst.nil? + raise "Invalid hint reference in instruction '#{name}' at hints[#{index}]: '#{hint["$ref"]}' - reference not found" + end + rescue => e + raise "Invalid hint reference in instruction '#{name}' at hints[#{index}]: '#{hint["$ref"]}' - #{e.message}" + end + end + end + end end def ==(other)