-
Notifications
You must be signed in to change notification settings - Fork 241
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
Support rv64 #78
Support rv64 #78
Conversation
Also changed cycle, instret and time to be directly updated as 64 bits.
The remaining instructions which might need modifications are: Floating point (which shouldn't need to change) JALR Immediate mode shifts Stores and loads need a little update to support new instructions
Also this fixes a bug in backstepping FSD and a tautologically true test.
On change of this setting all instructions are reloaded and ones that don't work in the current mode will fail to initialize. Its a kindof hacky solution, but it does allow overwriting other instructions. The mechanism for failing to load is BasicInstruction throwing a null pointer exception.
This was quite difficult to actually implement, but is quite neccessary to automatically run tests from riscv-tests. Most of the difficulty stemmed from a bunch of places in the code expecting the biggest value would be an int rather than a long. However, making li work with 64 bit values was also a little bit of work. It neccessitated making 5 new types of Psuedo-op templates. .dword was relatively simple after li wsa working, but required modifying a significant amount of code.
This is close enough to finished that feedback would be good. If 32 bit behavior has changed or 64 bit semantics are wrong, please let me know. A fair amount of documentation still needs to be made and I don't have rigorous testing setup yet. You can find a jar here |
This bug was caused by a few issues. First, when adding .dword I decided to allow existing code to handle the fits within 32 bit case. The old code could not possibly handle that correctly. Second, lengthinbytes = 8 was passed into the Memory system, given that it takes an int as data and there are only 4 bytes in an int it doesn't have defined behaviour for 8 bytes. Third, javas shifting loops after 32 for integers. So in total, I failed to account for a case, passed an undefined input into memory, which resulted in replicated behaviour due to java. I fixed it by just always handling the writes for .dword directly.
Thank you so much for this feature! |
Significant postproccessing on these tests was needed to get them to assemble. The test templates use a bunch of shifting and masking which is not explanded by gcc when outputting assembly. Simpliying the templates + sed to replace things automatically works pretty well, but it also uses numbered branches which would force those to be rewrtiten by hand. Also srl used C shifting logic to generate answers so that needed to be done by hand. In general, branches not included and very minor manual changes after a small script post-processing and template changes.
Currently the thing holding this back is the lack of testing. I have been working on loading ELF files generated by riscv-tests, but that will take a little more effort as ELF loading is a prototype and doesn't support parsing 64 bit ELF files. |
… the same Both jalr bugs apply to both rv32 and rv64, but only got caught now because of the binary testing which allowed me to run the riscv-tests that use special branching syntax RARS doesn't support.
A hacky way of loading elf files worked, and RARS now passes binary rv64 tests. I don't have the tests committed yet though. I think I will get the CLI set up quickly and then manually review all of the system calls. |
ReadChar in command-line feeds from the buffered input reader
I have something that gives some support for rv64 now. Its not finished, but it is a start.
TODO: