SmallCacheTestCode.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Pradeep Sindhu, May 9, 1988 11:17:07 pm PDT
DIRECTORY
CD, Core, CoreCDUser, CoreOps, CoreProperties, IO, Logic, Ports, Rope, Rosemary, RosemaryUser, Sisyph, SmallCacheLogic, SmallCacheUtils, TerminalIO;
SmallCacheTestCode: CEDAR PROGRAM
IMPORTS CoreCDUser, CoreOps, CoreProperties, IO, Logic, Ports, Rope, Rosemary, RosemaryUser, Sisyph, SmallCacheLogic, SmallCacheUtils, TerminalIO
~ BEGIN
tester: RosemaryUser.Tester ← NIL;
ct: Core.CellType;
PortToRope: PROC [level: Ports.Level] RETURNS [r: Rope.ROPE] ~ {
r ← SELECT level FROM L => "L", H => "H", X => "X", ENDCASE => ERROR;
};
GetBool: PROC [ct: Core.CellType, prop: ATOM, default: BOOL] RETURNS [BOOL] ~ {
Read a boolean property from a CT with the specified default
rb: REF BOOLNARROW [CoreProperties.GetCellTypeProp[ct, prop]];
RETURN [IF rb=NIL THEN default ELSE rb^];
};
Oracle name is assumed to be same as obName
RunOracleTest: PROC [obName, designName, oracleFileName, initialState, expectedFinalState: Rope.ROPENIL] = {
ENABLE {
Ports.CheckError => {
TerminalIO.PutF["\n***%g\n", IO.rope[msg]]; GOTO done
}
};
Logic.SetOracleFileName[obName, oracleFileName];
ct ← Sisyph.ES[obName, Sisyph.Create[SmallCacheUtils.GetDesign[designName]]];
[] ← CoreCDUser.SetRootCellTypeDecoration[ct, Sisyph.mode.decoration];
[] ← CoreCDUser.SetDesignRootCellType[SmallCacheUtils.GetDesign[designName], ct];
Create tester
BEGIN
testButtons: LIST OF Rope.ROPENIL;
public, Vdd, Gnd: Core.Wire;
public ← ct.public;
Vdd ← CoreOps.FindWire[public, "Vdd"];
Gnd ← CoreOps.FindWire[public, "Gnd"];
IF Vdd=NIL THEN TerminalIO.PutRope["SmallCacheTest: Couldn't find Vdd\n"]
ELSE [] ← Rosemary.SetFixedWire[Vdd, H];
IF Gnd=NIL THEN TerminalIO.PutRope["SmallCacheTest: Couldn't find Gnd\n"]
ELSE [] ← Rosemary.SetFixedWire[Gnd, L];
testButtons ← LIST["Logic Test"];
tester ← RosemaryUser.TestProcedureViewer[
cellType: ct,
testButtons: testButtons,
name: Rope.Cat[CoreOps.GetCellTypeName[ct], " Test"],
displayWires: RosemaryUser.DisplayPortLeafWires[ct],
recordDeltas: GetBool[ct, $RecordDeltas, TRUE],
cutSet: NARROW[CoreProperties.GetCellTypeProp[ct, $CutSet]]];
tester.display.recordSteps ← TRUE;
END;
Set initial state and start simulation
SmallCacheLogic.ArrayPutState[initialState];
RosemaryUser.StartTest[tester];
IF Rope.Equal[expectedFinalState, SmallCacheLogic.ArrayGetState[]]
THEN TerminalIO.PutF["\n***State Check is OK\n"]
ELSE {
IF SmallCacheLogic.ArrayGetState[]=NIL
THEN TerminalIO.PutF["\n***Array state is NIL: state check not performed\n"]
ELSE {
TerminalIO.PutF["\n***State mismatch\n"];
TerminalIO.PutF[" Expected:\n"];
TerminalIO.PutRope[expectedFinalState];
TerminalIO.PutF["\n Got:\n"];
TerminalIO.PutRope[SmallCacheLogic.ArrayGetState[]];
}
};
EXITS
done => RETURN
};
END.