<div dir="ltr"><div dir="ltr">Some decades ago I was working on a project, and I made a table of inputs and outcomes. I looked at the table and said halfheartedly to my associate, "we need a jump on parity" Well, there was such an instruction, and the code became almost trivial.<div><br></div><div>see <a href="http://www.eastjesus.net/tech/crc/FastCRC.html">http://www.eastjesus.net/tech/crc/FastCRC.html</a></div><div><br></div><div>So my apologies, but I wonder if you could tell me again which processor the project uses, or even better to a detailed instruction set document for it.</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 24, 2018 at 1:39 PM Tomas Kral <<a href="mailto:thomas.kral@email.cz">thomas.kral@email.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 24 Oct 2018 19:15:56 +0200<br>
Tomas Kral <<a href="mailto:thomas.kral@email.cz" target="_blank">thomas.kral@email.cz</a>> wrote:<br>
<br>
> but how to access the<br>
> individual bits? <br>
<br>
There is also SYSTEM.BIT(a, n) checking a single bit in memory.<br>
Apologies, this is quite catchy and cannot let go yet. Rewritten in<br>
arrays and loops, still possibly of little or no use.<br>
<br>
MODULE Bits; (*TK 24.10.2018 Word Byte Bit SET masks example*)<br>
IMPORT S := SYSTEM, O := Out;<br>
<br>
CONST<br>
m0 = {0}; m1 = {1}; m2 = {2}; m3 = {3}; m4 = {4}; m5 = {5}; m6 = {6}; m7 = {7}; (*bit masks*)<br>
m0123 = {3,2,1,0}; (*lower nibble*) m4567 = {4,5,6,7}; (*upper nibble*)<br>
m16 = {0..15}; (*lower short*) m24 = {16..31}; (*upper short*)<br>
m31 = {0..31}; (*word*)<br>
<br>
VAR<br>
wd, i: INTEGER;<br>
b: ARRAY 4 OF BYTE; (*b[0]: LSB, b[3]: MSB*)<br>
(*bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7: BYTE;*) (*8 bits 0|1 values*)<br>
bit: ARRAY 8 OF BYTE;<br>
s: SET;<br>
<br>
PROCEDURE Show*;<br>
BEGIN<br>
wd := 0F3F2F1F0H; (*test word*)<br>
<br>
(*bytes)<br>
b[0] := wd MOD 100H; O.Hex(b[0]); O.Ln; (*shift = one cycle*)<br>
b[1] := wd DIV 100H MOD 100H; O.Hex(b[1]); O.Ln;<br>
b[2] := wd DIV 10000H MOD 100H; O.Hex(b[2]); O.Ln;<br>
b[3] := wd DIV 1000000H MOD 100H; O.Hex(b[3]); O.Ln; O.Ln;<br>
<br>
(*bits*)<br>
bit[0] := ORD(ODD(b[0])); O.Hex(bit[0]); O.Ln;<br>
bit[1] := b[1] MOD 2; O.Hex(bit[1]); O.Ln;<br>
bit[2] := b[2] DIV 2 MOD 2; O.Hex(bit[2]); O.Ln;<br>
bit[3] := b[3] DIV 4 MOD 2; O.Hex(bit[3]); O.Ln;<br>
<br>
(*s := S.VAL(SET, wd) * m4);*) (*using mask {4}*)<br>
<br>
bit[4] := b[3] DIV 8 MOD 2; O.Hex(bit[4]); O.Ln;<br>
bit[5] := b[3] DIV 16 MOD 2; O.Hex(bit[5]); O.Ln;<br>
bit[6] := b[3] DIV 32 MOD 2; O.Hex(bit[6]); O.Ln;<br>
bit[7] := b[0] DIV 64 MOD 2; O.Hex(bit[7]); O.Ln; O.Ln;<br>
<br>
(*set unrolled*)<br>
(*IF bit[0] > 0 THEN INCL(s, 0) END ;<br>
IF bit[1] > 0 THEN INCL(s, 1) END ;<br>
IF bit[2] > 0 THEN INCL(s, 2) END ;<br>
IF bit[3] > 0 THEN INCL(s, 3) END ;<br>
IF bit[4] > 0 THEN INCL(s, 4) END ;<br>
IF bit[5] > 0 THEN INCL(s, 5) END ;<br>
IF bit[6] > 0 THEN INCL(s, 6) END ;<br>
IF bit[7] > 0 THEN INCL(s, 7) END ;*)<br>
<br>
(*set in loop*)<br>
s := {}; FOR i := 0 TO 7 DO IF bit[i] > 0 THEN INCL(s, i) END END ;<br>
(*s := S.VAL(SET, wd) * (m0+m1+m2+m3);*) (*using mask {0..3}*)<br>
<br>
(*output byte hex & bin*)<br>
O.Hex(S.VAL(INTEGER, s)); O.Ln;<br>
O.Bin(S.VAL(INTEGER, s), 8); O.Ln<br>
END Show;<br>
<br>
BEGIN<br>
END Bits.Show<br>
<br>
<br>
-- <br>
Tomas Kral <<a href="mailto:thomas.kral@email.cz" target="_blank">thomas.kral@email.cz</a>><br>
--<br>
<a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Aubrey McIntosh, Ph.D.<div>1502 Devon Circle</div><div>Austin TX 78723</div><div>(512) 791-3801</div><div><br></div></div></div></div></div>