DIRECTORY Core, CoreFlat, Ports, Rope; Combinatorial: CEDAR DEFINITIONS = BEGIN IsCombinatorial: PROC [cell: Core.CellType] RETURNS [BOOL]; IsNonCombinatorial: PROC [cell: Core.CellType] RETURNS [BOOL]; NotCombinatorial: ERROR [cell: Core.CellType]; WireType: TYPE = {input, output, gnd, vdd}; EnumerateTypedWires: PROC [cc: Core.CellType, each: PROC [Core.Wire, ROPE, WireType] RETURNS [quit: BOOL _ FALSE]] RETURNS [quit: BOOL]; GetTypedWires: PROC [cc: Core.CellType, type: WireType] RETURNS [Core.Wires]; GetWireType: PROC [cc: Core.CellType, wire: Core.Wire] RETURNS [type: WireType]; ROPE: TYPE = Rope.ROPE; ParseTree: TYPE = REF; -- Union of ROPE (for variables), REF ParseOperRec and REF INT ParseTrees: TYPE = LIST OF ParseTree; ParseOperRec: TYPE = RECORD [oper: ROPE, params: ParseTrees]; Oper: PROC [oper: ROPE, params: ParseTrees] RETURNS [ParseTree]; Not: PROC [tree: ParseTree] RETURNS [ParseTree]; And: PROC [trees: ParseTrees] RETURNS [ParseTree]; Or: PROC [trees: ParseTrees] RETURNS [ParseTree]; And2: PROC [tree1, tree2: ParseTree] RETURNS [ParseTree]; Or2: PROC [tree1, tree2: ParseTree] RETURNS [ParseTree]; IncorrectExpression: ERROR [expr, msg: ROPE]; ParseExpression: PROC [expr: ROPE] RETURNS [tree: ParseTree]; UnParseExpression: PROC [tree: ParseTree] RETURNS [expr: ROPE]; RenameVariables: PROC [tree: ParseTree, var: PROC [ROPE] RETURNS [ROPE]] RETURNS [ParseTree]; ParseOutput: PROC [wire: Core.Wire] RETURNS [tree: ParseTree]; RecastProc: TYPE = PROC [params: LIST OF REF] RETURNS [tree: ParseTree]; RegisterOperator: PROC [oper: ROPE, recast: RecastProc]; FetchOperator: PROC [oper: ROPE] RETURNS [recast: RecastProc]; Recast: PROC [ParseTree] RETURNS [ParseTree]; BindCombinatorial: PROC [cc: Core.CellType]; CheckTransistorsAgainstExpressions: PROC [cc: Core.CellType, checkXValues: BOOL _ TRUE]; CheckUnsuccessful: SIGNAL [level1, level2: Ports.Level]; InputOutputProblem: SIGNAL [type: ATOM, root: Core.CellType, flatWire: CoreFlat.FlatWire _ NIL]; MakeCombinatorial: PROC [cell: Core.CellType]; AttemptMakeCombinatorial: PROC [cell: Core.CellType] RETURNS [trans, ok, notOK: INT _ 0]; SplitCombinatorial: PUBLIC PROC [cell: Core.CellType, flatten: PROC [ct: Core.CellType] RETURNS [BOOL]] RETURNS [record: Core.CellType]; END. ΄Combinatorial.mesa Copyright Σ 1987 by Xerox Corporation. All rights reversed. Created by Bertrand Serlet August 24, 1987 9:59:31 pm PDT Bertrand Serlet September 10, 1987 11:22:49 am PDT Purpose The aim of this interface is to define how the notion of combinatorial cells is implemented, to define a syntax for boolean expressions, and to define generic operations for manipulating combinatorial cells. The property $Combinatorial, which value is a REF BOOL, expresses whether the cell is combinatorial or not. Any CellType can carry this property, not just record cells. Each output has an $Output property which value is a ROPE expressing the value of the expression. The syntax for expressions is (infix): expr == var | ~expr | (expr) | expr + expr | expr * expr | oper(expr1, ..., exprn) | int oper == IO.tokenID var == anything that can originate from CoreOps.GetFullWireName The order of precedence is ~, *, +. The only admissible variables are the full names of input, structured or not. In particular an output cannot use other outputs. Outputs are restricted to atomic wires. Certain restrictions apply on certain operators. For example +, ~, * only deal with sub-expressions or atomic inputs (no structured inputs nor integers). The root expression cannot be an int. Atomic wires not Gnd not Vdd and not output are inputs. There is no tri-state wire in a combinatorial cell. Predicates Returns TRUE if cell is marked combinatorial. Returns TRUE if cell is marked non-combinatorial. Exception raised by several functions of this interface. Typing of wires Enumerate each atomic wire with its full name and its type. In case of DAGs, wires may be enumerated twice. Raises NotCombinatorial if cc is not combinatorial. Returns all atomic wires of this type. No duplication in the returned list. Raises NotCombinatorial if cc is not combinatorial. Not a very efficient function. Raises NotCombinatorial if cc is not combinatorial. Parse Trees and Creation Conveniences Parsing/Unparsing of Expressions Might raise IncorrectExpression. Convenience only. Might raise IncorrectExpression. Defining new Operators Convenience function that assumes the tree is a REF ParseOperRec, searches the corresponding RecastProc and applies it. Simulation of Combinatorial cells A standard Rosemary EvalProc is defined for simulating combinatorial cells. It is registered under the name "Combinatorial", and should be stored on cell types, e.g. by using BindCombinatorial. Initializes ports and does a Rosemary.BindCellType. Compares transistor level simulation against expression level for all possible values of the inputs, including X if checkXValues. Might raise CheckUnsuccessful. Statically Making Combinatorial Cells Type is one of the following: $OutputLoop, $OutputOfTwoCombinatorialCells, $NonPublicInput Assumes that cell is combinatorial or only made of combinatorial sub cells and recursively makes all those cells combinatorial. This is symbolic simulation! Might raise InputOutputProblem. It is OK to proceed, but an ERROR NotCombinatorial will be raised before making the cell combinatorial. Same as previous but catches NotCombinatorial. Splitting Cells into Combinatorial and Non Splits a cellType into combinatorial logic and other cell. Instance 0 contains all the combinatorial logic. This instance is made combinatorial, and might raise the corresponding exceptions. flatten returns FALSE if argument should not be further flattened. ct and record conform. Κ½˜– "Cedar" stylešœ™Jšœ<™K™1K˜—šžœœ˜.K™8——™šœ œ˜+K˜—šžœœœ œ œœœœœ˜ˆKšœŸœ&™;K™/Kšœ3™3K™—šž œœ%œ˜MKšœ Ÿœ™&K™$Kšœ3™3K™—šž œœ&œ˜PK™Kšœ3™3——™%Kšœœœ˜Kšœ œœΟc>˜UKšœ œœœ ˜%šœœœœ˜=K™—šžœœœœ ˜@K˜—šžœœœ ˜0K˜—šžœœœ ˜2K˜—šžœœœ ˜1K˜—šžœœœ ˜9K˜—Kšžœœœ ˜8—™ šžœœ œ˜-K˜—šžœœœœ˜=K™ K™—šžœœœœ˜?K™—šžœœœœœœœ ˜]K™—šž œœœ˜>K™K™ ——™š œ œœ œœœœ˜HK˜—šžœœœ˜8K˜—šž œœœœ˜>K˜—šžœœ œ ˜-Kšœ0œD™w——™!šœΒ™ΒM™—šžœœ˜,K™3K™—šž"œœ#œœ˜XK™Kšœ™Kšžœœ˜8K™——™%šžœœœ5œ˜`KšœZ™ZK˜—šžœœ˜.Kšœ™Kšœ™Kšœˆ™ˆK™—šžœœœœ˜YKšœ.™.——™*šžœœœ œœœœ˜ˆK™:K™„Kšœœ-™BKšœ™K™——Jšœ˜—…—κ[