-
Notifications
You must be signed in to change notification settings - Fork 863
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
Critique of #1853: the new get_csrs
extension method is unnecessary, and has negative side effect
#1863
Comments
Also note that, the initialization of custom CSR's may require access to the processor instance (i.e. to inspect a relevant feature / state of the processor). This is why there is already But the new But this all smells too hacky for a public interface between spike and extensions; and it most likely will confuse extension developers who knows about |
I agree with your critique of #1853 breaking the CSR initialization pattern. As a solution, I disagree that |
If an extension introduces custom CSR's to the processor, isn't it by definition modifying (extending) the processor's state? The bright side of With your proposed solution, extensions developers would have to dig into spike's internal implementation (not just public interfaces) to find out that |
PR #1853 added a new
get_csrs
method to the public interface ofextension_t
, claiming to solve the alleged problem that "adding custom CSR's from extension modules was impossible". This was a false claim -- we don't need a new method for this (explained below) -- worse still, PR #1853 introduced a negative side effect causing changed CSR states to survive processor reset.Before #1853, it was indeed possible to add custom CSR's from the
extension_t::reset()
method, i.e.,This does not require changing the public interface of extensions. And it ensures custom CSR's resume to their default states upon processor reset. We should keep it the old way.
In fact, all standard CSR's are being (re-)added during processor reset (call path
processor_t::reset()
->state_t::reset()
->csr_init()
). When we add custom CSR's fromextension_t::reset
, they equally have a chance of being reset (re-added) during processor reset (call pathprocessor_t::reset()
->extension_t::reset()
).IMHO, what we actually need is an example of adding custom CSR's from extensions, and CI tests to make sure this works (PR #1853 has its merits in this regard). But changes to
extension.h
andprocessor.cc
should perhaps be reverted.The text was updated successfully, but these errors were encountered: