-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
[RVC] Add support for variable length instructions in the InstructionModel #127
Comments
great progress! My initial thought is that it seems like the implementation is RISC-V-dependent. Now, this doesn't matter in the current state of Ripes (since only RISC-V is supported). However, code should in general work in an ISA-agnostic manner, such that we don't have to rewrite the entire UI whenever we switch to processors of other ISAs. If you find that there's some functionality lacking in the ISAInfo interface, then we should brainstorm on this. As suggested in my initial post, a disassembly result contains both the disassembled string as well as the number of bytes disassembled (instruction width). I imagine that this (somehow) can help with the "index-to-address" logic. Ripes/src/assembler/assemblerbase.h Lines 14 to 21 in 7ec2c53
Disassembly support for the edittab should hopefully already be implemented if you pull the latest version of the |
I uploaded the code lcgamboa@b11c6b7 with the current modifications. I'm not a C++ template user, please check if the coding style is acceptable. Feel free to suggest modifications, as you have full knowledge of the project, you can have a better view than mine, which only studied some parts. |
Would it be possible to split up the code into distinct PRs with respect to the issue in #125? This will make review a lot easier. A PR can be submitted against any branch (in this case, |
Programviewer line highlighting does not currently work because of considering all instructions 32-bit . Line 215 in 972390b
The information needed to calculate the line number already exists in the map I added to the instructionmodel With the m_indexToAddress map in the instructionmodel object I believe I can't access it from the programviewer's blockForAddress method. What do you think of putting the m_indexToAddress map in the ProcessorHandler class instead of the instructiomodel class? This would solve the blockForAddress method access problem. I need to use programviewer instead of intructionmodel as I'm testing the unit test code #137. |
@lcgamboa #142 should do this; took your function for calculating the address offset map from #135 and moved it to the Next up is then using this in the |
Currently, the InstructionModel (bottom right table in the processor tab) is built around the notion that all instructions in a program is equal in width. An example is the following, where we assume that an instruction is 4 bytes wide:
Ripes/src/instructionmodel.cpp
Lines 7 to 12 in 9a708c2
Instead, we need a more advanced solution which informs the instruction model about relative addresses based on the result from disassembling. As a reminder, a disassembly result contains both the disassembled string as well as the number of bytes disassembled (instruction width): https://github.com/mortbopet/Ripes/blob/master/src/assembler/assembler.h#L73.
Currently we're simply taking whatever result we get from disassembling and setting that as the value in the column containing disassembled instructions, without it interacting with the rest of the instruction model logic:
Ripes/src/instructionmodel.cpp
Lines 132 to 134 in 9a708c2
The text was updated successfully, but these errors were encountered: