-
Notifications
You must be signed in to change notification settings - Fork 94
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
create interpreter implementation and adding instruction decoder for riscvi32 #2753
Conversation
registers[2] = 0x408004f0; | ||
// set the stack pointer to the top of the stack |
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 follow up pr needs to be made to dynamically set the stack ptr based on the loader, this should be fine for now in the vms memory implementation.
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.
Linking comment #2741
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2753 +/- ##
==========================================
- Coverage 72.07% 71.87% -0.20%
==========================================
Files 255 255
Lines 59110 59263 +153
==========================================
- Hits 42603 42598 -5
- Misses 16507 16665 +158 ☔ View full report in Codecov by Sentry. |
<< 8) | ||
| (self.get_memory_direct(self.registers.current_instruction_pointer + 3) as u32); | ||
let instruction = instruction.to_be(); // convert to big endian for more straightforward decoding | ||
println!( |
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 we use a debug! instead?
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.
LGTM
pub fn decode_instruction(&mut self) -> (Instruction, u32) { | ||
/* https://www.cs.cornell.edu/courses/cs3410/2024fa/assignments/cpusim/riscv-instructions.pdf */ | ||
let instruction = | ||
((self.get_memory_direct(self.registers.current_instruction_pointer) as u32) << 24) |
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.
Could we not avoid to_be
below and inverse here the order of the bitshift? like first getting 0, 8, 16 and 24?
No description provided.