-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow aliases for token substitution #200
Comments
Could you give some syntax examples on the usage of |
The intent was that it would be used in user code. My main use case is that I'm using customasm for writing microcode for a general microcode engine. For specific architectures that use it, I want to name some of the registers so that I don't need to remember which microarchitectural register maps to which ISA register. I have a few examples here. https://github.com/EnderShadow/microcode-engine/blob/main/overture.asm In the same repo, I currently get around by using a script to parse #alias lines and do a find-replace in the file before running it through customasm, but I'm not sure how scalable an approach like that is in practice. |
Why not just:
|
The reason why I can't do that is because the the microcode definition defines everything that's specific to the microcode engine and nothing more. Implementations of architectures using the microcode engine need registers for specific purposes and duplicating the microcode engine's definition file is not what I want to do. If there was a way to define multiple subrules with the same name and have them get merged, that would be a solution as well. |
How about something like:
You can easily redefine constants via a few methods:
|
That's not a workable solution. As per the linked examples, there architectures using the core source file may not share names of registers and I don't want to pollute the shared definition file with registers that at best will not be used and at worst cause subtle bugs through accidental use of the wrong register. |
I see. To work around this on the current version, maybe you could declare your Though, since right now you can't merge rule blocks under a single name, you'd have to duplicate the common parts. Merging would indeed be a nice feature to have in the future as well. |
How about:
Then, in your architecture file:
|
I have CPU definition, but for various purposes I want to alias one thing to another. For example, something like this.
This would allow
reg_a
to be used anywhere a register would be used. Alternatively, being able to extend an existing subruledef would work as well.The text was updated successfully, but these errors were encountered: