Em 05-04-2018 11:09, Rishiyur Nikhil escreveu:
> BACKGROUND: In the text specification, there are a number of places
> where it is not clear what happens when an architectural spec
> parameter is itself changed. We've already seen some discussion
> about dynamic changes to MISA.C but other examples would be changing
> MISA.MXL, disabling one or more floating point extensions, ... Some
> of these transitions have been given (or are being given) detailed
> specs, such as MISA.C transitions, but others may be implementation
> defined.
>
> QUESTION from the ISA Formal Spec Group: in general, how should such
> transitions be modeled, formally?
>
> PROPOSAL: We propose that (excepting transitions for which a more
> detailed spec has been given), that the general way to model such
> transitions is an /*opaque but deterministic function*/ that is applied
> to the machine state to transform it. I.e., each implementation
> does some implementation-specific, deterministic, transformation to
> the state (including possibly a no-op).
>
> We are keen to avoid introducing non-determinism into the formal
> spec except where it is absolutely required (e.g., in the mem model
> orderings, etc.), because unnecessary non-determinism would
> complicate the semantic model considerably.
Sounds good to me, but I think the definition should be a tiny bit
stronger: the "implementation-specific" part should be restricted as to
which parts of the state it can touch. For instance, disabling or
enabling the floating point extensions shouldn't touch the virtual
memory CSRs or the interrupt CSRs (in fact, it should touch no
non-float-related registers at all). That puts a boundary around the
effects of each transition, which should make them simpler to model and
understand.
Yeah, MISA.MXL is the worst one, since XLEN touches nearly everything,
including registers directly affecting the currently executing code (the
program counter, memory protection registers, ...) That particular
transition needs to have its effect on several CSRs explicitly specified
(the program counter sign-extends, the memory protection registers are
mapped to their equivalents, perhaps others), otherwise there can be no
guaranteed way for software to do the XLEN transition reliably.
Also, what about hidden state? Taking floating point again as an
example, suppose the software disables all floating point extensions,
and later enables them again. What happens to the floating point
registers? There are three possible deterministic outcomes:
1. All floating-point registers are reset to a fixed value;
2. Some floating-point registers are reset, some keep their value;
3. All floating-point registers keep their old value.
The last two options have "hidden" state, which was not accessible while
there were no enabled instructions which could access it. The first
option has no hidden state.
(There was some argument in the MISA.C discussion over a single bit of
hidden state, so it should be important to be clear about whether or not
hidden state is allowed. My personal opinion is that hidden state should
be allowed, but it shouldn't be able to affect anything while it's hidden.)
--
Cesar Eduardo Barros
ces...@cesarb.eti.br