[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] Supported Instructions




----- Original Message -----
From: Yann Guidon <whygee@f-cpu.org>
To: <f-cpu@seul.org>
Sent: Saturday, April 06, 2002 7:02 PM
Subject: Re: [f-cpu] Supported Instructions


> the emulation must be done in SW, so a few shifts and masks
> do the job. I wonder why you imagined.

Are you really sure ? you are too optimistic about such a thing.

Well, let us try an example :

mac r1,r2,r3 // r3 = r3 + r1*r2

So you think to get such fields is only a matter of a few shifts and masks ?
now I get their fields, what am I supposed to do with them ?

A code with a switch with direct registers access like it ?

switch (reg3)

    case 0:
        switch (reg2) {
           case 0;
                switch (reg3) {
                    case 0: { save r1; r1 = r0*r0; r0 += r1; restore r1;
break; }
                }
           case 1:
                switch (reg3) {
                    case 0: { save r2; r2 = r0*r1; r0 += r2; restore r2;
break; }
                }
            ... // 64 registers !!!!
        }
    case 1:
        switch (reg1) {
           case 0;
                switch (reg3) {
                    case 0: { save r2; r2 = r0*r0; r1 += r2; restore r2;
break; }
                }
           case 1:
                switch (reg3) {
                    case 0: { save r2; r2 = r0*r1; r1 += r2; restore r2;
break; }
                }
            ...
        }
    ...

Of course not !

Ok, you said registers are in fact saved in CMB, so we should get something
like :

cmb->r[reg3] += cmb->r[reg1] * cmb->r[reg2];

where cmb is the pointer of CMB of the task which triggers the invalid
instruction trap and reg1, reg2 and reg3 the three fields for register for our
"mac" instruction.

But don't forget we must also read the opcode first to know what we must to do.
Of course, if our opcode has few fixed bits it will help much more the job with
a lookup table.

> FP itself is at maybe 10x faster than emulated instructions, and FP is
> pipelinable.

Anyway, there's plenty of memory accesses and branching so don't think FPU will
just be 10x faster than a FPU emulator !!!

> so if you don't have a FPU, it's _necessarily_ slow.
> come on.

NECESSARILY, so we should aggree about the fact that FCPU brings us nothing new
or wonderful for emulation of missing instructions (in fact I don't see the
interest for an emulation, if you need some float operations, use a FCPU with a
FPU embedded).



*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/