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 BOOL ← NARROW [CoreProperties.GetCellTypeProp[ct, prop]];
RETURN [IF rb=NIL THEN default ELSE rb^];
};
RunOracleTest:
PROC [obName, designName, oracleFileName, initialState, expectedFinalState: Rope.
ROPE ←
NIL] = {
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.ROPE ← NIL;
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[]];
}
};
};