%
Page Numbers: Yes First Page: 1
Heading:
kernel4.mcJuly 14, 1979 4:53 PM%
%
July 14, 1979 4:53 PM
Fix bug in computation of correct value for stkp after performing stack+1←.
May 8, 1979 11:53 AM
Add bypass checking to stack test.
January 25, 1979 1:12 PM
Add call to checkTaskNum at beginKernel4 to skip the stack tests when we’re not executing in task 0.
%
top level;

%
CONTENTS

TEST
DESCRIPTION

stkTest
test all stack operations
carry20Test
tests CARRY20 function
xorCarryTest
test XORCARRY function (CIN to bit0, provided by ALUFM)
useSavedCarry
test function (use aluCarry from preeceding instr as CIN
multiplyTest
test multiply step fcn (affects Q, result. its a slowbranch, too)
divide
test divide step fcn (affects Q, result)
cdivide
test divide step fcn (affects Q, result)
slowBR
tests 8-way slow dispatch
%
beginKernel4:
call[checkTaskNum], t ← r0;
skpif[ALU=0];
branch[stkXitTopL];* don’t try task 0 tests.
* May 8, 1979 11:53 AM
%
TEST STKP PUSH AND POP OPERATIONS

-- I AND STKP SHOULD BE INCREMENTING TOGETHER.
--
notation: stack&+1[stkp] ← val : place val into stack[stkp], then increment stkp by 1
--
stack+1[stkp] ← val : increment stkp by one, then place val into stack[stkp]
-- The stragegy for this test is to perform all the various stack manipulations (+1, +2, +3,
-- -1, -2, -3, -4, &+1, &+2, &+3, &-1, &-2, &-3, &-4) for every value of stkp that won’t
-- cause a hardware error (underflow). The test knows what to expect in RM by setting
-- each rm location to its address (stack[i] ← i).

FOR top2StkpBits IN [0..3] DO
FOR index IN [0..stkpMax] DO
-- check simple loading of stkp and stk
i ← index + LeftShift[top2StkpBits, 6];
stkp ← i;
IF POINTERS[].stkError THEN ERROR;-- underflow or overflow
IF POINTERS[].stkp # i THEN ERROR;-- stkp not the value we loaded
stk[stkp] ← 0;
IF stk[stkp] # 0 THEN ERROR;-- loaded zero, got back something different.
stk[stkp] ← -1;
IF stk[stkp] # -1 THEN ERROR;-- loaded -1, got back something different.
stk[stkp] ← Alternating01;
IF stk[stkp] # Alternating01 THEN ERROR;-- loaded Alternating01, got back something different.
stk[stkp] ← Alternating10;
IF stk[stkp] # Alternating10 THEN ERROR;-- loaded Alternating10, got back something different.

stk[stkp] ← i;-- init current stack to stk[i] ← i
IF stk[stkp] # i THEN ERROR;
ENDLOOP:
FOR index IN [0..STKPMAX] DO
-- test other operations within that stack
i ← index + LeftShift[top2StkpBits, 6];
stkp ← i;
IF i # STKPMAX THEN-- check +,- 1 operations
BEGIN -- begin w/ operations that use current stkp for loading rm
stack&+1[stkp] ← -1;
IF POINTERS[].stack # i+1 THEN ERROR;-- auto increment of stkp failed
IF stack[stkp] # i+1 THEN ERROR;-- got wrong data after increment
stack&-1[stkp] ← i+1;-- rewrite current data, decrement stkp
IF POINTERS[].stack # i THEN ERROR;-- auto decrement of stkp failed
IF stack[stkp] # -1 THEN ERROR;-- got wrong data ater decrement
stkp ← i+1;-- set stkp to check data
IF stack[stkp] # i+1 THEN ERROR;-- wrong data during auto decrement

stkp ← i;-- reset stkp
stack[stkp] ← 0;
IF stack[stkp] # 0 THEN ERROR;-- bypass error
stack[stkp]← 1;
IF stack[stkp] = 0 THEN ERROR;-- bypass error
stack[stkp] ← i;-- reset data at "current" stkp

-- now test operations that modify stkp before loading rm
stack+1[stkp] ← -1;-- increment stkp, then load rm
IF POINTERS[].stack # i+1 THEN ERROR;-- stkp auto increment failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i+1;-- fix clobbered location
stack-1[stkp] ← -1;-- decrement stkp, then load rm
IF POINTERS[].stack # i THEN ERROR;-- stkp auto decrement failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i;-- fix clobbered location
END;
IF i+1 < stkpMAX THEN-- check +,- 2 operations
BEGIN -- begin w/ operations that use current stkp for loading rm
stack&+2[stkp] ← -1;
IF POINTERS[].stack # i+2 THEN ERROR;-- auto increment of stkp failed
IF stack[stkp] # i+2 THEN ERROR;-- got wrong data after increment
stack&-2[stkp] ← i+2;-- rewrite current data, decrement stkp
IF POINTERS[].stack # i THEN ERROR;-- auto decrement of stkp failed
IF stack[stkp] # -1 THEN ERROR;-- got wrong data
stack[stkp] ← i;-- reset data at current stkp
stkp ← i+2;-- set stkp to check data
IF stack[stkp] # i+2 THEN ERROR;-- wrong data during auto decrement

stkp ← i;-- reset stkp

-- now test operations that modify stkp before loading rm
stack+2[stkp] ← -1;-- increment stkp, then load rm
IF POINTERS[].stack # i+2 THEN ERROR;-- stkp auto increment failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i+2;-- fix clobbered location
stack-2[stkp] ← -1;-- decrement stkp, then load rm
IF POINTERS[].stack # i THEN ERROR;-- stkp auto decrement failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i;-- fix clobbered location
END;
IF i+2 < stkpMAX THEN-- check +,- 3 operations
BEGIN -- begin w/ operations that use current stkp for loading rm
stack&+3[stkp] ← -1;
IF POINTERS[].stack # i+3 THEN ERROR;-- auto increment of stkp failed
IF stack[stkp] # i+3 THEN ERROR;-- stkp auto increment failed
stack&-2[stkp] ← i+2;-- rewrite current data, decrement stkp
IF POINTERS[].stack # i THEN ERROR;-- auto decrement of stkp failed
IF stack[stkp] # -1 THEN ERROR;-- got wrong data
stack[stkp] ← i;-- reset data at current stkp
stkp ← i+3;-- set stkp to check data
IF stack[stkp] # i+3 THEN ERROR;-- wrong data during auto decrement

stkp ← i;-- reset stkp

-- now test operations that modify stkp before loading rm
stack+3[stkp] ← -1;-- increment stkp, then load rm
IF POINTERS[].stack # i+3 THEN ERROR;-- stkp auto increment failed
IF stack[stkp] # -1 THEN ERROR;-- stkp auto increment failed
stack[stkp] ← i+3;-- fix clobbered location
stack-3[stkp] ← -1;-- decrement stkp, then load rm
IF POINTERS[].stack # i THEN ERROR;-- stkp auto decrement failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i;-- fix clobbered location
END;
IF i>3 THEN-- check -4 operations
BEGIN -- begin w/ operations that use current stkp for loading rm
stack&-4[stkp] ← -1;-- decrement stkp, then load rm
IF POINTERS[].stack # i-4 THEN ERROR;-- stkp auto decrement failed
IF stack[stkp] # i-4 THEN ERROR;-- didn’t get data we wrote
stkp ← i;
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i-4;-- fix clobbered location

-- now test operations that modify stkp before loading rm
stack-4[stkp] ← -1;-- decrement stkp, then load rm
IF POINTERS[].stack # i-4 THEN ERROR;-- stkp auto decrement failed
IF stack[stkp] # -1 THEN ERROR;-- didn’t get data we wrote
stack[stkp] ← i-4-- fix clobbered location
stkp ← i;
IF stack[stkp] # i THEN ERROR;
ENDLOOP;
ENDLOOP;
-- end of stkp loop
ENDLOOP;
-- end of top2StkpBits loop
%

* July 14, 1979 4:53 PM
%
stkTestTest the various stack operations
%
mc[
stkPMaxXC, 77];
mc[
pointers.stkOvf, b8];
mc[
pointers.stkUnd, b9];
mc[
pointers.stkErr, b8, b9];
stkTest:* initialize the top2bits loop
call[iTopStkBits];
stkTopL:* top of "top 2 bits of stkp" loop
call[nextTopStkBits];
skpif[ALU#0];
branch[stkXitTopL];
noop;

* This code writes the current stack with the address (stack[stkP] ← stkP).
* It also checks that stkp←, ←stack work properly.
call[iStkPAddr];* initialize stack index [1..maxStkXC]
stkIL:
call[nextStkPAddr];* top of stk init loop. here we check stkp← and ←stack.
skpif[ALU#0];
branch[stkiXit];
stkp ← t;* load stkp
call[chkStkErr];
skpif[ALU=0];
stkiErr0:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr ← t;
t # (rscr);* compare real stkp with value we loaded
skpif[ALU=0];
stkiErr1:* t = tskp, rscr = value we loaded
error;

* This is a limited test of the bits in the stack memory: write zero, -1, alternating 10, 01
t ← stack ← t-t;
t ← t #(Q←stack) ;
skpif[ALU=0];
stkiErr2:* wrote zero, got back something else
error;* Q = value from stack

t ← rm1;
stack ← t;
t ← t #(Q←stack) ;
skpif[ALU=0];
stkiErr3:* wrote -1 got back something else.
error;* t = bad bits Q = value from stack

t ← r01;
stack ← t;
t ← t #(Q←stack) ;
skpif[ALU=0];
stkiErr4:* wrote r01 got back something else.
error;* t = bad bits. Q = value from stack

t ← r10;
stack ← t;
t ← t #(Q←stack) ;
skpif[ALU=0];
stkiErr5:* wrote r10 got back something else.
error;* t = bad bits. Q = value from stack

t ← rscr;* t ← current index
stack←t;* stack[i] ←i, then check it
t # (Q←stack);
skpif[ALU=0];
stkiErr6:* wrote stkp from rscr. Q = value from stack
error;* read it into t. they aren’t the same
branch[stkiL];
stkiXit:

* July 14, 1979 4:53 PM
* We have successfully written the stack using non incrementing and non decrementing
* operations. Now we test stack&+1←, stack&-1←, stack+1←, stack-1←

call[iStkPAddr];* init the main loop for the main test
stkTestL:* top of main loop
call[nextStkPAddr];* get next stack index or exit loop
skpif[alu#0];
branch[stkTestXitL];
stkp ← t;* stackP ← i

call[chkStkErr];
skpif[ALU=0];
stkpErr10:* got stack underflow or overflow
error;

rscr ← t and (77c);* isolate the index (exclude top 2 bits)
(rscr)-(stkPMaxXC);* skip this test if it would cause overflow
branch[afterStkTest1, ALU=0];

t # (Q←stack);* see if stack[stkp] = stkp
skpif[ALU=0];* if not, an earlier execution of this loop clobbered
stkpErr1:* the stack entry at location in t, or this is first time
error;* thru, and the initialization didn’t work properly.
*
Q=value from stack

* stack&+1 stack&+1 stack&+1 stack&+1 stack&+1 stack&+1 stack&+1 stack&+1

stack&+1 ← cm1;* stack[stackP] ← -1, then stackP ← stackP+1
call[chkStkErr];
skpif[ALU=0];
stk&+1Err0:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr←t+1;* compare stackPAddr from Pointers w/ expected val
t #(rscr);
skpif[ALU=0];
stkP1AddrErr:* auto increment of StackP failed. rscr = expected value,
error;* t = value from Pointers

t ← t # (Q←stack);
skpif[ALU=0];
stkP1ValErr:* value at stackp is bad. Q = value from stack
error;* t = expected val, rscr = stack’s val from Pointers
t ← rscr;* restore t

* stack&-1 stack&-1 stack&-1 stack&-1 stack&-1 stack&-1 stack&-1 stack&-1 stack&-1

stack&-1 ← t;* stack["i+1"] ← i+1, stackp ← i.

call[chkStkErr];
skpif[ALU=0];
stkpErr12:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr ← t-1;
t # (rscr);* compare expected stkP (rscr) with
skpif[ALU=0];* actual stkp (t)
stkM1AddrErr:* auto decrement failed
error;

t ← cm1;
t ← t # (Q←stack);
skpif[ALU=0];* see if original stack&+1 ← cm1 worked
stkP1ValErr2:* stack&+1 seems to have clobbered the
error;* (i+1)th value. t = bad bits. Q = value from stack

t ← rscr;* restore t
(stack)← t;* reset stk[stkp] to contain stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr13:* got stack underflow or overflow
error;

rscr ← t ← t+1;
stkp ← t;* check the data modified during "stack&-1" instruction
t ← t # (Q←stack);* compare tos with expected valu
skpif[ALU=0];
stkM1ValErr:*. Q = value from stack
error;* t = bad bits, rscr = expected value

t ← rscr ← (rscr)-1;* t, rscr ← "i"
stkp ← t;* stkp is at i+1 now. Fix it.

call[chkStkErr];
skpif[ALU=0];
stkpErr14:* got stack underflow or overflow
error;

Q ← stack;* save stack value
stack ← t-t;
PD←(stack);
skpif[ALU=0];
stkByPassErr0:* didn’t notice that we just zeroed the stack
error;
t ← cm1;
stack ← cm1;
PD ← (stack) # t;
skpif[ALU=0];
stkByPassErr1:* didn’t notice that we just put all ones
error;* in the stack.

stack ← Q;* restore stack

* stack+1 stack+1 stack+1 stack+1 stack+1 stack+1 stack+1 stack+1 stack+1 stack+1

rscr ← (rscr)+1;* compute expected stkp value
t ← cm1;
stack+1 ← t;* stkp ← i+1, stack[stkp] ← -1

call[chkStkErr];
skpif[ALU=0];
stkpErr15:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;
skpif[ALU=0];
stkP1AddrErr2:* expected Rscr, got stackp in t, they’re different
error;

t ← cm1;
t ← t # (Q←stack);* check that we loaded -1 into incremented stack location
skpif[ALU=0];* Q = value from stack
stkP1ValErr3:* t = bad bits
error;
t ← rscr;* restore t

* stack-1 stack-1 stack-1 stack-1 stack-1 stack-1 stack-1 stack-1 stack-1 stack-1

stack ← t;* reset stack which was clobbered by "stack+1←cm1"

call[chkStkErr];
skpif[ALU=0];
stkpErr16:* got stack underflow or overflow
error;

rscr ← t-1;* compute expected value of rscr
t ← cm1;
stack-1 ← t;* (stack-1) ← "-1"

call[chkStkErr];
skpif[ALU=0];
stkpErr17:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;* see if real stkp (t) matches expected stkp (rscr)
skpif[ALU=0];
stkM1AddrErr2:
error;

t ← cm1;
t ← t # (Q←stack);* compare tos with -1
skpif[ALU=0];
stkM1ValErr2:* Q = value from stack
error;* t = bad bits, expected -1

t ← rscr;* restore t
(stack) ← t;* restore addr as value in stack: stack[stkp]←stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr18:* got stack underflow or overflow
error;
noop;* for placement

afterStkTest1:
* November 30, 1978 6:07 PM
%
remember, don’t execute if i=1, if i+2=77%
call[getStkPAddr];
rscr ← t and (77c);* isolate the index (exclude top 2 bits)
rscr ← (rscr)+1;
(rscr)-(stkPMaxXC);* skip this test if it would cause overflow
branch[afterStkTest2, ALU>=0];

t # (Q←stack);* see if stack[stkp] = stkp
skpif[ALU=0];* if not, an earlier execution of this loop clobbered
stkpErr21:* the stack entry at location in t, or this is first time
error;* thru, and the initialization didn’t work properly.
*
Q=value from stack

* stack&+2 stack&+2 stack&+2 stack&+2 stack&+2 stack&+2 stack&+2 stack&+2

stack&+2 ← cm1;* stack[stackP] ← -1, then stackP ← stackP+2
call[chkStkErr];
skpif[ALU=0];
stk&+2Err0:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr←t+(2c);* compare stackPAddr from Pointers w/ expected val
t #(rscr);
skpif[ALU=0];
stkP2AddrErr:* auto increment of StackP failed. rscr = expected value,
error;* t = value from Pointers

t ← t # (Q←stack);
skpif[ALU=0];
stkP2ValErr:* value at stackp is bad. Q = value from stack
error;* t = expected val, rscr = stack’s val from Pointers
t ← rscr;* restore t

* stack&-2 stack&-2 stack&-2 stack&-2 stack&-2 stack&-2 stack&-2 stack&-2 stack&-2

stack&-2 ← t;* stack["i+2"] ← i+2, stackp ← i.

call[chkStkErr];
skpif[ALU=0];
stkpErr22:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr ← t-(2c);
t # (rscr);* compare expected stkP (rscr) with
skpif[ALU=0];* actual stkp (t)
stkM2AddrErr:* auto decrement failed
error;

t ← cm1;
t ← t # (Q←stack);
skpif[ALU=0];* see if original stack&+2 ← cm1 worked
stkP2ValErr2:* stack&+2 seems to have clobbered the
error;* (i+2)th value. t = bad bits. Q = value from stack

t ← rscr;* restore t
(stack)← t;* reset stk[stkp] to contain stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr23:* got stack underflow or overflow
error;

rscr ← t ← t+(2C);
stkp ← t;* check the data modified during "stack&-2" instruction
t ← t # (Q←stack);* compare tos with expected valu
skpif[ALU=0];
stkM2ValErr:*. Q = value from stack
error;* t = bad bits, rscr = expected value

* stack+2 stack+2 stack+2 stack+2 stack+2 stack+2 stack+2 stack+2 stack+2 stack+2

t ← rscr ← (rscr)-(2c);* t, rscr ← "i"
stkp ← t;* stkp is at i+2c now. Fix it.

call[chkStkErr];
skpif[ALU=0];
stkpErr24:* got stack underflow or overflow
error;

rscr ← t+(2c);* compute expected stkp value
t ← cm1;
stack+2 ← t;* stkp ← i+2, stack[stkp] ← -1

call[chkStkErr];
skpif[ALU=0];
stkpErr25:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;
skpif[ALU=0];
stkP2AddrErr2:* expected stackP t, got stackp in Rscr, they’re different
error;

t ← cm1;
t ← t # (Q←stack);* check that we loaded -1 into incremented stack location
skpif[ALU=0];* Q = value from stack
stkP2ValErr3:* t = bad bits
error;
t ← rscr;* restore t

* stack-2 stack-2 stack-2 stack-2 stack-2 stack-2 stack-2 stack-2 stack-2 stack-2

stack ← t;* reset stack which was clobbered by "stack+2←cm1"

call[chkStkErr];
skpif[ALU=0];
stkpErr26:* got stack underflow or overflow
error;

rscr ← t-(2c);* compute expected value of rscr
t ← cm1;
stack-2 ← t;* (stack-2) ← "-1"

call[chkStkErr];
skpif[ALU=0];
stkpErr27:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;* see if real stkp (t) matches expected stkp (rscr)
skpif[ALU=0];
stkM2AddrErr2:
error;

t ← cm1;
t ← t # (Q←stack);* compare tos with -1
skpif[ALU=0];
stkM2ValErr2:* Q = value from stack
error;* t = bad bits, expected -1

t ← rscr;* restore t
(stack) ← t;* restore addr as value in stack: stack[stkp]←stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr228:* got stack underflow or overflow
error;
noop;* for placement

afterStkTest2:
* December 1, 1978 3:19 PM
%
remember, don’t execute if i=1, if i+3>=77%
noop;* placement for afterStkTest2 branch
call[getStkPAddr];
rscr ← t and (77c);* isolate the index (exclude top 2 bits)
rscr ← (rscr)+(2c);
(rscr)-(stkPMaxXC);* skip this test if it would cause overflow
branch[afterStkTest3, ALU>=0];

t # (Q←stack);* see if stack[stkp] = stkp
skpif[ALU=0];* if not, an earlier execution of this loop clobbered
stkpErr31:* the stack entry at location in t, or this is first time
error;* thru, and the initialization didn’t work properly.
*
Q=value from stack

* stack&+3 stack&+3 stack&+3 stack&+3 stack&+3 stack&+3 stack&+3 stack&+3

stack&+3 ← cm1;* stack[stackP] ← -1, then stackP ← stackP+3
call[chkStkErr];
skpif[ALU=0];
stk&+3Err0:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr←t+(3c);* compare stackPAddr from Pointers w/ expected val
t #(rscr);
skpif[ALU=0];
stkP3AddrErr:* auto increment of StackP failed. rscr = expected value,
error;* t = value from Pointers

t ← t # (Q←stack);
skpif[ALU=0];
stkP3ValErr:* value at stackp is bad. Q = value from stack
error;* t = expected val, rscr = stack’s val from Pointers
t ← rscr;* restore t

* stack&-3 stack&-3 stack&-3 stack&-3 stack&-3 stack&-3 stack&-3 stack&-3 stack&-3

stack&-3 ← t;* stack["i+3"] ← i+3, stackp ← i.

call[chkStkErr];
skpif[ALU=0];
stkpErr32:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr ← t-(3c);
t # (rscr);* compare expected stkP (rscr) with
skpif[ALU=0];* actual stkp (t)
stkM3AddrErr:* auto decrement failed
error;

t ← cm1;
t ← t # (Q←stack);
skpif[ALU=0];* see if original stack&+3 ← cm1 worked
stkP3ValErr2:* stack&+3 seems to have clobbered the
error;* (i+3)th value. t = bad bits. Q = value from stack

t ← rscr;* restore t
(stack)← t;* reset stk[stkp] to contain stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr33:* got stack underflow or overflow
error;

rscr ← t ← t+(3C);
stkp ← t;* check the data modified during "stack&-3" instruction
t ← t # (Q←stack);* compare tos with expected valu
skpif[ALU=0];
stkM3ValErr:*. Q = value from stack
error;* t = bad bits, rscr = expected value

* stack+3 stack+3 stack+3 stack+3 stack+3 stack+3 stack+3 stack+3 stack+3 stack+3

t ← rscr ← (rscr)-(3c);* t, rscr ← "i"
stkp ← t;* stkp is at i+3c now. Fix it.

call[chkStkErr];
skpif[ALU=0];
stkpErr34:* got stack underflow or overflow
error;

rscr ← t+(3c);* compute expected stkp value
t ← cm1;
stack+3 ← t;* stkp ← i+3, stack[stkp] ← -1

call[chkStkErr];
skpif[ALU=0];
stkpErr35:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;
skpif[ALU=0];
stkP3AddrErr2:* expected stackP t, got stackp in Rscr, they’re different
error;

t ← cm1;
t ← t # (Q←stack);* check that we loaded -1 into incremented stack location
skpif[ALU=0];* Q = value from stack
stkP3ValErr3:* t = bad bits
error;
t ← rscr;* restore t

* stack-3 stack-3 stack-3 stack-3 stack-3 stack-3 stack-3 stack-3 stack-3 stack-3

stack ← t;* reset stack which was clobbered by "stack+3←cm1"

call[chkStkErr];
skpif[ALU=0];
stkpErr36:* got stack underflow or overflow
error;

rscr ← t-(3c);* compute expected value of rscr
t ← cm1;
stack-3 ← t;* (stack-3) ← "-1"

call[chkStkErr];
skpif[ALU=0];
stkpErr37:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;* see if real stkp (t) matches expected stkp (rscr)
skpif[ALU=0];
stkM3AddrErr2:
error;

t ← cm1;
t ← t # (Q←stack);* compare tos with -1
skpif[ALU=0];
stkM3ValErr2:* Q = value from stack
error;* t = bad bits, expected -1

t ← rscr;* restore t
(stack) ← t;* restore addr as value in stack: stack[stkp]←stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr38:* got stack underflow or overflow
error;
noop;* for placement

afterStkTest3:
* December 1, 1978 4:57 PM
%
remember, don’t execute if i=1, if i+4>=77%
noop;* placement for the afterStkTest3 check
call[getStkPAddr];
rscr ← t and (77c);* isolate the index (exclude top 2 bits)
rscr ← (rscr)+(3c);
(rscr)-(stkPMaxXC);* skip this test if it would cause overflow
branch[afterStkTest4, ALU>=0];

t # (Q←stack);* see if stack[stkp] = stkp
skpif[ALU=0];* if not, an earlier execution of this loop clobbered
stkpErr41:* the stack entry at location in t, or this is first time
error;* thru, and the initialization didn’t work properly.
*
Q=value from stack

* Simulate stack&+4 -- hardware can perform stack&+3 as maximum increment

stack&+3 ← cm1;* stack[stackP] ← -1, then stackP ← stackP+4
stkp+1;* simulate +4
call[chkStkErr];
skpif[ALU=0];
stk&+4Err0:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr←t+(4c);* compare stackPAddr from Pointers w/ expected val
t #(rscr);
skpif[ALU=0];
stkP4AddrErr:* auto increment of StackP failed. rscr = expected value,
error;* t = value from Pointers

t ← t # (Q←stack);
skpif[ALU=0];
stkP4ValErr:* value at stackp is bad. Q = value from stack
error;* t = expected val, rscr = stack’s val from Pointers
t ← rscr;* restore t

* stack&-4 stack&-4 stack&-4 stack&-4 stack&-4 stack&-4 stack&-4 stack&-4 stack&-4

stack&-4 ← t;* stack["i+4"] ← i+4, stackp ← i.

call[chkStkErr];
skpif[ALU=0];
stkpErr42:* got stack underflow or overflow
error;

call[getRealStkAddr], rscr ← t-(4c);
t # (rscr);* compare expected stkP (rscr) with
skpif[ALU=0];* actual stkp (t)
stkM4AddrErr:* auto decrement failed
error;

t ← cm1;
t ← t # (Q←stack);
skpif[ALU=0];* see if original stack&+4 ← cm1 worked
stkP4ValErr2:* stack&+4 seems to have clobbered the
error;* (i+4)th value. t = bad bits. Q = value from stack

t ← rscr;* restore t
(stack)← t;* reset stk[stkp] to contain stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr43:* got stack underflow or overflow
error;

rscr ← t ← t+(4C);
stkp ← t;* check the data modified during "stack&-4" instruction
t ← t # (Q←stack);* compare tos with expected valu
skpif[ALU=0];
stkM4ValErr:*. Q = value from stack
error;* t = bad bits, rscr = expected value

* stack+4 stack+4 stack+4 stack+4 stack+4 stack+4 stack+4 stack+4 stack+4 stack+4

t ← rscr ← (rscr)-(4c);* t, rscr ← "i"
stkp ← t;* stkp is at i+4c now. Fix it.

call[chkStkErr];
skpif[ALU=0];
stkpErr44:* got stack underflow or overflow
error;

rscr ← t+(4c);* compute expected stkp value
t ← cm1;
stkp+1;* simulate stack+4
stack+3 ← t;* stkp ← i+4, stack[stkp] ← -1

call[chkStkErr];
skpif[ALU=0];
stkpErr45:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;
skpif[ALU=0];
stkP4AddrErr2:* expected stackP t, got stackp in Rscr, they’re different
error;

t ← cm1;
t ← t # (Q←stack);* check that we loaded -1 into incremented stack location
skpif[ALU=0];* Q = value from stack
stkP4ValErr3:* t = bad bits
error;
t ← rscr;* restore t

* stack-4 stack-4 stack-4 stack-4 stack-4 stack-4 stack-4 stack-4 stack-4 stack-4

stack ← t;* reset stack which was clobbered by "stack+4←cm1"

call[chkStkErr];
skpif[ALU=0];
stkpErr46:* got stack underflow or overflow
error;

rscr ← t-(4c);* compute expected value of rscr
t ← cm1;
stack-4 ← t;* (stack-4) ← "-1"

call[chkStkErr];
skpif[ALU=0];
stkpErr47:* got stack underflow or overflow
error;

call[getRealStkAddr];
(rscr) # t;* see if real stkp (t) matches expected stkp (rscr)
skpif[ALU=0];
stkM4AddrErr2:
error;

t ← cm1;
t ← t # (Q←stack);* compare tos with -1
skpif[ALU=0];
stkM4ValErr2:* Q = value from stack
error;* t = bad bits, expected -1

t ← rscr;* restore t
(stack) ← t;* restore addr as value in stack: stack[stkp]←stkp

call[chkStkErr];
skpif[ALU=0];
stkpErr48:* got stack underflow or overflow
error;
noop;* for placement

afterStkTest4:
branch[stkTestL];
stkTestXitL:
branch[stkTopL];

* November 27, 1978 10:31 AM.

iStkPAddr: subroutine;
return, stackPAddr ← t-t;* first valid index is one.

nextStkPAddr: subroutine;* stack indeces are 6 bits long.
*
Return (stackPaddr OR stackPtopBits) in T. It’s an 8 bit address.
*
ALU#0 =>valid value.

klink ← link;
t ← stackPAddr ← (stackPAddr) + 1;* increment the index
t and (77c);* check for 6 bit overflow
skpif[ALU=0], t ← t + (stackPTopBits);* OR the top two bits into returned value
skip, rscr ← 1c;* indicate valid value
rscr ← t-t;* indicate invalid value
returnAndBranch[klink, rscr];

getStkPAddr: subroutine;
t ← stackPAddr;
return, t ← t + (stackPTopBits);

iTopStkBits: subroutine;
t ← (r0) - (100c);
return, stackPTopBits ← t;* first valid index is zero.
nextTopStkBits: subroutine;
klink ← link;
top level;
t ← stackPTopBits ← (stackPTopBits)+(100c);
t - (400c);
skpif[ALU#0], rscr ← 1c;
rscr ← t-t;
returnAndBranch[klink, rscr];

getRealStkAddr: subroutine;
t ← TIOA&Stkp;
return, t ← t and (377c);

chkStkErr: subroutine;* rtn w/ ALU#0 ==> stk (underflow or overflow).
* Clobber rscr2 ← Pointers[]
rscr2 ← Pointers[];
return, rscr2 ← (rscr2) AND (pointers.stkErr);
top level;
stkXitTopL:

* September 3, 1977 2:25 PM
%
TEST CARRY20 FUNCTION

This function causes a 1 go be or’d into the carry out bit that is used
as input to bit 11 in the alu. Given that there was not already a carry, this
function has the effect of adding 20B to the value in the alu.

%
carry20Test:
t←rscr←17C;
t←t+(r0),CARRY20;
rscr2 ← 37C;
t←t#(rscr2);
skpif[ALU=0];
error;* T NE 17B + 0 + CARRY20

t←rscr;
t←t+(r1),CARRY20;* t←17B+1+CARRY20
rscr2←20C;
t←t#(rscr2);
skpif[ALU=0];
error;* T NE 17B+1=20(=17B+1+CARRY20)

t←r0;
t←t+(r0),CARRY20;* t←0+0+CARRY20
rscr2←20C;
t←t#(rscr2);
skpif[ALU=0];
error;* T NE 20B=0+0+CARRY20

t←r0;
t←t-(rscr2);* t←-20B=(0-20B)
t←t+(r0),CARRY20;
skpif[ALU=0];
error;
* September 11, 1977 1:57 PM
%
TEST XORCARRY FUNCTION

XORCARRY causes the carry in bit for bit 15 of the alu to be xor’d.
Normally this bit is 0. When the bit is one, alu arithmetic functions will
see a carry into bit 0. For A-B the ALUFM is programmed to provide a one
and XORCARRY will leave a result one less than expected.
%
xorCarryTest:
t←(r0)+(r0),XORCARRY;
t←t#(r1);
skpif[ALU=0];
error;* 1 = 0+0+XORCARRY

t←r1;
t←t+(r0),XORCARRY;
t←t#(2C);
skpif[ALU=0];
xorCarryb:
error;* 2= 0+1+XORCARRY

t←r1;
t←t+(r1),XORCARRY;
t←t#(3C);
skpif[ALU=0];
xorCarryc:
error;* 3= 1+1+XORCARRY

t←RM1;
t←t+(r0),XORCARRY;
skpif[ALU=0];
xorCarryd:
error;* 0= -1+XORCARRY

t←(r0)AND(r0),XORCARRY;
skpif[ALU=0];
xorCarrye:
error;* CIN SHOULD BE IGNORED ON LOGICAL OPS!

t←(r1)AND(r1),XORCARRY;
t←t#(r1);
skpif[ALU=0];
xorCarryf:
error;* SHOULD BE 1. CIN IGNORED ON LOGICAL OPS

t←(RM1)OR(RM1),XORCARRY;
t←t#(RM1);
skpif[ALU=0];
xorCarryg:
error;* SHOULD BE -1. CIN IGNORED ON LOGICAL OPS

t←(r1)-(r1),XORCARRY;
t←t#(RM1);
skpif[ALU=0];
xorCarryh:
error;* BWL SEZ THIS SHOULD BE -1. IE.,
* R1-R1 causes 1+1777777, but xorcarry causes the op to become,
* 1+177776 because "A-B" uses carryin = 1, and xorcarry causes it to be
* zero!
* September 12, 1977 9:52 AM
%
TEST USESAVEDCARRY

This function causes the alu carry bit from the last instruction to be used as
the carry in bit to bit 15 during the current instruction. This bit is usually
provided by the alufm and is usually zero (its the bit complemented by the
xorcarry function).
%
%commented out
savedCarry:
T←(RHIGH1)+(RHIGH1);* T←0, CARRY←1
T←T+(R0),USESAVEDCARRY;* T←0+0+LAST CARRY
T←T#(R1);
SKPIF[ALU=0];
ERROR;* EXPECTED 1, USED LASTCARRY=1

T←(RM1)+(RM1);* T←-2, CARRY ←1
T←T+(R1),USESAVEDCARRY;* T←-2+1+LAST CARRY
SKPIF[ALU=0];
savedCarryB:
ERROR;* EXPECTED 0, USED LASTCARRY=1

T←(R0)+(R0);* T←0, CARRY←0
T←(R1)+(R1),USESAVEDCARRY;* T←1+1+LAST CARRY
T←T#(2C);
SKPIF[ALU=0];
savedCarryC:
ERROR;* EXPECTED 2, USED LASTCARRY=0

T←(R0)+(R0);* T←0, CARRY←0
T←(RM1)+(RM1),USESAVEDCARRY;* T←(-1)+(-1)+LAST CARRY
T←T#(177776C);
SKPIF[ALU=0];
savedCarryD:
ERROR;* EXPECTED -2, USED LASTCARRY=0

T←(RM1)+(RM1);* T←-2, CARRY←1
T←(R1)+(R1),USESAVEDCARRY;* T←1+1+LAST CARRY
T←T#(3C);
SKPIF[ALU=0];
savedCarryE:
ERROR;* EXPECTED 3, USED LASTCARRY=1
commented out%
* September 14, 1977 12:03 PM
%
TEST MULTIPLY STEP.

MULTIPLY works as follows:
H3[0:15] ← CARRY,,ALU[0:14] ==> CARRY,,ALU/2
Q[0:15] ← ALU[15],,Q[0:14] ==> ALU[15],,Q/2
Q[14] OR’D INTO TNIA[10] AS SLOW BRANCH! ==> ADDR OR’D 2 IF Q[14]=1

These tests invoke mulCheck, a subroutine that performs two services:
1) T←T+RSCR,MULTIPLY
2) RSCR2←1 IF Q[14] BRANCH IS TAKEN (ZERO OTHERWISE)

ERRORS are numbered 1 thru 3:
mulXerr1 ==> T value wrong (H3)
mulXerr2 ==> Q[14] branch wrong
mulXerr3 ==> Q value wrong
%
multiplyTest:
*
Q[14]=0, CARRY=0, ALU15=0
t←Q←r0;
rscr←t;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←0, CARRY←0
skpif[R EVEN],rscr2←rscr2;
mulAerr1:
error;* TOOK Q[14]=1 BRANCH

t←t;
skpif[ALU=0];
mulAerr2:
error;* CARRY,,(0+0)/2 SHOULD BE ZERO

t←Q;
skpif[ALU=0];
mulAerr3:
error;* ALU15,,Q[0:14] SHOULD BE ZERO

*
Q[14]=0, CARRY=1, ALU15=0
multiplyB:* Q=0; t←-1+1,MULTIPLY
Q←r0;
rscr←r1;
call[mulCheck],t←rm1;* t←t+rscr,MULTIPLY==>ALU←0, CARRY←1
skpif[R EVEN], rscr2←rscr2;
mulBerr1:
error;* TOOK Q[14]=1 BRANCH

t←t#(rhigh1);*-1+1 GENERATES CARRY BIT
skpif[ALU=0];
mulBerr2:
error;* CARRY,,(0+0)/2 SHOULD BE 100000

t←Q;* -1+1 WOULD LEAVE ALU15=0
skpif[ALU=0];
mulBerr3:
error;* ALU15,,Q[0:14] SHOULD BE ZERO

*
Q[14]=0, CARRY=0, ALU15=1
multiplyC:* Q=0; t←0+1,MULTIPLY
t←Q←r0;
rscr←r1;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←1, CARRY←0
skpif[R EVEN], rscr2←rscr2;
mulCerr1:
error;* TOOK Q[14]=1 BRANCH

t←t;* 0+1==> CARRY←0
skpif[ALU=0];
mulCerr2:
error;* CARRY,,(0+1)/2 SHOULD BE 0

t←(rhigh1)#(Q);* 0+1 WOULD LEAVE ALU15=1
skpif[ALU=0];
mulCerr3:
error;* ALU15,,Q[0:14] SHOULD BE 100000

*
Q[14]=0, CARRY=1, ALU15=1
multiplyD:* Q=0; t←100001+100000,MULTIPLY
Q←r0;
t←rscr←rhigh1;
call[mulCheck],t←t+(r1);* t←t+rscr,MULTIPLY==>ALU←1, CARRY←1
skpif[R EVEN], rscr2←rscr2;
mulDerr1:
error;* TOOK Q[14]=1 BRANCH

t←t#(rhigh1);* 1000001+100000==> CARRY←1
skpif[ALU=0];
mulDerr2:
error;* CARRY,,(1000001+100000)/2 SHOULD BE 100000

t←(rhigh1)#(Q);* 1000001+100000 WOULD LEAVE ALU15=1
skpif[ALU=0];
mulDerr3:
error;* ALU15,,Q[0:14] SHOULD BE 100000

multiplyE:
*
Q[14]=1, CARRY=0, ALU15=0
t←(r1)+(r1);
Q←t;* Q[14]←1
t←r0;
rscr←t;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←0, CARRY←0
skpif[R ODD],rscr2←rscr2;
mulEerr1:
error;* DIDN’T TAKE Q[14]=1 BRANCH

t←t;
skpif[ALU=0];
mulEerr2:
error;* CARRY,,(0+0)/2 SHOULD BE ZERO

t←(r1)#(Q);
skpif[ALU=0];
mulEerr3:
error;* ALU15,,Q[0:14] SHOULD BE 1

*
Q[14]=1, CARRY=1, ALU15=0
multiplyF:* Q=1; t←-1+1,MULTIPLY
t←(r1)+(r1);
Q←t;* Q[14]←1
rscr←r1;
call[mulCheck],t←rm1;* t←t+rscr,MULTIPLY==>ALU←0, CARRY←1
skpif[R ODD], rscr2←rscr2;
mulFerr1:
error;* DIDN’T TAKE Q[14]=1 BRANCH

t←t#(rhigh1);*-1+1 GENERATES CARRY BIT
skpif[ALU=0];
mulFerr2:
error;* CARRY,,(0+0)/2 SHOULD BE 100000

t←(r1)#(Q);* -1+1 WOULD LEAVE ALU15=0
skpif[ALU=0];
mulFerr3:
error;* ALU15,,Q[0:14] SHOULD BE 1

*
Q[14]=1, CARRY=0, ALU15=1
multiplyG:* Q=1; t←0+1,MULTIPLY
t←(r1)+(r1);
Q←t;* Q[14]←1
t←r0;
rscr←r1;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←1, CARRY←0
skpif[R ODD], rscr2←rscr2;
mulGerr1:
error;* DIDN’T TAKE Q[14]=1 BRANCH

t←t;* 0+1==> CARRY←0
skpif[ALU=0];
mulGerr2:
error;* CARRY,,(0+1)/2 SHOULD BE 0

t←(rhigh1)+1;* 0+1 WOULD LEAVE ALU15=1
t←t#(Q);
skpif[ALU=0];
mulGerr3:
error;* ALU15,,Q[0:14] SHOULD BE 100001

*
Q[14]=1, CARRY=1, ALU15=1
multiplyH:* Q=2; t←100001+100000,MULTIPLY
t←(r1)+(r1);
Q←t;* Q[14]←1
t←rscr←rhigh1;
call[mulCheck],t←t+(r1);* t←t+rscr,MULTIPLY==>ALU←1, CARRY←1
skpif[R ODD], rscr2←rscr2;
mulHerr1:
error;* DIDN’T TAKE Q[14]=1 BRANCH

t←t#(rhigh1);* 1000001+100000==> CARRY←1
skpif[ALU=0];
mulHerr2:
error;* CARRY,,(1000001+100000)/2 SHOULD BE 100000

t←(rhigh1)+1;* 1000001+100000 WOULD LEAVE ALU15=1
t←t#(Q);
skpif[ALU=0];
mulHerr3:
error;* ALU15,,Q[0:14] SHOULD BE 100001

multiplyJ:
*
Q←r01=>Q[14]=0; CARRY=0,ALU15=0
t←r01;
Q←t;* Q[14]←0
t←r0;
rscr←t;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←0, CARRY←0
skpif[R EVEN],rscr2←rscr2;
mulJerr1:
error;* TOOK Q[14]=1 BRANCH

t←t;
skpif[ALU=0];
mulJerr2:
error;* CARRY,,(0+0)/2 SHOULD BE ZERO

t←(r01) RSH 1;
t←t#(Q);
skpif[ALU=0];
mulJerr3:
error;* ALU15,,Q[0:14] SHOULD BE (r01) RSH 1

multiplyK:
*
Q←r10=>Q[14]=1; CARRY=0,ALU15=0
t←r10;
Q←t;* Q[14]←1
t←r0;
rscr←t;
call[mulCheck];* t←t+rscr,MULTIPLY==>ALU←0, CARRY←0
skpif[R ODD],rscr2←rscr2;
mulKerr1:
error;* DIDN’T TAKE Q[14]=1 BRANCH

t←t;
skpif[ALU=0];
mulKerr2:
error;* CARRY,,(0+0)/2 SHOULD BE ZERO

t←(r10) RSH 1;
t←t#(Q);
skpif[ALU=0];
mulKerr3:
error;* ALU15,,Q[0:14] SHOULD BE (r10) RSH 1


mulDone: BRANCH[afterMul];
* September 11, 1977 2:46 PM
%
MULCHECK

This subroutine performs,
t←t+(rscr),MULTIPLY;

It sets rscr2=0 IF Q[14] branch DID NOT HAPPEN.
It sets rscr2=1 IF Q[14] branch DID HAPPEN

T and rscr2 ARE CLOBBERED! IT ASSUMES r0=0, r1=1.
%
SUBROUTINE;
mulCheck:
t←t+(rscr),MULTIPLY, GLOBAL, AT[700];
GOTO[.+1];
rscr2←r0,AT[701];
RETURN;
rscr2←r1,AT[703];
RETURN;
TOP LEVEL;

afterMul:
* September 14, 1977 12:03 PM
%
DIVIDE TEST

H3 ← ALU[1:15],,Q[0] ==> H3← 2*ALU,,Q[0]
Q ← Q[1:15], CARRY ==> Q ← 2*Q,,CARRY
%
divideTest:
*
Q0=0, CARRY=0
Q←r0;
t←(r1)+(r1),DIVIDE;*t←1+1,DIVIDE==> CARRY←0,
t←t#(4C);
skpif[ALU=0];
error;* 2*(1+1)=4, Q0=0

t←Q;
skpif[ALU=0];
error;* CARRY WAS ZERO, Q SHOULD BE ZERO

divB:
*
Q0=0, CARRY=1
Q←r0;
t←rhigh1;
t←t+(r1);* T = 100001
t←t+(rhigh1),DIVIDE;* t←100001+100000,DIVIDE==>ALU=1, CARRY=1
t←t#(2C);
skpif[ALU=0];
error;* 2*(1+1)=4, Q0=0

t←(r1)#(Q);
skpif[ALU=0];
error;* 2*0,,CARRY SHOULD BE 1

divC:
*
Q0=1, CARRY=0
Q←rhigh1;
t←(r1)+(r1),DIVIDE;* t←1+1,DIVIDE==>ALU=2, CARRY=0
t←t#(5C);
skpif[ALU=0];
error;* 2*(2),,Q[0]=5

t←(Q);
skpif[ALU=0];
error;* Q[1:15],,CARRY SHOULD BE ZERO

divD:
*
Q0=1, CARRY=1
t←Q←rhigh1;* SET Q[0] TO ONE
t←t+(r1);* T = 100001
t←t+(rhigh1),DIVIDE;* t←100001+100000,DIVIDE==>ALU=1, CARRY=1
t←t#(3C);
skpif[ALU=0];
error;* 2*(1),,Q[0]=3

t←(r1)#(Q);
skpif[ALU=0];
error;* 2*0,,CARRY SHOULD BE 1

divE:
*
Q←r01=>Q0=0, CARRY=1
Q←r01;
t←(rhigh1)+1;* T = 100001
t←t+(rhigh1),DIVIDE;* t←100001+100000,DIVIDE==>ALU=1, CARRY=1
t←t#(2C);
skpif[ALU=0];
error;* 2*(1),,Q[0]=2

t←(r01) LSH 1;
t←t+(r1);* ADD ONE FOR CARRY
t←t#(Q);
skpif[ALU=0];
error;* 2*r01,,CARRY SHOULD BE ((r01)LSH 1)+1
* May 1, 1909 1:09 PM
%
CDIVIDE TEST

H3 ← ALU[1:15],,Q[0] ==> H3← 2*ALU,,Q[0]
Q ← Q[1:15], CARRY ==> Q ← 2*Q,,CARRY’ (COMPLEMENTED CARRY)
%
CdivideTest:
*
Q0=0, CARRY=0
Q←r0;
t←(r1)+(r1),CDIVIDE;*t←1+1,DIVIDE==> CARRY←0
t←t#(4C);
skpif[ALU=0];
error;* 2*(1+1)=4, Q0=0

t←(r1)#(Q);
skpif[ALU=0];
error;* CARRY’ WAS 1, Q SHOULD BE 1

CdivB:
*
Q0=0, CARRY=1
Q←r0;
t←rhigh1;
t←t+(r1);* T = 100001
t←t+(rhigh1),CDIVIDE;* t←100001+100000,DIVIDE==>ALU=1, CARRY=1
t←t#(2C);
skpif[ALU=0];
error;* 2*(1+1)=4, Q0=0

t←(Q);
skpif[ALU=0];
error;* 2*0,,CARRY’ SHOULD BE 0

CdivC:
*
Q0=1, CARRY=0
Q←rhigh1;
t←(r1)+(r1),CDIVIDE;* t←1+1,DIVIDE==>ALU=2, CARRY=0
t←t#(5C);
skpif[ALU=0];
error;* 2*(1),,Q[0]=3

t←(r1)#(Q);
skpif[ALU=0];
error;* Q[1:15],,CARRY’ SHOULD BE 1

CdivD:
*
Q0=1, CARRY=0
T←Q←rhigh1;* SET Q[0] TO ONE
T←T+(R1);* T = 100001
T←T+(rhigh1),CDIVIDE;* T←100001+100000,DIVIDE==>ALU=1, CARRY=1
T←T#(3C);
skpif[ALU=0];
ERROR;* 2*(1),,Q[0]=3

T←(Q);
skpif[ALU=0];
ERROR;* 2*0,,CARRY’ SHOULD BE 0

CdivE:
*
Q←R01=>Q0=0, CARRY=1
Q←R01;
T←(rhigh1)+1;* T = 100001
T←T+(rhigh1),CDIVIDE;* T←100001+100000,CDIVIDE==>ALU=1, CARRY=1
T←T#(2C);
skpif[ALU=0];
ERROR;* 2*(1),,Q[0]=2

T←(R01) LSH 1;
T←T#(Q);
skpif[ALU=0];
ERROR;* 2*R01,,CARRY’ SHOULD BE (R01)LSH 1

* September 9, 1977 5:09 PM
%
TEST 8 WAY SLOW B DISPATCH

Go thru the loop 16 times to make sure that only the low 3 bits are
or’d into next pc. keep counter in Q, loop control in CNT.
%
slowBr:
cnt←17s;
t←q←r0;
rscr2←7C;* THIS WILL BE A 3 BIT MASK

slowBrL:* TOP OF LOOP
t←rm1;
rscr←t;
t←q;
BDISPATCH←t;* DO DISPATCH W/ BITS IN T (=Q)
branch[BDTbl];
slowBRnoBr:* should have branched and didn’t
error;

bdConverge:
t←(rscr2)AND(q);* MASK DISPATCH VALUE
t←t#(rscr);
branch[.+2,ALU=0];
slowBRbadBr:
error;* DIDN’T GO WHERE WE EXPECTED

t←(r1)+(q);* GET NEXT VALUE FOR DISPATCH
loopChk[slowBrL,CNT#0&-1],q←t;

afterBD:
goto[afterKernel4];

SET[BDTblLoc,5110];
BDTbl:
goto[bdConverge], rscr←r0, AT[BDTblLoc];
goto[bdConverge], rscr←r1, AT[BDTblLoc,1];
goto[bdConverge], rscr←2C, AT[BDTblLoc,2];
goto[bdConverge], rscr←3C, AT[BDTblLoc,3];
goto[bdConverge], rscr←4C, AT[BDTblLoc,4];
goto[bdConverge], rscr←5C, AT[BDTblLoc,5];
goto[bdConverge], rscr←6C, AT[BDTblLoc,6];
goto[bdConverge], rscr←7C, AT[BDTblLoc,7];
goto[bdConverge], rscr←10C, AT[BDTblLoc,10];* shouldn’t be here
goto[bdConverge], rscr←11C, AT[BDTblLoc,11];* shouldn’t be here
goto[bdConverge], rscr←12C, AT[BDTblLoc,12];* shouldn’t be here
goto[bdConverge], rscr←13C, AT[BDTblLoc,13];* shouldn’t be here
goto[bdConverge], rscr←14C, AT[BDTblLoc,14];* shouldn’t be here
goto[bdConverge], rscr←15C, AT[BDTblLoc,15];* shouldn’t be here
goto[bdConverge], rscr←16C, AT[BDTblLoc,16];* shouldn’t be here
goto[bdConverge], rscr←17C, AT[BDTblLoc,17];* shouldn’t be here