[Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization

Aleksandar Markovic posted 14 patches 6 years, 8 months ago
Maintainers: Aleksandar Rikalo <arikalo@wavecomp.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Aurelien Jarno <aurelien@aurel32.net>
There is a newer version of this series
[Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Aleksandar Markovic 6 years, 8 months ago
From: Aleksandar Markovic <amarkovic@wavecomp.com>

Add graphical description of nanoMIPS instruction pool organization.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 disas/nanomips.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)

diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 10f6d96..9b44208 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -16592,6 +16592,108 @@ std::string NMD::YIELD(uint64 instruction)
 
 
 
+/*
+ *                nanoMIPS instruction pool organization
+ *                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *
+ *                 ┌─ P.ADDIU ─── P.RI ─── P.SYSCALL
+ *                 │
+ *                 │                                      ┌─ P.TRAP
+ *                 │                                      │
+ *                 │                      ┌─ _POOL32A0_0 ─┼─ P.CMOVE
+ *                 │                      │               │
+ *                 │                      │               └─ P.SLTU
+ *                 │        ┌─ _POOL32A0 ─┤
+ *                 │        │             │
+ *                 │        │             │
+ *                 │        │             └─ _POOL32A0_1 ─── CRC32
+ *                 │        │
+ *                 ├─ P32A ─┤
+ *                 │        │                           ┌─ PP.LSX
+ *                 │        │             ┌─ P.LSX ─────┤
+ *                 │        │             │             └─ PP.LSXS
+ *                 │        └─ _POOL32A7 ─┤
+ *                 │                      │             ┌─ POOL32Axf_4
+ *                 │                      └─ POOL32Axf ─┤
+ *                 │                                    └─ POOL32Axf_5
+ *                 │
+ *                 ├─ PBAL
+ *                 │
+ *                 ├─ P.GP.W   ┌─ PP.LSX
+ *         ┌─ P32 ─┤           │
+ *         │       ├─ P.GP.BH ─┴─ PP.LSXS
+ *         │       │
+ *         │       ├─ P.J ─────── PP.BALRSC
+ *         │       │
+ *         │       ├─ P48I
+ *         │       │           ┌─ P.SR
+ *         │       │           │
+ *         │       │           ├─ P.SHIFT
+ *         │       │           │
+ *         │       ├─ P.U12 ───┼─ P.ROTX
+ *         │       │           │
+ *         │       │           ├─ P.INS
+ *         │       │           │
+ *         │       │           └─ P.EXT
+ *         │       │
+ *         │       ├─ P.LS.U12 ── P.PREF.U12
+ *         │       │
+ *         │       ├─ P.BR1 ───── P.BR3A
+ *         │       │
+ *         │       │           ┌─ P.LS.S0 ─── P16.SYSCALL
+ *         │       │           │
+ *         │       │           │           ┌─ P.LL
+ *         │       │           ├─ P.LS.S1 ─┤
+ *         │       │           │           └─ P.SC
+ *         │       │           │
+ *         │       │           │           ┌─ P.PREFE
+ *  MAJOR ─┤       ├─ P.LS.S9 ─┤           │
+ *         │       │           ├─ P.LS.E0 ─┼─ P.LLE
+ *         │       │           │           │
+ *         │       │           │           └─ P.SCE
+ *         │       │           │
+ *         │       │           ├─ P.LS.WM
+ *         │       │           │
+ *         │       │           └─ P.LS.UAWM
+ *         │       │
+ *         │       │
+ *         │       ├─ P.BR2
+ *         │       │
+ *         │       ├─ P.BRI
+ *         │       │
+ *         │       └─ P.LUI
+ *         │
+ *         │
+ *         │       ┌─ P16.MV ──── P16.RI ─── P16.SYSCALL
+ *         │       │
+ *         │       ├─ P16.SR
+ *         │       │
+ *         │       ├─ P16.SHIFT
+ *         │       │
+ *         │       ├─ P16.4x4
+ *         │       │
+ *         │       ├─ P16C ────── POOL16C_0 ── POOL16C_00
+ *         │       │
+ *         └─ P16 ─┼─ P16.LB
+ *                 │
+ *                 ├─ P16.A1
+ *                 │
+ *                 ├─ P16.LH
+ *                 │
+ *                 ├─ P16.A2 ──── P.ADDIU[RS5]
+ *                 │
+ *                 ├─ P16.ADDU
+ *                 │
+ *                 └─ P16.BR ──┬─ P16.JRC
+ *                             │
+ *                             └─ P16.BR1
+ *
+ *
+ *  (FP, DPS, and some minor instruction pools are omitted from the diagram)
+ *
+ */
+
 NMD::Pool NMD::P_SYSCALL[2] = {
     { instruction         , 0                   , 0   , 32,
        0xfffc0000, 0x00080000, &NMD::SYSCALL_32_      , 0,
-- 
2.7.4


Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Philippe Mathieu-Daudé 6 years, 8 months ago
On 3/4/19 10:08 PM, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Add graphical description of nanoMIPS instruction pool organization.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  disas/nanomips.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 102 insertions(+)
> 
> diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
> index 10f6d96..9b44208 100644
> --- a/disas/nanomips.cpp
> +++ b/disas/nanomips.cpp
> @@ -16592,6 +16592,108 @@ std::string NMD::YIELD(uint64 instruction)
>  
>  
>  
> +/*
> + *                nanoMIPS instruction pool organization
> + *                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + *
> + *                 ┌─ P.ADDIU ─── P.RI ─── P.SYSCALL
> + *                 │
> + *                 │                                      ┌─ P.TRAP
> + *                 │                                      │
> + *                 │                      ┌─ _POOL32A0_0 ─┼─ P.CMOVE
> + *                 │                      │               │
> + *                 │                      │               └─ P.SLTU
> + *                 │        ┌─ _POOL32A0 ─┤
> + *                 │        │             │
> + *                 │        │             │
> + *                 │        │             └─ _POOL32A0_1 ─── CRC32
> + *                 │        │
> + *                 ├─ P32A ─┤
> + *                 │        │                           ┌─ PP.LSX
> + *                 │        │             ┌─ P.LSX ─────┤
> + *                 │        │             │             └─ PP.LSXS
> + *                 │        └─ _POOL32A7 ─┤
> + *                 │                      │             ┌─ POOL32Axf_4
> + *                 │                      └─ POOL32Axf ─┤
> + *                 │                                    └─ POOL32Axf_5
> + *                 │
> + *                 ├─ PBAL
> + *                 │
> + *                 ├─ P.GP.W   ┌─ PP.LSX
> + *         ┌─ P32 ─┤           │
> + *         │       ├─ P.GP.BH ─┴─ PP.LSXS
> + *         │       │
> + *         │       ├─ P.J ─────── PP.BALRSC
> + *         │       │
> + *         │       ├─ P48I
> + *         │       │           ┌─ P.SR
> + *         │       │           │
> + *         │       │           ├─ P.SHIFT
> + *         │       │           │
> + *         │       ├─ P.U12 ───┼─ P.ROTX
> + *         │       │           │
> + *         │       │           ├─ P.INS
> + *         │       │           │
> + *         │       │           └─ P.EXT
> + *         │       │
> + *         │       ├─ P.LS.U12 ── P.PREF.U12
> + *         │       │
> + *         │       ├─ P.BR1 ───── P.BR3A
> + *         │       │
> + *         │       │           ┌─ P.LS.S0 ─── P16.SYSCALL
> + *         │       │           │
> + *         │       │           │           ┌─ P.LL
> + *         │       │           ├─ P.LS.S1 ─┤
> + *         │       │           │           └─ P.SC
> + *         │       │           │
> + *         │       │           │           ┌─ P.PREFE
> + *  MAJOR ─┤       ├─ P.LS.S9 ─┤           │
> + *         │       │           ├─ P.LS.E0 ─┼─ P.LLE
> + *         │       │           │           │
> + *         │       │           │           └─ P.SCE
> + *         │       │           │
> + *         │       │           ├─ P.LS.WM
> + *         │       │           │
> + *         │       │           └─ P.LS.UAWM
> + *         │       │
> + *         │       │
> + *         │       ├─ P.BR2
> + *         │       │
> + *         │       ├─ P.BRI
> + *         │       │
> + *         │       └─ P.LUI
> + *         │
> + *         │
> + *         │       ┌─ P16.MV ──── P16.RI ─── P16.SYSCALL
> + *         │       │
> + *         │       ├─ P16.SR
> + *         │       │
> + *         │       ├─ P16.SHIFT
> + *         │       │
> + *         │       ├─ P16.4x4
> + *         │       │
> + *         │       ├─ P16C ────── POOL16C_0 ── POOL16C_00
> + *         │       │
> + *         └─ P16 ─┼─ P16.LB
> + *                 │
> + *                 ├─ P16.A1
> + *                 │
> + *                 ├─ P16.LH
> + *                 │
> + *                 ├─ P16.A2 ──── P.ADDIU[RS5]
> + *                 │
> + *                 ├─ P16.ADDU
> + *                 │
> + *                 └─ P16.BR ──┬─ P16.JRC
> + *                             │
> + *                             └─ P16.BR1

Nice ASCII tree! And you got it fits the 80 chars per line limit =)

> + *
> + *
> + *  (FP, DPS, and some minor instruction pools are omitted from the diagram)
> + *
> + */
> +
>  NMD::Pool NMD::P_SYSCALL[2] = {
>      { instruction         , 0                   , 0   , 32,
>         0xfffc0000, 0x00080000, &NMD::SYSCALL_32_      , 0,
> 

Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Aleksandar Markovic 6 years, 8 months ago
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> Subject: Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of > pool organization
> 
> On 3/4/19 10:08 PM, Aleksandar Markovic wrote:
> > From: Aleksandar Markovic <amarkovic@wavecomp.com>
> >
> > Add graphical description of nanoMIPS instruction pool organization.
> >
> > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> > ---
> >  disas/nanomips.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 102 insertions(+)
> >
> > diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
> > index 10f6d96..9b44208 100644
> > --- a/disas/nanomips.cpp
> > +++ b/disas/nanomips.cpp
> > @@ -16592,6 +16592,108 @@ std::string NMD::YIELD(uint64 instruction)
> >
> >
> >
> > +/*
> > + *                nanoMIPS instruction pool organization
> > + *                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > + *
> > + *
> > + *                 ┌─ P.ADDIU ─── P.RI ─── P.SYSCALL
> > + *                 │
> > + *                 │                                      ┌─ P.TRAP
> > + *                 │                                      │
> > + *                 │                      ┌─ _POOL32A0_0 ─┼─ P.CMOVE
> > + *                 │                      │               │
> > + *                 │                      │               └─ P.SLTU
> > + *                 │        ┌─ _POOL32A0 ─┤
> > + *                 │        │             │
> > + *                 │        │             │
> > + *                 │        │             └─ _POOL32A0_1 ─── CRC32
> > + *                 │        │
> > + *                 ├─ P32A ─┤
> > + *                 │        │                           ┌─ PP.LSX
> > + *                 │        │             ┌─ P.LSX ─────┤
> > + *                 │        │             │             └─ PP.LSXS
> > + *                 │        └─ _POOL32A7 ─┤
> > + *                 │                      │             ┌─ POOL32Axf_4
> > + *                 │                      └─ POOL32Axf ─┤
> > + *                 │                                    └─ POOL32Axf_5
> > + *                 │
> > + *                 ├─ PBAL
> > + *                 │
> > + *                 ├─ P.GP.W   ┌─ PP.LSX
> > + *         ┌─ P32 ─┤           │
> > + *         │       ├─ P.GP.BH ─┴─ PP.LSXS
> > + *         │       │
> > + *         │       ├─ P.J ─────── PP.BALRSC
> > + *         │       │
> > + *         │       ├─ P48I
> > + *         │       │           ┌─ P.SR
> > + *         │       │           │
> > + *         │       │           ├─ P.SHIFT
> > + *         │       │           │
> > + *         │       ├─ P.U12 ───┼─ P.ROTX
> > + *         │       │           │
> > + *         │       │           ├─ P.INS
> > + *         │       │           │
> > + *         │       │           └─ P.EXT
> > + *         │       │
> > + *         │       ├─ P.LS.U12 ── P.PREF.U12
> > + *         │       │
> > + *         │       ├─ P.BR1 ───── P.BR3A
> > + *         │       │
> > + *         │       │           ┌─ P.LS.S0 ─── P16.SYSCALL
> > + *         │       │           │
> > + *         │       │           │           ┌─ P.LL
> > + *         │       │           ├─ P.LS.S1 ─┤
> > + *         │       │           │           └─ P.SC
> > + *         │       │           │
> > + *         │       │           │           ┌─ P.PREFE
> > + *  MAJOR ─┤       ├─ P.LS.S9 ─┤           │
> > + *         │       │           ├─ P.LS.E0 ─┼─ P.LLE
> > + *         │       │           │           │
> > + *         │       │           │           └─ P.SCE
> > + *         │       │           │
> > + *         │       │           ├─ P.LS.WM
> > + *         │       │           │
> > + *         │       │           └─ P.LS.UAWM
> > + *         │       │
> > + *         │       │
> > + *         │       ├─ P.BR2
> > + *         │       │
> > + *         │       ├─ P.BRI
> > + *         │       │
> > + *         │       └─ P.LUI
> > + *         │
> > + *         │
> > + *         │       ┌─ P16.MV ──── P16.RI ─── P16.SYSCALL
> > + *         │       │
> > + *         │       ├─ P16.SR
> > + *         │       │
> > + *         │       ├─ P16.SHIFT
> > + *         │       │
> > + *         │       ├─ P16.4x4
> > + *         │       │
> > + *         │       ├─ P16C ────── POOL16C_0 ── POOL16C_00
> > + *         │       │
> > + *         └─ P16 ─┼─ P16.LB
> > + *                 │
> > + *                 ├─ P16.A1
> > + *                 │
> > + *                 ├─ P16.LH
> > + *                 │
> > + *                 ├─ P16.A2 ──── P.ADDIU[RS5]
> > + *                 │
> > + *                 ├─ P16.ADDU
> > + *                 │
> > + *                 └─ P16.BR ──┬─ P16.JRC
> > + *                             │
> > + *                             └─ P16.BR1
> 
> Nice ASCII tree! And you got it fits the 80 chars per line limit =)
> 

Too bad we don't have a mark "Enjoyed-by:" ;).

Yes, it does fit 80 characters limit. It was created manually. I stumbled
upon https://pythonhosted.org/asciitree/#ascii-trees the other day, but
never used it, you may find it useful.

By the way, there is a serious science on creating such trees in the most
compact or balanced way. See, for example, Reingold-Tilford algorithm
("Tidier Drawings of Trees", 1981).

Aleksandar
Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Philippe Mathieu-Daudé 6 years, 8 months ago
On 3/5/19 1:39 PM, Aleksandar Markovic wrote:
>> From: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Subject: Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of > pool organization
>>
>> On 3/4/19 10:08 PM, Aleksandar Markovic wrote:
>>> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>>>
>>> Add graphical description of nanoMIPS instruction pool organization.
>>>
>>> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
>>> ---
>>>  disas/nanomips.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 102 insertions(+)
>>>
>>> diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
>>> index 10f6d96..9b44208 100644
>>> --- a/disas/nanomips.cpp
>>> +++ b/disas/nanomips.cpp
>>> @@ -16592,6 +16592,108 @@ std::string NMD::YIELD(uint64 instruction)
>>>
>>>
>>>
>>> +/*
>>> + *                nanoMIPS instruction pool organization
>>> + *                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> + *
>>> + *
>>> + *                 ┌─ P.ADDIU ─── P.RI ─── P.SYSCALL
>>> + *                 │
>>> + *                 │                                      ┌─ P.TRAP
>>> + *                 │                                      │
>>> + *                 │                      ┌─ _POOL32A0_0 ─┼─ P.CMOVE
>>> + *                 │                      │               │
>>> + *                 │                      │               └─ P.SLTU
>>> + *                 │        ┌─ _POOL32A0 ─┤
>>> + *                 │        │             │
>>> + *                 │        │             │
>>> + *                 │        │             └─ _POOL32A0_1 ─── CRC32
>>> + *                 │        │
>>> + *                 ├─ P32A ─┤
>>> + *                 │        │                           ┌─ PP.LSX
>>> + *                 │        │             ┌─ P.LSX ─────┤
>>> + *                 │        │             │             └─ PP.LSXS
>>> + *                 │        └─ _POOL32A7 ─┤
>>> + *                 │                      │             ┌─ POOL32Axf_4
>>> + *                 │                      └─ POOL32Axf ─┤
>>> + *                 │                                    └─ POOL32Axf_5
>>> + *                 │
>>> + *                 ├─ PBAL
>>> + *                 │
>>> + *                 ├─ P.GP.W   ┌─ PP.LSX
>>> + *         ┌─ P32 ─┤           │
>>> + *         │       ├─ P.GP.BH ─┴─ PP.LSXS
>>> + *         │       │
>>> + *         │       ├─ P.J ─────── PP.BALRSC
>>> + *         │       │
>>> + *         │       ├─ P48I
>>> + *         │       │           ┌─ P.SR
>>> + *         │       │           │
>>> + *         │       │           ├─ P.SHIFT
>>> + *         │       │           │
>>> + *         │       ├─ P.U12 ───┼─ P.ROTX
>>> + *         │       │           │
>>> + *         │       │           ├─ P.INS
>>> + *         │       │           │
>>> + *         │       │           └─ P.EXT
>>> + *         │       │
>>> + *         │       ├─ P.LS.U12 ── P.PREF.U12
>>> + *         │       │
>>> + *         │       ├─ P.BR1 ───── P.BR3A
>>> + *         │       │
>>> + *         │       │           ┌─ P.LS.S0 ─── P16.SYSCALL
>>> + *         │       │           │
>>> + *         │       │           │           ┌─ P.LL
>>> + *         │       │           ├─ P.LS.S1 ─┤
>>> + *         │       │           │           └─ P.SC
>>> + *         │       │           │
>>> + *         │       │           │           ┌─ P.PREFE
>>> + *  MAJOR ─┤       ├─ P.LS.S9 ─┤           │
>>> + *         │       │           ├─ P.LS.E0 ─┼─ P.LLE
>>> + *         │       │           │           │
>>> + *         │       │           │           └─ P.SCE
>>> + *         │       │           │
>>> + *         │       │           ├─ P.LS.WM
>>> + *         │       │           │
>>> + *         │       │           └─ P.LS.UAWM
>>> + *         │       │
>>> + *         │       │
>>> + *         │       ├─ P.BR2
>>> + *         │       │
>>> + *         │       ├─ P.BRI
>>> + *         │       │
>>> + *         │       └─ P.LUI
>>> + *         │
>>> + *         │
>>> + *         │       ┌─ P16.MV ──── P16.RI ─── P16.SYSCALL
>>> + *         │       │
>>> + *         │       ├─ P16.SR
>>> + *         │       │
>>> + *         │       ├─ P16.SHIFT
>>> + *         │       │
>>> + *         │       ├─ P16.4x4
>>> + *         │       │
>>> + *         │       ├─ P16C ────── POOL16C_0 ── POOL16C_00
>>> + *         │       │
>>> + *         └─ P16 ─┼─ P16.LB
>>> + *                 │
>>> + *                 ├─ P16.A1
>>> + *                 │
>>> + *                 ├─ P16.LH
>>> + *                 │
>>> + *                 ├─ P16.A2 ──── P.ADDIU[RS5]
>>> + *                 │
>>> + *                 ├─ P16.ADDU
>>> + *                 │
>>> + *                 └─ P16.BR ──┬─ P16.JRC
>>> + *                             │
>>> + *                             └─ P16.BR1
>>
>> Nice ASCII tree! And you got it fits the 80 chars per line limit =)
>>
> 
> Too bad we don't have a mark "Enjoyed-by:" ;).

There is an "Inspired-by:" although!

> Yes, it does fit 80 characters limit. It was created manually. I stumbled
> upon https://pythonhosted.org/asciitree/#ascii-trees the other day, but
> never used it, you may find it useful.

I'm tempted add it to the decodetree script...

> By the way, there is a serious science on creating such trees in the most
> compact or balanced way. See, for example, Reingold-Tilford algorithm
> ("Tidier Drawings of Trees", 1981).

Is this how nanoMIPS came with a rebalanced ISA?

Regards,

Phil.

Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Philippe Mathieu-Daudé 6 years, 8 months ago
On 3/5/19 3:07 PM, Philippe Mathieu-Daudé wrote:
> On 3/5/19 1:39 PM, Aleksandar Markovic wrote:
>>> From: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> On 3/4/19 10:08 PM, Aleksandar Markovic wrote:
>>>> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>>>>
>>>> Add graphical description of nanoMIPS instruction pool organization.
>>>>
[...]
>> Yes, it does fit 80 characters limit. It was created manually. I stumbled
>> upon https://pythonhosted.org/asciitree/#ascii-trees the other day, but
>> never used it, you may find it useful.
> 
> I'm tempted add it to the decodetree script...

"I'm tempted [to] add it" ...
(I'm not suggesting you to add it)

Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
Posted by Aleksandar Markovic 6 years, 8 months ago
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> Subject: Re: [Qemu-devel] [PATCH v7 02/14] disas: nanoMIPS: Add graphical description of pool organization
> 
> >> ... upon https://pythonhosted.org/asciitree/#ascii-trees the other day, but
> >> never used it, you may find it useful.
> >
> > I'm tempted add it to the decodetree script...
> 
> "I'm tempted [to] add it" ...
> (I'm not suggesting you to add it)

All is well, Philippe, I understood it from the beginning as you originally meant.

Aleksandar