[Oberon] On a code generated for Math.Mod.txt
Peter De Wachter
pdewacht at gmail.com
Wed Jul 13 23:33:51 CEST 2016
The disassembly of ORTool can be misleading, I suspect the module
predates the current revision of the RISC architecture. Try applying
the attached patch, it should make it a bit clearer. With that and the
RISC Architecture document you should be able to figure it out.
On Wed, Jul 13, 2016 at 9:18 PM, Srinivas Nayak
<sinu.nayak2001 at gmail.com> wrote:
> In math.Mod.txt we see
>
> q0 = 9.9999999E-1;
> IF ODD(n) THEN f := (((((q6*yy + q5)*yy + q4)*yy + q3)*yy + q2)*yy + q1)*yy
> + q0
>
> ELSE
>
> For the last addition of q0, I see the code generated is:
>
> 61003F7F MOV' R1 R0 16255
>
> 4116FFFE IOR R1 R1 -2
>
> How it is different from
>
> 61003F80 MOV' R1 R0 16256
>
>
>
>
> With thanks and best regards,
>
> Yours sincerely,
> Srinivas Nayak
>
> Home: http://www.mathmeth.com/sn/
> Blog: http://srinivas-nayak.blogspot.in/
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
--- ORTool.Old.Mod 2016-07-13 23:31:59.462406325 +0200
+++ ORTool.New.Mod 2016-07-13 23:31:59.462406325 +0200
@@ -108,13 +108,14 @@
END WriteReg;
PROCEDURE opcode(w: LONGINT);
- VAR k, op, u, a, b, c: LONGINT;
+ VAR k, op, u, v, a, b, c: LONGINT;
BEGIN
k := w DIV 40000000H MOD 4;
a := w DIV 1000000H MOD 10H;
b := w DIV 100000H MOD 10H;
op := w DIV 10000H MOD 10H;
u := w DIV 20000000H MOD 2;
+ v := w DIV 10000000H MOD 2;
IF k = 0 THEN
Texts.WriteString(W, mnemo0[op]);
IF u = 1 THEN Texts.Write(W, "'") END ;
@@ -122,8 +123,9 @@
ELSIF k = 1 THEN
Texts.WriteString(W, mnemo0[op]);
IF u = 1 THEN Texts.Write(W, "'") END ;
- WriteReg(a); WriteReg(b); w := w MOD 10000H;
- IF w >= 8000H THEN w := w - 10000H END ;
+ WriteReg(a); IF op # 0 THEN WriteReg(b) END ;
+ w := w MOD 10000H;
+ IF v = 1 THEN w := w - 10000H END ;
Texts.WriteInt(W, w, 7)
ELSIF k = 2 THEN (*LDR/STR*)
IF u = 1 THEN Texts.WriteString(W, "STR ") ELSE Texts.WriteString(W, "LDR") END ;
More information about the Oberon
mailing list