DIRECTORY BSimModel, FS USING [StreamOpen], IO USING [Backup, char, Close, GetChar, GetLineRope, GetReal, Put, PutF, real, RIS, rope, STREAM], Rope USING [Cat, Equal, Fetch, Find, Length, ROPE, Substr]; BSimModelImplInput: CEDAR PROGRAM IMPORTS FS, IO, Rope EXPORTS BSimModel = BEGIN ReadProcessFile: PUBLIC PROC [ fileName: Rope.ROPE ] RETURNS [ p: REF BSimModel.ProcessParams ] = { s: IO.STREAM = FS.StreamOpen[fileName]; ReadReal: PROC [ s: IO.STREAM ] RETURNS [ r: REAL ] = BEGIN DO SELECT (c _ s.GetChar[]) FROM ',, ' , '/, 'x, 'X, '\n => NULL; ENDCASE => {s.Backup[c]; RETURN[s.GetReal[]]}; ENDLOOP; END; c: CHAR; p _ NEW[BSimModel.ProcessParams]; p.info _ NIL; WHILE (c _ s.GetChar[]) = '* DO line: Rope.ROPE = s.GetLineRope[]; eqPos: INT = line.Find["="]; p.info _ Rope.Cat[p.info, "*", line, "\n"]; IF line.Length>1 AND line.Fetch[0]#' AND eqPos>0 THEN { label: Rope.ROPE = line.Substr[len: eqPos]; rest: IO.STREAM = IO.RIS[line.Substr[start: eqPos+1]]; SELECT TRUE FROM label.Equal["W/L", FALSE] => { p.dutW _ ReadReal[rest]; p.dutL _ ReadReal[rest]}; label.Equal["BetaFudgeFactor", FALSE] => p.betaFudgeFactor _ ReadReal[rest]; ENDCASE => NULL; }; ENDLOOP; s.Backup[c]; FOR i: INT IN [0..BSimModel.nBasicBSimParams) DO FOR j: INT IN [1..6] DO p.params[i][j] _ ReadReal[s]; ENDLOOP; ENDLOOP; p.toxMicrons _ ReadReal[s]; p.tempC _ ReadReal[s]; p.vddVolts _ ReadReal[s]; s.Close[]; }; WriteProcessFile: PUBLIC PROC [ fileName: Rope.ROPE, p: REF BSimModel.ProcessParams ] = { s: IO.STREAM = FS.StreamOpen[fileName, $create]; s.Put[IO.rope[p.info]]; FOR i: INT IN [0..BSimModel.nBasicBSimParams) DO FOR j: INT IN [1..6] DO s.Put[IO.real[p.params[i][j]], IO.char[IF j<6 THEN ', ELSE '\n]]; ENDLOOP; ENDLOOP; s.PutF["%g,%g,%g\n", IO.real[p.toxMicrons], IO.real[p.tempC], IO.real[p.vddVolts]]; s.Close[]; }; END. CHANGE LOG. McCreight, April 22, 1985 10:56:32 am PST, created. Chen, July 17, 1985 11:15:12 am PDT, recompiled in Cedar6.0. όFile: BSimModelImplInput.mesa Copyright (C) 1985 by Xerox Corporation. All rights reserved. Last Edited by: Christian LeCocq January 27, 1987 10:16:15 am PST McCreight, April 22, 1985 10:56:32 am PST Sweetsun Chen, July 22, 1985 8:14:04 pm PDT Κs˜Jšœ™J™>™Icode™1J™)K™+—J˜šΟk ˜ Kšœ ˜ Kšœœ˜KšœœGœœ˜bKšœœ#œ ˜;K˜—šΟnœœœœœœœ ˜JKš˜K˜š žœœœœœœ˜cKšœœœœ˜'K˜š žœœœœœœ˜5Kš˜š˜šœ˜Kšœœ˜ Kšœœ˜.—Kšœ˜—Kšœ˜K˜—Kšœœ˜Kšœœ˜!Kšœ œ˜ šœ˜Kšœ œ˜"Kšœœ˜Kšœ+˜+šœœœ œ˜8Kšœ œ˜+Kš œœœœœ˜6šœœ˜šœœ˜Kšœ2˜2—šœœ˜(Kšœ#˜#—Kšœœ˜—Kšœ˜—Kšœ˜—Kšœ ˜ šœœœ!˜0šœœœ˜Kšœ˜Kšœ˜—Kšœ˜—Kšœ˜Kšœ˜Kšœ˜Kšœ ˜ Kšœ˜—K˜š žœœœœœ˜YKšœœœœ˜0K˜Kšœœ˜šœœœ!˜0šœœœ˜Kš œœœœœœ˜AKšœ˜—Kšœ˜—Kšœœœœ˜TKšœ ˜ Kšœ˜K˜—Kšœ˜—K˜šœœ˜ Kšœ&œ ˜3Kšœ œ˜