[LispM-Hackers] Bug in SSDN2 Macroinstruction Notes

James A. Crippen james@unlambda.com
07 Jan 2002 14:23:25 -0900


Nyef <nyef@softhome.net> writes:

> On 6 Jan 2002, James A. Crippen wrote:
> 
> > I've discovered what I'm pretty sure is a bunch of bugs in the SSDN2
> > description of the macroinstruction formats (the first part of the
> > chapter on macroinsns).  I hope to outline why I think these are bugs
> > and would like people to comment.
> >
> > Consider the format of a mainop:
> >
> >   FEDC BA98 7654 3210
> >   cccc cccc bbbo oooo
> >   c -- opcode
> >   b -- base register
> >   o -- offset
> >
> > It's given that all mainops have to have at least an opcode.  The base
> > register and offset can be put to other purposes, if the particular op
> > needs them used differently.  For this reason I believe that the
> > diagram of immedops given in the SSDN2 is incorrect, ie:
> 
> I believe that you will find that the bug is an off-by-one error in the
> ASCII-art for the diagram for the case of a MAINOP with a base register
> value of 3 on page 20-3. The offset field on a MAINOP is 6 bits <5:0> and
> the base field is 3 <8:6>, leaving 7 bits <15:9> for the opcode.
> Everything else appears to be consistant with this interpretation.

That's exactly what I needed to hear.  I was looking at the constants
in def-elroy.lisp and they weren't matching up with what I had
supposed.  Your comment is reassuring.

I think that the diagram for auxops is wrong.  Given that mainops have
7 bits of opcode, the various flavors of auxop should only have 7
constant zeros, not 8.  So for auxops the <15:9> field should be zero,
but bit 8 is part of the auxop number.  This would explain why auxops
with a count have the 8 bit set -- to differentiate them from the
other auxops.

I'm going to go ahead and adjust the sources accordingly.  There are
only a few spots that need fixing, I think.

Does anybody know what to make of UCODE;LROY-TEMPLATES.LISP?
Certainly these are the field templates, and what we should be working
from.  But where the hell are MAKE-TEMPLATE and MAKE-PARSE defined?  I
can't find them anywhere in my sources.  Does anyone with an Explorer
wish to grep their system for those two functions?  I'd like to know
what they do and particularly how to interpret their arguments.
'(nil nil ((0 2 1))) doesn't make much sense to me.

The one nice thing I noticed in lroy-templates.lisp was that most of
the three insn groups can be subdivided into smaller groups.  Now what
we need to know is how to determine what bits are used to separate
them.  (The auxop groups are pretty obvious though.)

Oh, and what the heck are FORWARD and BACK supposed to mean for branch
instructions?  Whether they branch to an offset less than the current
PC?  Huh?

'james

-- 
James A. Crippen <james@unlambda.com> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.20939N, -149.767W
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.