<> <> <> <> <> <> <> <> DIRECTORY BasicTime, FS, IntDefs, IntTransDefs, IO, IODefs, LayerFileDefs, MPCDefs, MPCParserDefs, OutputDefs, ParserDefs, ParserErrorDefs, ParserInputDefs, Rope; MPCControl: CEDAR PROGRAM IMPORTS FS, IntDefs, IO, IODefs, IntTransDefs, LayerFileDefs, OutputDefs, ParserDefs, ParserErrorDefs, ParserInputDefs, Rope EXPORTS MPCDefs = BEGIN space: Rope.ROPE = " "; InitMPC: PUBLIC PROCEDURE [mpc: REF MPCDefs.MPCDescriptor] RETURNS [ok: BOOLEAN] = <> <> BEGIN IODefs.PrintTime[" InitMPC"]; IODefs.WriteString[" "]; IODefs.WriteString[mpc.title]; IODefs.WriteString[space]; IODefs.WriteString[mpc.date]; IODefs.WriteString[space]; IODefs.WriteLine[mpc.account]; ok _ mpc.title.Length <= 7 AND mpc.date.Length = 6 AND mpc.account.Length <= 20; END; InitWafer: PUBLIC PROCEDURE [wafer: REF MPCDefs.WaferDescriptor] RETURNS [ok: BOOLEAN] = <> BEGIN IODefs.PrintTime[" InitWafer"]; IODefs.WriteString[" "]; IODefs.WriteString[wafer.waferName]; IODefs.WriteString[space]; IODefs.WriteReal[wafer.waferSizeX]; IODefs.WriteString[space]; IODefs.WriteReal[wafer.waferSizeY]; IODefs.WriteString[space]; IODefs.WriteReal[wafer.outputUnitsPerMicron]; IODefs.WriteLine[""]; ok _ (SELECT wafer.outputUnitsPerMicron FROM 1, 2, 4 => TRUE, ENDCASE => FALSE) AND wafer.inMPC.title.Length+wafer.waferName.Length <= 7; END; InitChip: PUBLIC PROCEDURE [chip: REF MPCDefs.ChipDescriptor] RETURNS [ok: BOOLEAN] = <> <> <> <> BEGIN IODefs.PrintTime[" InitChip"]; IODefs.WriteString[" "]; IODefs.WriteString[chip.chipName]; IODefs.WriteString[space]; IODefs.WriteReal[chip.chipSizeX]; IODefs.WriteString[space]; IODefs.WriteReal[chip.chipSizeY]; IODefs.WriteLine[""]; ok _ chip.inWafer.inMPC.title.Length + chip.inWafer.waferName.Length + chip.chipName.Length = 7 AND OutputDefs.InitOutput[chip]; END; ConvertProject: PUBLIC PROCEDURE [project: REF MPCDefs.ProjectDescriptor] RETURNS [ ok: BOOLEAN, errorSummary: ARRAY ParserErrorDefs.ErrorType OF CARDINAL] = <> <> <> <> <> <> <> <> BEGIN bias: LONG INTEGER; --Rounding fudge in CIF units to jog coords away from half units aborted: BOOLEAN _ FALSE; bias _ 8/project.inChip.inWafer.outputUnitsPerMicron; IODefs.PrintTime[" ConvertProject"]; IODefs.WriteLine[IO.PutFR[" %g", IO.rope[UniqueID[project.cifFileName]]]]; IODefs.WriteLine[IO.PutFR[" %g %g %g %g", IO.real[project.rotateX], IO.real[project.rotateY], IO.real[project.translateX], IO.real[project.translateY]]]; ok _ TRUE; errorSummary _ ALL[0]; [] _ OutputDefs.InitProject[project]; IF ~ParserDefs.InitParser[] OR ~ParserInputDefs.InFromFile[project.cifFileName] THEN RETURN[FALSE, errorSummary]; IF ~IntDefs.InitInterpreter[] THEN RETURN[FALSE, errorSummary]; <
> BEGIN ENABLE ParserErrorDefs.ParserAbort => BEGIN aborted _ TRUE; IODefs.WriteLine["---Parser aborted---"]; CONTINUE; END; nStatements: INT _ 0; DO SELECT ParserDefs.ParseStatement[] FROM End => BEGIN nStatements _ nStatements + 1; EXIT; END; SemanticError, SyntaxError => IF ParserInputDefs.EndOfFile[] THEN aborted _ TRUE; ENDCASE; nStatements _ nStatements + 1; IF nStatements MOD 100 = 0 THEN IODefs.PostIt[IO.PutFR["CIF File: %g, Statement: %g...", IO.rope[project.cifFileName], IO.int[nStatements]]]; IF ParserInputDefs.EndOfFile[] THEN BEGIN IODefs.WriteLine[ "Unexpected end of input file, Probably missing End command"]; aborted _ TRUE; END; ENDLOOP; END; --End of Enable clause errorSummary _ ParserErrorDefs.ErrorSummary[]; [] _ ParserDefs.FinishParser[]; IntTransDefs.Push[]; IntTransDefs.Rotate[project.rotateX, project.rotateY]; --Orient project IntTransDefs.Translate[(project.translateX*100) + bias, (project.translateY*100) + bias]; --Position project(converting to CIF units) IntTransDefs.Scale[project.inChip.inWafer.outputUnitsPerMicron, 100]; --CIF units to Output(Mebes) units IntTransDefs.Push[]; --Just in case next transformation user doesn't ok _ ~aborted AND (errorSummary[Fatal] + errorSummary[FatalSyntax] + errorSummary[ FatalSemantic] + errorSummary[FatalInternal]) = 0; IF ok THEN IntDefs.Instantiate[]; IntTransDefs.Pop[]; --to match safety Push IntTransDefs.Pop[]; --project transformation [] _ IntDefs.FinishInterpreter[]; END; WriteLayerFile: PUBLIC PROCEDURE [layerFile: MPCDefs.LayerFileItem, chip: REF MPCDefs.ChipDescriptor] RETURNS [ok: BOOLEAN] = <> <> <<(e.g. "04" and "PO", respectively, for polysilicon)>> BEGIN totalChipName: Rope.ROPE _ IO.PutFR["%g%g%g", IO.rope[chip.inWafer.inMPC.title], IO.rope[chip.inWafer.waferName], IO.rope[chip.chipName]]; layerFileName: Rope.ROPE _ IO.PutFR["%g-%g-%g.mebes", IO.rope[totalChipName], IO.rope[layerFile.layerNumber], IO.rope[layerFile.layerName]]; layerNameString: Rope.ROPE _ IO.PutFR["%g%g.%g", IO.rope[totalChipName], IO.rope[layerFile.layerNumber], IO.rope[layerFile.layerName]]; IODefs.WriteLine[IO.PutFR[" WriteLayerFile %g %g %g ...", IO.rope[layerFile.layerNumber], IO.rope[layerFile.layerName], IO.time[]]]; LayerFileDefs.MakeLayerFile[ layerFileName, layerFile.pFileLayer, layerNameString, chip.inWafer.inMPC.date, " " -- mask shop info --, chip.chipSizeX*chip.inWafer.outputUnitsPerMicron, chip.chipSizeY*chip.inWafer.outputUnitsPerMicron, chip.inWafer.outputUnitsPerMicron]; IODefs.WriteLine[IO.PutFR[" %g {%g} ... written", IO.rope[UniqueID[layerFileName]], IO.rope[layerNameString]]]; ok _ TRUE; END; FinishChip: PUBLIC PROCEDURE RETURNS [ok: BOOLEAN] = BEGIN IODefs.WriteString[" FinishChip -- "]; ok _ OutputDefs.FinishOutput[]; IODefs.PrintTime[" "]; END; FinishWafer: PUBLIC PROCEDURE RETURNS [ok: BOOLEAN] = <> BEGIN IODefs.PrintTime[" FinishWafer"]; RETURN[TRUE]; END; FinishMPC: PUBLIC PROCEDURE RETURNS [ok: BOOLEAN] = <> BEGIN IODefs.PrintTime[" FinishMPC"]; RETURN[TRUE]; END; UniqueID: PROC [ fileName: Rope.ROPE ] RETURNS [ id: Rope.ROPE ] = BEGIN fullFileName: Rope.ROPE _ fileName; attachedTo: Rope.ROPE _ NIL; bytes: INT _ 0; gmt: BasicTime.GMT _ BasicTime.nullGMT; [fullFName: fullFileName, attachedTo: attachedTo, bytes: bytes, created: gmt] _ FS.FileInfo[name: fileName, remoteCheck: TRUE ! FS.Error => CONTINUE]; id _ IO.PutFR["%g%g (%g bytes) Of %g", IO.rope[fullFileName], IO.rope[(IF attachedTo.Length=0 THEN NIL ELSE IO.PutFR["(%g)", IO.rope[attachedTo]])], IO.int[bytes], (IF gmt=BasicTime.nullGMT THEN IO.rope["??"] ELSE IO.time[gmt])]; END; END.