-
Notifications
You must be signed in to change notification settings - Fork 150
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
Consider reformat of pushw assembly instruction #44
Comments
Another option worth considering is removing separation between
|
Another, more radical, idea that came to mind: maybe we should re-factor all assembly i/o instructions to be grouped around four verbs:
At the same time, I'm not sure if this provides more or less intuitive understanding about the instruction semantics. |
My take on these, in reverse order - I prefer the last option. I think it's clear, and it groups everything semantically by the effect on stack. My notes are:
Regarding removing separation between push and pushw (variable length inputs)I'm trying to think about how single hexadecimal input value of 32 bytesI think at a minimum it makes sense to accept a word input in addition to the 4 element option. This was what I expected when I first saw the instruction name |
I agree that organizing input/output instructions around four verbs: With the current scheme, this can be accomplished like |
I think in that case adding a new verb would make sense, and that doesn't really seem problematic to me. In fact - it could be a useful signal that a new and different thing is going on. But the central question is really just whether you'd rather organize first by "what" is happening or by "where" it's happening. I like the "what" approach, because it seems like it gives a more natural and consistent organization. However, as long as things are consistent it's just a choice & I think both styles are defensible Are there many (any) other possible future instructions you have in mind at this point? |
I like the "what" approach better too. So, at this point, it seems like we've settled on what.where and the operations we have so far are: Pushing value onto the stack:
Removing values from the stack:
Overwrite the values on the stack:
Save the stack value:
One other thing to consider: depending on what we decide to do in #73, we will need to have another destination (e.g., |
I think it might be clearer to keep the w in all cases where we're operating by word rather than by element. (That's all of the ops for I will reiterate my vote from above for |
Supersede by #84 |
As discussed in the PR implementing parsing of pushw, it may make sense to allow the pushw instruction to take a single 32-byte hex value either instead of or in addition to the current approach of taking 4 inputs of 1 element each.
This is inspired by this contrived but strange example with the current implementation:
let op = Token::new("pushw.1.23.0x1C8.0", 0);
From Bobbin:
"now that I'm seeing how this actually looks, I wonder if we should change the format of pushw instruction to always take a single hexadecimal value of 32 bytes. Or maybe making this as an additional allowed format. So, for example, possible formats could be:
pushw.1.2.3.4
pushw.0x13244... (32 bytes)"
The text was updated successfully, but these errors were encountered: