The RISC5 processor has an addressbus of 24 bits («adr» in RISC5.v = 16 MB possible). The PC and branch displacements are on word boundary, they have 22 bits («disp» in RISC5.v)
In short, I would have coded the procedures as follows:
PROCEDURE FixLink*(L: LONGINT); VAR L1: LONGINT; BEGIN WHILE L # 0 DO L1 := code[L] MOD 2000H; FixOne(L); L := L1 END END FixLink;
PROCEDURE FixLinkWith(L0, dst: LONGINT); (* used for «UNTIL» *) VAR L1: LONGINT; BEGIN WHILE L0 # 0 DO L1 := code[L0] MOD 2000H; fix(L0, dst - L0 - 1); L0 := L1 END END FixLinkWith;
Ok. Got it. This makes more sense. But it works only for ORG.maxCode = 8000, since 2000H = 8196. In my compilers ORG.maxCode usually is 12000 or even 16000. So with the above approach, I’d end up having to use 4000H = 16’384, i.e. the next higher power of 2 (for efficiency) anyway.. How about using C22 = 400000H (with FIVE zeros, not four!) = 4’194’304 = 2^22 instead of 2000H? That way, one would be... a) correct (max displacement = 22 bits), and b) “safe” even for all potential values of ORG.maxCode up 4’194’304 = 4M words = 16MB RAM. once and for good? -ap
Personally, I would use C22 in fix(). And «MOD maxCode» in FixLinx..() And try to make ORG.maxCode a power of two for efficiency reasons. But feel free to take C22 everywhere. br Jörg Gesendet von Mail für Windows 10 Von: Andreas Pirklbauer Gesendet: Sonntag, 23. September 2018 17:46 An: ETH Oberon and related systems Betreff: [Oberon] FJump and FixLink
The RISC5 processor has an addressbus of 24 bits («adr» in RISC5.v = 16 MB possible). The PC and branch displacements are on word boundary, they have 22 bits («disp» in RISC5.v)
In short, I would have coded the procedures as follows:
PROCEDURE FixLink*(L: LONGINT); VAR L1: LONGINT; BEGIN WHILE L # 0 DO L1 := code[L] MOD 2000H; FixOne(L); L := L1 END END FixLink;
PROCEDURE FixLinkWith(L0, dst: LONGINT); (* used for «UNTIL» *) VAR L1: LONGINT; BEGIN WHILE L0 # 0 DO L1 := code[L0] MOD 2000H; fix(L0, dst - L0 - 1); L0 := L1 END END FixLinkWith;
Ok. Got it. This makes more sense. But it works only for ORG.maxCode = 8000, since 2000H = 8196. In my compilers ORG.maxCode usually is 12000 or even 16000. So with the above approach, I’d end up having to use 4000H = 16’384, i.e. the next higher power of 2 (for efficiency) anyway.. How about using C22 = 400000H (with FIVE zeros, not four!) = 4’194’304 = 2^22 instead of 2000H? That way, one would be... a) correct (max displacement = 22 bits), and b) “safe” even for all potential values of ORG.maxCode up 4’194’304 = 4M words = 16MB RAM. once and for good? -ap -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (2)
-
Andreas Pirklbauer -
Jörg Straube