-- DES Master Port Prom - Revision A - used in 16K CP’s to control the Encryption Option
-- Filed on [Indigo]<Dandelion>CPE>Proms>DesMpProm-RevA.mesa
-- Last Edited by: TonyWest, January 23, 1983 2:10 PM
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 4 bits wide
Reset(0),
Idle(1),
MasActive(2),
WaitForC1(3),
MdsActive(4),
(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
unused:BOOLEAN-- Could put mFLGn in here if you wanted to
];
PromOutput: TYPE = MACHINE DEPENDENT RECORD
[-- The proms are two F93427 256x4
-- DesProm.0
nextDesMpState:State,-- 3-bit field
pDesMpError:BOOLEAN,

-- DesProm.4
unused1:BOOLEAN,-- In RevA, this duplicates pDesMpError
pMASn:BOOLEAN,-- Active-Low output
pMDSn:BOOLEAN,-- Active-Low output
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;
-- You could add mFLGn here later, if desired.

-- 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;
desFromYBusNOT input.desFromYBusn;
-- 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;
pMASFALSE;
pMDSFALSE;
-- Now see what state we are in and set the global output booleans
SELECT input.desMpState FROM
Reset=>Reset[];
Idle=>Idle[];
MasActive=>MasActive[];
WaitForC1=>WaitForC1[];
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.pMASnNOT pMAS;
output.pMDSnNOT pMDS;
output.unused1← pDesMpError;-- Make this FALSE later
output.unused2FALSE;
-- 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 only two possibilities:
-- Des←YBus in Cycle 1 means start a MAS cycle.

-- Des←YBus in Cycle 2 or 3 means start an MDS cycle.
IF desFromYBus THEN
{IF cycle1 THEN
{pMAS ← TRUE;
nextDesMpState ← MasActive;
}
ELSE nextDesMpState ← WaitForC1;
};
};
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;
};
WaitForC1: 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-RevA", addressWidth, dataWidth, @desMpProm[0]];
PromBlowDefs.WritePromList
["DesMpProm-RevA", addressWidth, dataWidth, @desMpProm[0]];
ImageDefs.StopMesa[]
}.