IF PhA
THEN
BEGIN
top, bot, size: [0..depth] ← depth;
delta:INT[-2..+2] ← 0;
Dragon.Assert[NOT(IStkPushBA AND PushLevel3BA)];
pushYoungestA ← IStkPushBA OR PushLevel3BA;
popYoungestA ← IStkPopBA;
pushEldestA ← c3 = ifuEldestPC;
popEldestA ← b0 = ifuEldestPC;
wasEmpty ← FALSE;
IF pushYoungestA THEN delta ← delta+1;
IF popYoungestA THEN delta ← delta-1;
IF pushEldestA THEN delta ← delta+1;
IF popEldestA THEN delta ← delta-1;
Dragon.Assert[NOT pushEldestA OR NOT popEldestA, "Not Both at once"];
Dragon.Assert[NOT pushYoungestA OR NOT popYoungestA, "Not Both at once"];
FOR i: NAT IN [0..depth) DO iStk[i].valid[a] ← iStk[i].valid[b] ENDLOOP;
FOR i:
NAT
IN [0..depth)
DO
IF Valid[i] AND NOT Valid[i+ 1] THEN top ← i;
IF Valid[i] AND NOT Valid[i+m1] THEN bot ← i;
ENDLOOP;
IF top=depth
OR bot=depth
THEN {
Dragon.Assert[top=depth AND bot=depth, "Both or neither"];
top ← 0; bot ← 1; wasEmpty ← TRUE;
IF Valid[0] THEN Dragon.Assert[FALSE, "IStack completely full"]};
size ← (top+(depth-bot)+1) MOD depth;
SELECT delta+size
FROM
<0 => Dragon.Assert[FALSE, "IStack Underflowed"];
=0 => {IStkEmptyA ← TRUE; IStkTooFullA ← FALSE};
IN(0..depth-gap] => {IStkEmptyA ← FALSE; IStkTooFullA ← FALSE};
ENDCASE => {IStkEmptyA ← FALSE; IStkTooFullA ← TRUE};
iStk[(top+1)
MOD depth] ←
[ p:Dragon.LFD[Lev3PBA], l:BitOps.ECFW[Lev3LBA, lwx, 0, lwx] ];
SELECT
TRUE
FROM
b0
IN [ifuYoungestL..ifuEldestPC] => {
Dragon.Assert[ NOT wasEmpty ];
SELECT b0
FROM
ifuYoungestL => XBus ← BitOps.ICID[iStk[top].l, [0,0], 32, lpx, lwx];
ifuYoungestPC => XBus ← Dragon.LTD[iStk[top].p];
ifuEldestL => XBus ← BitOps.ICID[iStk[bot].l, [0,0], 32, lpx, lwx];
ifuEldestPC => XBus ← Dragon.LTD[iStk[bot].p];
ENDCASE => NULL}; -- Not an IFU stack register
c3
IN [ifuYoungestL..ifuEldestPC] =>
SELECT c3
FROM
ifuYoungestL => iStk[top].l ← BitOps.ECFD[XBus, 32, lpx, lwx];
ifuYoungestPC => iStk[top].p ← Dragon.LFD[XBus];
ifuEldestL => iStk[bot].l ← BitOps.ECFD[XBus, 32, lpx, lwx];
ifuEldestPC => iStk[(bot+m1) MOD depth].p ← Dragon.LFD[XBus];
ENDCASE => NULL; -- Not an IFU stack register
ENDCASE => NULL; -- nothing special happening
END;