Am 19.05.2015 um 22:57 hat Peter Maydell geschrieben: > On 19 May 2015 at 21:52, John Snow <js...@redhat.com> wrote: > > Hmm, I think this is not purely derived state because the flags are not > > necessarily sufficient for regenerating that state. > > Yeah, if there's genuinely an underlying state machine that's > not completely visible in registers you need to actually model it. > You should probably then model the register bits by calculating > them from the state rather than by changing them as you go along > in parallel with moving the state machine around.
I think the combination of registers is actually enough to reconstruct what state we're in, so it is derived (otherwise I would have fixed a bug that I'm not aware of). Adding logic to derive it in a post-load handler should be good enough. The reason why I want to have it explicit anyway is that having the information spread across multiple registers is non-obvious and error-prone. Before this eries, most places only check some bits instead of the full combination. And they are correct in the sense that some states are never expected to happen in that specific place - but if it happens anyway (i.e. there is a bug) without the patches something undefined happens, whereas with the patches we catch it. And then there's the readability of the code, too, of course. Kevin