[squeak-dev] Anyone have any processors in Smalltalk or a formal semantics?

Eliot Miranda eliot.miranda at gmail.com
Fri Oct 31 15:52:24 UTC 2008


On Fri, Oct 31, 2008 at 4:21 AM, Gerardo Richarte <gera at corest.com> wrote:

> Eliot Miranda wrote:
> >     I wonder if anyone has any 32-bit processor implementations,
> > either in Smalltalk or in some other, preferrably easy-to-parse,
> > formal semantics.
>     I thought about this several times, but never came down to implement
> it: The Intel manuals do have a very concrete pseudocode for every
> instruction, and it does look quite parsable. I did start once, but the
> need for it disappeared, and I never finished...
>
> the description for ADD is:
>
> DEST $B"+(B DEST + SRC + CF;
>
> and for AAA (Ascii adjust after addition) is more complex:
> IF 64-Bit Mode
>    THEN
>         #UD;
>    ELSE
>         IF ((AL AND 0FH) > 9) or (AF = 1)
>               THEN
>                   AL $B"+(B AL + 6;
>                   AH $B"+(B AH + 1;
>                   AF $B"+(B 1;
>                   CF $B"+(B 1;
>                   AL $B"+(B AL AND 0FH;
>               ELSE
>                   AF $B"+(B 0;
>                   CF $B"+(B 0;
>                   AL $B"+(B AL AND 0FH;
>         FI;
> FI;
>
>    I think it really is an option to write a compiler from PDF to
> Smalltalk :)
>
>    richie


Superficially this looks good.  But it is only a part of the semantics.
 This is a fairly abstract semantics.  It leaves out definitions of
registers (e.g. DEST $B"+(B DEST + SRC + CF;) and all the instruction decode,
which on x86 is complex and easy to screw up.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20081031/ac8e99d3/attachment.htm


More information about the Squeak-dev mailing list