DIRECTORY
BasicTime USING [GMT],
CD USING [Design, Object],
CDDirectory USING [Fetch, Name],
CDIO USING [ReadDesign],
CDProperties USING [GetObjectProp, RegisterProperty],
Commander USING [CommandProc, Register],
CommandTool USING [NextArgument],
CoreClasses USING [recordCellClass, RecordCellType],
CoreGeometry USING [GetObject],
CoreProperties USING [GetProp, PutProp, RegisterProperty],
DesignRules USING [FetchRulesID, GetRuleSet, Rules],
Drc USING [CheckDesignRules, CoreCell, DRV, DRVkey, Layout, Tech],
DrcCmosb USING [cMosBcompleteKey, cMosBsimpleKey, NewTechnology],
IO USING [rope],
Rope USING [Cat, Equal, IsEmpty, ROPE],
Sinix USING [Extract, Mode],
SinixOps USING [GetExtractMode],
TerminalIO USING [PutF, PutRope, PutRopes],
UserProfile USING [Boolean, CallWhenProfileChanges, ProfileChangedProc];
~
BEGIN
OPEN DrcCmosb;
ROPE: TYPE ~ Rope.ROPE;
religion: BOOL ← UserProfile.Boolean ["Genista.EmulateSoS", FALSE];
hint: ROPE;
Misc: TYPE ~ REF Stuff;
Stuff: TYPE ~ RECORD [design: CD.Design, geom: Drc.Layout];
TimeStamp: TYPE ~ REF Titius;
Titius: TYPE ~ RECORD [caius: BasicTime.GMT];
sessionKey: ATOM ~ CoreProperties.RegisterProperty [$DrcEnumerationSession];
regressionDesignDragon: ROPE ← "[DATools]<DATools7.0>Saguaro>DragonRules.dale";
regressionDesignVTI: ROPE ← "[DATools]<DATools7.0>Saguaro>VTIRules.dale";
EachCell: TYPE ~ PROC [cell: Drc.CoreCell, data: REF ANY ← NIL];
EnumerateCore:
PROC [cell: Drc.CoreCell, action: EachCell, session: TimeStamp, data:
REF
ANY ←
NIL, stopFlag:
REF
BOOL] ~
BEGIN
Enumerates the cell and does action on each subcell. If session ` NIL a cell is visited only once, otherwise it is visited on every instance.
IF (session #
NIL)
THEN
BEGIN
visited: TimeStamp ~ NARROW [CoreProperties.GetProp [cell.properties, sessionKey], TimeStamp];
IF (visited =
NIL)
OR (session.caius # visited.caius)
THEN
cell.properties ← CoreProperties.PutProp [cell.properties, sessionKey, session]
ELSE RETURN
END;
SELECT cell.class
FROM
CoreClasses.recordCellClass =>
BEGIN
cellData: CoreClasses.RecordCellType ~ NARROW [cell.data];
FOR sub:
NAT
IN [0 .. cellData.size)
DO
IF stopFlag^ THEN ERROR ABORTED;
EnumerateCore [cellData.instances[sub].type, action, session, data, stopFlag]
ENDLOOP;
action [cell, data]
END;
ENDCASE => NULL
END; -- EnumerateCore
ProblemMessage: EachCell ~
BEGIN
[cell: Drc.CoreCell, data: REF ANY ← NIL]
Asserts that correct cells are not flagged for violations
state: Misc ~ NARROW [data];
cdCell: CD.Object ~ CoreGeometry.GetObject [state.geom, cell];
IF (CoreProperties.GetProp [cell.properties, Drc.DRVkey] #
NIL)
THEN
BEGIN
TerminalIO.PutRopes [CDDirectory.Name [cdCell, state.design], " is not verified correctly ("];
TerminalIO.PutRopes [NARROW [CDProperties.GetObjectProp [cdCell, $rule], ROPE], ")\n"]
END
END; -- ProblemMessage
UncheckedMessage: EachCell ~
BEGIN
[cell: Drc.CoreCell, data: REF ANY ← NIL]
Asserts that correct cells are not flagged for violations
state: Misc ~ NARROW [data];
cdCell: CD.Object ~ CoreGeometry.GetObject [state.geom, cell];
drv: Drc.DRV ~ NARROW [CoreProperties.GetProp [cell.properties, Drc.DRVkey]];
IF (drv =
NIL)
OR (drv.count # 1)
THEN
BEGIN
description: ROPE ~ NARROW [CDProperties.GetObjectProp [cdCell, $rule]];
flat: BOOL ~ (CDProperties.GetObjectProp [cdCell, $flat] # NIL);
IF flat THEN TerminalIO.PutF ["%g is verified flat (%g)\n", IO.rope [CDDirectory.Name [cdCell, state.design]], IO.rope [description]]
ELSE TerminalIO.PutF ["%g is not verified correctly (%g)\n", IO.rope [CDDirectory.Name [cdCell, state.design]], IO.rope [description]]
END
END; -- UncheckedMessage
RegressionTest: Commander.CommandProc ~
BEGIN
[cmd: Commander.Handle] RETURNS [result: REF ANY ← NIL, msg: ROPE ← NIL]
Makes a DRC run over the test file to assess the correctnes of the implementation.
technology: ROPE ~ CommandTool.NextArgument [cmd];
state: Misc ~ NEW [Stuff];
dummy: REF BOOL ~ NEW [BOOL ← FALSE];
lapCounter: REF CARDINAL ← NEW [CARDINAL];
currentCell: REF ROPE ← NEW [ROPE];
regressionDesign: ROPE; usedRuleKey: ATOM; rules: DesignRules.Rules;
techE: Sinix.Mode; techD: Drc.Tech;
ok, ko: CD.Object;
SELECT
TRUE
FROM
technology.IsEmpty => RETURN [$Failure, "Please specify a technology, such as VTI"];
technology.Equal ["VTI", FALSE] => regressionDesign ← regressionDesignVTI;
technology.Equal ["Dragon", FALSE] => regressionDesign ← regressionDesignDragon;
ENDCASE => RETURN [$Failure, "Unknown technology"];
state.design ← CDIO.ReadDesign [regressionDesign];
IF (state.design = NIL) THEN {hint ← "Cannot read regression design"; GOTO maintenanceProblem};
usedRuleKey ← DesignRules.FetchRulesID [state.design];
IF (usedRuleKey = NIL) THEN usedRuleKey ← $VTI;
rules ← DesignRules.GetRuleSet [usedRuleKey];
techE ← SinixOps.GetExtractMode [state.design.technology];
state.geom ← techE.decoration;
techD ← DrcCmosb.NewTechnology [IF religion THEN cMosBsimpleKey ELSE cMosBcompleteKey, rules];
IF (techD = NIL) THEN {hint ← "Genista technology not found"; GOTO maintenanceProblem};
ok ← CDDirectory.Fetch [state.design, "ok.mask"].object;
IF (ok = NIL) THEN {hint ← "Heretic regression design"; GOTO maintenanceProblem};
TerminalIO.PutRope ["\n"];
WITH Sinix.Extract [obj: ok, mode: techE].result
SELECT
FROM
coreCell: Drc.CoreCell =>
IF (Drc.CheckDesignRules [cell: coreCell, tech: techD, viaFlatness: TRUE, external: coreCell.public, stopFlag: dummy, lap: lapCounter, currentCell: currentCell, layout: state.geom] > 0) THEN EnumerateCore [coreCell, ProblemMessage, NIL, state, dummy];
ENDCASE => ERROR;
TerminalIO.PutRope ["\n"];
ko ← CDDirectory.Fetch [state.design, "ko.mask"].object;
IF (ko = NIL) THEN {hint ← "Heretic regression design"; GOTO maintenanceProblem};
WITH Sinix.Extract [obj: ko, mode: techE].result
SELECT
FROM
coreCell: Drc.CoreCell =>
BEGIN
[] ← Drc.CheckDesignRules [cell: coreCell, tech: techD, viaFlatness: TRUE, external: coreCell.public, stopFlag: dummy, lap: lapCounter, currentCell: currentCell, layout: state.geom];
EnumerateCore [coreCell, UncheckedMessage, NIL, state, dummy]
END;
ENDCASE => ERROR;
EXITS
maintenanceProblem =>
BEGIN
TerminalIO.PutRope [hint.Cat ["\nPlease inform DRC maintainers that the self verification might be broken.\n"]];
RETURN [$Failure, Rope.Cat ["Regression test might be broken [", hint, "]"]]
END
END; -- RegressionTest
EmulateSoS: UserProfile.ProfileChangedProc ~
BEGIN
religion ← UserProfile.Boolean ["Genista.EmulateSoS", FALSE]
END; -- EmulateSoS
Registrations:
PROC ~
BEGIN
[] ← CDProperties.RegisterProperty [$DrcNr, $gbb];
Commander.Register [key: "TestGenista", proc: RegressionTest, doc: "Makes a DRC run over the test file to assess the correctnes of the implementation."];
UserProfile.CallWhenProfileChanges [EmulateSoS]
END; -- Registrations
Registrations