[Libre-soc-dev] compressed instructions state requirements

Jacob Lifshay programmerjake at gmail.com
Tue Nov 24 05:41:41 GMT 2020


On Mon, Nov 23, 2020, 19:33 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> On 11/24/20, Jacob Lifshay <programmerjake at gmail.com> wrote:
> > today:
> > working on a demo of how compressed instructions can be completely
> > backward compatible with PowerPC64LE's current ABI. Ran out of time
> > for today, will most likely work on it more tomorrow.
>
> star.
>
> was it clear about the fact that the two encodings require "state" to
> distinguish them? i.e. even though they are both LE compatible we
> cannot possibly allow the two encodings to intermingle without an
> instruction to swap the mode?
>
> question.  if you have:
>
> * a stream of standard LE v3.0B instructions
> * aa stream of half-word swapped instructions
>
> is it possible only from the stream to detwrmine which encoding is
> used with NO OTHER INFORMATION?
>

If the word-swapping scheme is as I described earlier and the only
instructions used are 32/64-bit 32-bit-aligned instructions, then they are
indistinguishable since they are the exact same bytes in the exact same
memory locations (assuming the standard PowerISA LE/BE etc. modes are
known). If the stream contains any 16 or 48-bit instructions, you also need
the twos place in the PC. If the stream contains any 16-bit instructions,
then you also need to know if the decoder should start in Standard or
Compressed Mode, and (assuming we include the
switch-to-standard-mode-for-1-instruction
bit) if the last instruction specified the
switch-to-standard-mode-for-1-instruction.

I renamed 32-bit mode to Standard Mode since it is the backward-compatible
mode and also supports 64-bit (ISA v3.1) and 48-bit (no spec yet)
instructions.

Compressed Mode is 16-bit only.

>
> this is a really important non-rhetorical  question that i would
> appreciate if you could answer plainly yes or no.
>

so, extra state beyond PowerISA v3.1 is needed:
the twos place of the PC. (needed for 16 and/or 48-bit instructions)
the decode mode (Standard/Compressed) -- 1 bit. (only needed for 16-bit
instructions)
the last instruction's switch-to-standard-mode-for-1-instruction bit (only
needed for 16-bit instructions with optional switch-to-standard-mode
-for-1-instruction).

If we don't mind compressed instructions always having only 10-bits of
space available, the only extra state required is the twos place of the PC.
No compressed mode necessary.

Hopefully that's plain enough.

>
> we can then analyse what to do next.
>
>
> > See "Demo of encoding that's backward-compatible with PowerISA v3.1 in
> > both LE and BE mode" in
> > https://libre-soc.org/openpower/sv/16_bit_compressed/
>
> ah that looks really good athough it looks like it should be in
> https://libre-soc.org/openpower/sv/major_opcode_allocation/  (for now)
>

Maybe, it might be better on its own page -- basically I wrote out all the
supporting info but never got to writing the actual demo... :P

Jacob


More information about the Libre-soc-dev mailing list