Skip to content
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

Merged
merged 6 commits into from
Nov 14, 2024

Conversation

svv232
Copy link
Member

@svv232 svv232 commented Nov 12, 2024

No description provided.

Comment on lines +603 to +604
registers[2] = 0x408004f0;
// set the stack pointer to the top of the stack
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking comment #2741

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 155 lines in your changes missing coverage. Please review.

Project coverage is 71.87%. Comparing base (e737bd3) to head (0681bf0).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
o1vm/src/interpreters/riscv32i/witness.rs 0.00% 152 Missing ⚠️
o1vm/src/interpreters/riscv32i/interpreter.rs 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

<< 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!(
Copy link
Member

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?

Copy link
Member

@dannywillems dannywillems left a 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)
Copy link
Member

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?

Base automatically changed from sai/memory-constants-riscv32 to master November 14, 2024 14:46
@dannywillems dannywillems merged commit 59250e7 into master Nov 14, 2024
7 of 8 checks passed
@dannywillems dannywillems deleted the sai/instruction-decoding-riscv32 branch November 14, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants