Skip to content
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] Fix assembling of register values in compressed instructions #129

Closed
Tracked by #125
mortbopet opened this issue Oct 2, 2021 · 1 comment
Closed
Tracked by #125

Comments

@mortbopet
Copy link
Owner

Currently, any register can be passed to compressed instructions and the instruction will assemble successfully - this is an error; only a subset of the registers can be referenced in the compressed instructions.
This should be caught by the Register class itself when it's trying to write a value that is larger than the bitrange which has been assigned to that register. Currently, any value can be returned from m_isa->regNumber(regToken, success); and applied successfully:

const unsigned reg = m_isa->regNumber(regToken, success);
if (!success) {
return Error(line.sourceLine, "Unknown register '" + regToken + "'");
}
instruction |= m_range.apply(reg);
return std::nullopt;

This "might" be an issue with the BitRange itself given that it doesn't check whether a value is wider than its mask:
https://github.com/mortbopet/Ripes/blob/master/src/assembler/instruction.h#L30

@mortbopet
Copy link
Owner Author

fixed by 4330e57.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant