-
Notifications
You must be signed in to change notification settings - Fork 143
Draft PR for lean riscv emulator #1326
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: sail2
Are you sure you want to change the base?
Conversation
Test Results 13 files 28 suites 0s ⏱️ For more details on these errors, see this check. Results for commit 7a02b9d. ♻️ This comment has been updated with latest results. |
| class Arch where | ||
| va_size : Nat | ||
| pa : Type | ||
| pa_OfNat {n : Nat} : OfNat pa n |
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.
|
Thank you for the PR! I think the RISC-V specific code belongs in the RISC-V sail repository, unless there are other opinions? |
|
I PRd the executable model to the risc-v repo here. This makes the I think you should be able to use the model generated by the PR above by running |
|
With the new executable lean model, running an ELF file gives me the following errors: |
|
Looks like an issue with the Lean code generator? If you can control the options it uses you could try using the In Sail->C we avoid this by flattening the intermediate representation for deeply nested functions. I don't know if Lean's code generator has the same ability. |
|
@jn80842 try to add |
| @@ -0,0 +1,20 @@ | |||
| import LeanRiscv | |||
|
|
|||
| def main (args : List String) : IO UInt32 := do | |||
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.
The other error you're getting is because the Sail output already includes a main function, so better call this differently or put it in a namespace.
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.
The issue is that the risc-v model has its own main function that we don't want to use here. I changed my executable model branch to not compile the riscv_main.sail file, so this problem should be fixed if you pull on that branch @jn80842
|
Thanks everyone for your help! I was able to resolve the C errors by adding to lakefile.toml (changing |
|
Hi there, sorry for the noise, I'm curious whether you've solved the |
|
@GZGavinZhao Have you seen this repo? Contains an executable build of the model. Otherwise, the timeouts at |
Current state of the lean emulator, using the version of sail-riscv that's built here.
Executing an ELF file from the test/lean-riscv directory like so:
produces this error message: