[LMH] Re: [LMH]bored? read pages 7,8,9 and explain
Steve Krueger
stevelisp@grape-krueger.com
Mon, 30 Aug 2004 20:14:45 -0500
Brad Parker wrote:
> Hi,
>
> If anyone (1) bored, (2) interested in CADR architecture and (3)
> familiar with ldb and dpb, would you mind reading "A. I. memo 528" page
> 7,8 & 9
>
> and then talking with me about how the ldb and dpb parts of the byte
> instruction should work?
Hi Brad,
I can probably answer any question you might have.
I know how these instructions work and so find the description in AI
Memo 528 to be completely clear (well mostly clear). I suggest you pose
a question and I'll try to explain it. Maybe this programmers' summary
will help:
You use LDB to extract a bit field from a word, aligning it to the lsb
end of the word. If the A-SRC is all zero, this produces a result that
is zero extended. This is a very frequent operation. The rotation
count is the bit number that the field begins at, and the length is the
field width.
|<- len ->|<--- rot ---->|
+--------------------------------+
| | field | | M-SRC
+--------------------------------+
|<- len ->|
+--------------------------------+
|AAAAAAAAAAAAAAAAAAAAAA| field | RESULT
+--------------------------------+
"A" are bits from the A-SRC that are not modified. Only the len bits at
the right of the word are modified.
DPB is the logical opposite of LDB, it takes an lsb-justified bit field
and places it at the bit field described by the rotation and length.
|<- len ->|
+--------------------------------+
| | field | M-SRC
+--------------------------------+
|<- len ->|<--- rot ---->|
+--------------------------------+
|AAAAAAA| field |AAAAAAAAAAAAAA| RESULT
+--------------------------------+
"A" represents bits from the A-SRC that are not modified.
Selective deposite replaces the corresponding bits of the A-SRC with a
bit field from the M-SRC described by its position and length. It does
a DPB without actually rotating the M-SRC first.
|<- len ->|<--- rot ---->|
+--------------------------------+
| | field | | M-SRC
+--------------------------------+
|<- len ->|<--- rot ---->|
+--------------------------------+
|AAAAAAA| field |AAAAAAAAAAAAAA| RESULT
+--------------------------------+
"A" represents bits of the A-SRC that are not modified.
Note that the length is encoded in the microinstruction as length-1.
You could read the Q-DATATYPE field of a Lisp word into an untyped
(pure) number with:
((M-1) LDB M-T (BYTE 5. 25.) A-ZERO)
This encodes ROT as 25 decimal (31 octal) and length-1 as 4.
Note too that fields can be counted from the left instead of the right
by doing a bit of arithmetic on the position and width.
Does this help or are there more questions?
BTW, I don't think I found the left mask and right mask description
helpful when I read AI Memo 528 almost 25 years ago either.
-Steve