@@ -546,10 +546,10 @@ decode:
546546 # opcode
547547 op and opcode instruction 0b1111111
548548
549- # also bail out if we're in the big group of illegal instructions between OP-32 and 48b
550- # TODO: we could use this to reduce the code size a bit
549+ # also bail out if we're in the big group of illegal instructions between OP-32 and 48b, or at the end after OP-VE
551550 jump decode__ok lessThan opcode 0b0111011 # OP-32
552551 jump decode_illegal_instruction lessThanEq opcode 0b1011111 # 48b
552+ jump decode_illegal_instruction greaterThanEq opcode 0b1110111 # OP-VE
553553decode__ok:
554554
555555 # decode common fields to save space
@@ -579,6 +579,12 @@ decode__ok:
579579
580580 # counter array based on (opcode >> 2), since the low 2 bits don't matter
581581 op shr jump opcode 2
582+
583+ # skip the section of illegal instructions that we already handled above
584+ jump decode__before_OP-32 lessThan opcode 0b0111011 # OP-32
585+ op sub jump jump 10
586+ decode__before_OP-32:
587+
582588 op add @counter @counter jump
583589
584590 jump decode_LOAD always
@@ -595,24 +601,24 @@ decode__ok:
595601 jump decode_AMO always
596602 jump decode_OP always
597603 jump decode_LUI always
598- jump decode_illegal_instruction always # OP-32
599- jump decode_illegal_instruction always # 64b
600- jump decode_illegal_instruction always # MADD
601- jump decode_illegal_instruction always # MSUB
602- jump decode_illegal_instruction always # NMSUB
603- jump decode_illegal_instruction always # NMADD
604- jump decode_illegal_instruction always # OP-FP
605- jump decode_illegal_instruction always # OP-V
606- jump decode_illegal_instruction always # custom-2/rv128
607- jump decode_illegal_instruction always # 48b
604+ # OP-32
605+ # 64b
606+ # MADD
607+ # MSUB
608+ # NMSUB
609+ # NMADD
610+ # OP-FP
611+ # OP-V
612+ # custom-2/rv128
613+ # 48b
608614 jump decode_BRANCH always
609615 jump decode_JALR always
610616 jump decode_illegal_instruction always # reserved
611617 jump decode_JAL always
612618 jump decode_SYSTEM always
613- jump decode_illegal_instruction always # OP-VE
614- jump decode_illegal_instruction always # custom-3/rv128
615- jump decode_illegal_instruction always # >=80b
619+ # OP-VE
620+ # custom-3/rv128
621+ # >=80b
616622
617623decode_LUI:
618624 set op_id 1 # LUI
0 commit comments