-
Notifications
You must be signed in to change notification settings - Fork 76
fix: decode tree crash with nil safety and add missing Zicfilp instructions #1064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…tions Fixes riscv-software-src#1061: Can't describe instructions with overlapping match strings - Add nil safety check in decode_tree.rb to prevent NoMethodError when inst_format.reverse[cur_range] returns nil - Create missing Zicfilp instruction definitions: - sspush.yaml, sspush.x1.yaml, sspush.x5.yaml - sspopchk.yaml, sspopchk.x1.yaml, sspopchk.x5.yaml - Fix Rakefile missing 'require pathname' statement - Instructions are naturally distinguishable by bit patterns, no overlapping constraints needed Signed-off-by: Sukuna0007Abhi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few high-level comments:
- Good job. That decode_tree code is pretty hard to understand. I wrote it and can barely parse it ;)
- This should be two PRs; one for the decode_tree fix and one to add the instructions.
- CI fails because you haven't identified the new instructions as "hints" of mops. You'll see an example of how to do it in the mop files.
Thanks sir @dhower-qc , Yes sir it's a pretty hard and a bit confusing but I will try my best ,
yes sir I will create 2 PR's,
Yes sir I found it now, and also there some wrong in not constraint I think. |
I am pointing this PR to add the instructions only |
- Change not constraints from long exclusion list to only exclude registers 1 and 5 - This allows the general instructions to work with any register except x1 and x5 - The specific variants (sspush.x1, sspush.x5, sspopchk.x1, sspopchk.x5) handle those exact cases - Resolves encoding conflicts between general and specific instruction variants Fixes riscv-software-src#1061 Signed-off-by: Sukuna0007Abhi <[email protected]>
inst_format = inst.encoding(xlen).format | ||
if inst_format.reverse[cur_range].match?(/^[01]+$/) | ||
range_bits = inst_format.reverse[cur_range] | ||
if range_bits && range_bits.match?(/^[01]+$/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this just converts a crash into an infinite loop. That's what I'm seeing in testing, anyway. Are you seeing something different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops sorry sir @ThinkOpenly I think I missed to add the another needy few lines here, sorry it's because I got very sad after lfx result😞 , sure sir will fix that
Fixes #1061: Can't describe instructions with overlapping match strings
Changes
1. Fix decode tree crash (decode_tree.rb)
inst_format.reverse[cur_range]
can return nil, causingmatch?
to crashrange_bits && range_bits.match?
2. Add missing Zicfilp instruction definitions
sspush.yaml
- Variable form withnot
constraints (allows only x1/x5)sspush.x1.yaml
,sspush.x5.yaml
- Fixed forms for specific registerssspopchk.yaml
- Variable form withnot
constraints (allows only x1/x5)sspopchk.x1.yaml
,sspopchk.x5.yaml
- Fixed forms for specific registersnot
constraints make seemingly overlapping patterns distinguishable3. Fix Rakefile build issue
require "pathname"
causing build failuresReady for Review sir @ThinkOpenly @dhower-qc