-
Notifications
You must be signed in to change notification settings - Fork 103
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
implementation for shift left logical immediate riscv32im #2836
Merged
dannywillems
merged 4 commits into
master
from
sai/shift_left_logical_immediate_riscvi32
Dec 16, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2c0c7b2
implementation for shift left logical immediate
svv232 29b12a8
correctly parse the shant
svv232 c5a3073
keep the standard variable allocation syntax for interpreter variable…
svv232 4ba3d58
parse the shamt at the top level and add correct range and value check
svv232 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1752,7 +1752,21 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: IInstruction) | |
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32)); | ||
} | ||
IInstruction::ShiftLeftLogicalImmediate => { | ||
unimplemented!("ShiftLeftLogicalImmediate") | ||
// slli: x[rd] = x[rs1] << shamt | ||
let local_rs1 = env.read_register(&rs1); | ||
let shamt = { | ||
let pos = env.alloc_scratch(); | ||
unsafe { env.bitmask(&imm, 5, 0, pos) } | ||
}; | ||
// parse shamt from imm as 20-24 of instruction and 0-4 wrt to imm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this comment for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was removed, but it was explaining where in the instruction and immediate the shamt was parsed from. |
||
let local_rd = { | ||
let pos = env.alloc_scratch(); | ||
unsafe { env.shift_left(&local_rs1, &shamt, pos) } | ||
}; | ||
|
||
env.write_register(&rd, local_rd); | ||
env.set_instruction_pointer(next_instruction_pointer.clone()); | ||
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32)); | ||
} | ||
IInstruction::ShiftRightLogicalImmediate => { | ||
unimplemented!("ShiftRightLogicalImmediate") | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you add some FIXME reg. this comment please? Can be done later.
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.
Note that a test is ready in master reg. sll, see assembly code. Only lui should be implemented.