-- DES Master Port Prom - Revision B - used in 16K CP’s to control the Encryption Option
-- Filed on [Indigo]<Dandelion>CPE>Proms>DesMpProm-RevB.mesa
-- Last Edited by: TonyWest, February 2, 1983 10:26 AM
DIRECTORY
ImageDefsUSING [StopMesa],
PromBlowDefsUSING [WritePromData, WritePromList];
DesMpProm: PROGRAM IMPORTS ImageDefs, PromBlowDefs =
{promSize:CARDINAL = 256;-- number of prom locations
addressWidth:CARDINAL = 8;-- number of prom address bits
dataWidth:CARDINAL = 8;-- number of prom output data bits
State: TYPE = MACHINE DEPENDENT
{-- Des FSM State input and output fields are 3 bits wide
Reset(0),
Idle(1),
WaitC1Mas(2),
MasActive(3),
WaitC1Mds(4),
MdsActive(5),
(7)
};
-- NB: an "n" after a name means it is active LOW, i.e., assign FALSE to make it active.
PromInput: TYPE = MACHINE DEPENDENT RECORD
[-- The proms are two F93427 256x4
-- Right-justified - upper byte unused
padding:[0..377B],
desMpState:State,-- 3-bit field
desMpError:BOOLEAN,
cycle1:BOOLEAN,
cycle2:BOOLEAN,
desFromYBusn:BOOLEAN,-- Active-Low input
mFLGn:BOOLEAN-- Rev B FSM does not bother to look at MFLG!
];
PromOutput: TYPE = MACHINE DEPENDENT RECORD
[-- The proms are two F93427 256x4
-- DesProm.0
nextDesMpState:State,-- 3-bit field
pDesMpError:BOOLEAN,
-- DesProm.4
pMASn:BOOLEAN,-- Active-Low output
pMDSn:BOOLEAN,-- Active-Low output
unused1:BOOLEAN,
unused2:BOOLEAN,
-- Left-justified - lower byte unused
padding:[0..377B]
];
desMpProm:ARRAY [0..promSize)OF PromOutput;
input:PromInput;
output:PromOutput;
-- Duplicate the inputs with logical true booleans
cycle1:BOOLEAN;
cycle2:BOOLEAN;
desFromYBus:BOOLEAN;
mFLG:BOOLEAN;
-- This is not an input, it is deduced from cycle1 and cycle2
cycle3:BOOLEAN;
-- Duplicate the outputs with logical true booleans
nextDesMpState:State;
pDesMpError:BOOLEAN;
pMAS:BOOLEAN;
pMDS:BOOLEAN;
GenerateDesMpPromArray: PROC =
{FOR i: CARDINAL IN [0..promSize) DO
-- Initialise the Address to the i-th bit-pattern
input ← LOOPHOLE[i];
-- Initialise the global input booleans to reflect the input state
-- Convert active-low inputs into logical true booleans
cycle1← input.cycle1;
cycle2← input.cycle2;
desFromYBus← NOT input.desFromYBusn;
mFLG← NOT input.mFLGn;
-- The Fsm only has inputs for cycle1 and cycle2 - deduce cycle3 as follows:
cycle3 ← NOT (cycle1 OR cycle2);
-- Set the global output booleans to their default values
-- By default, loop in the current state
-- If DesMpError is set, it remains set forever
-- These are logical true booleans, active-low outputs will be converted later
nextDesMpState← input.desMpState;
pDesMpError← input.desMpError;
pMAS← FALSE;
pMDS← FALSE;
-- Now see what state we are in and set the global output booleans
SELECT input.desMpState FROM
Reset=>Reset[];
Idle=>Idle[];
WaitC1Mas=>WaitC1Mas[];
MasActive=>MasActive[];
WaitC1Mds=>WaitC1Mds[];
MdsActive=>MdsActive[];
ENDCASE;
-- Set the Output bit-pattern to reflect the global output booleans
-- Invert the sense of any outputs which are active-low
output.nextDesMpState← nextDesMpState;
output.pDesMpError← pDesMpError;
output.pMASn← NOT pMAS;
output.pMDSn← NOT pMDS;
output.unused1← FALSE;
output.unused2← FALSE;
-- Now that we have assembled the Output bit-pattern, store it in the Prom array
desMpProm[i] ← output;
ENDLOOP;
};
Reset: PROC =
{
-- We enter this state when DesReset’ jams the outputs of the LS273 to zero, and we will remain in this state until DesReset’ goes inactive. Note that DesReset’ has been synchronised with DesClk, so we have to hold pMAS and pMDS active for one more Des clock before we take them away to be sure they confirm with the Des Chip specifications. By default, the Fsm will loop in the current state.
IF cycle1 THEN nextDesMpState ← Idle ELSE pMAS ←pMDS ← TRUE;
};
Idle: PROC =
{
-- We are waiting for something to happen. There are three possibilities:
-- Des←YBus in Cycle 2 means start a MAS cycle.
-- Des←YBus in Cycle 1 or 3 means start an MDS cycle.
IF desFromYBus THEN
{IF cycle1 THEN{pMDS ← TRUE;
nextDesMpState ← MdsActive;
RETURN;
};
IF cycle2 THEN{nextDesMpState ← WaitC1Mas;
RETURN;
};
IF cycle3 THEN{nextDesMpState ← WaitC1Mds;
RETURN;
};
};
};
WaitC1Mas: PROC =
{
-- We are waiting for cycle 1 before starting a MAS cycle. Meanwhile, Des←YBus is illegal!
IF desFromYBus THEN pDesMpError ← TRUE;
IF cycle1 THEN
{pMAS ← TRUE;
nextDesMpState ← MasActive;
};
};
MasActive: PROC =
{
-- Des←YBus is illegal until we have finished!
IF desFromYBus THEN pDesMpError ← TRUE;
-- Continue to assert MAS until Cycle 3, then return to Idle state
IF cycle3 THEN nextDesMpState ← Idle ELSE pMAS ← TRUE;
};
WaitC1Mds: PROC =
{
-- We are waiting for cycle 1 before starting a MDS cycle. Meanwhile, Des←YBus is illegal!
IF desFromYBus THEN pDesMpError ← TRUE;
IF cycle1 THEN
{pMDS ← TRUE;
nextDesMpState ← MdsActive;
};
};
MdsActive: PROC =
{
-- Des←YBus is illegal until we have finished!
IF desFromYBus THEN pDesMpError ← TRUE;
-- Continue to assert MDS until Cycle 3, then return to Idle state
IF cycle3 THEN nextDesMpState ← Idle ELSE pMDS ← TRUE;
};
GenerateDesMpPromArray[];
PromBlowDefs.WritePromData["DesMpProm-RevB", addressWidth, dataWidth, @desMpProm[0]];
PromBlowDefs.WritePromList["DesMpProm-RevB", addressWidth, dataWidth, @desMpProm[0]];
ImageDefs.StopMesa[]
}.