DIRECTORY Core, CoreOps, CoreProperties, CoreDecoder; CoreDecoderImpl: CEDAR PROGRAM IMPORTS CoreOps, CoreProperties EXPORTS CoreDecoder = BEGIN OPEN Core, CoreDecoder; decoderCellClass: PUBLIC CellClass _ NEW[CellClassRec _ [name: "Decoder", recast: Recast, write: Write, read: Read]]; Start: PROC = { CoreOps.RegisterCellClass[decoderCellClass]; decoderCellClass.properties _ CoreProperties.PutProp[on: decoderCellClass.properties, prop: CoreOps.printClassProcProp, value: NEW[CoreOps.PrintClassProc _ PropPrintClass]]; }; Write: WriteProc = { }; Read: ReadProc = { }; Recast: RecastProc = { }; Create: PUBLIC PROC [decoderCellType: DecoderCellType, name: ROPE _ NIL] RETURNS [cellType: CellType] = { cellType _ NEW[CellTypeRec _ [ name: name, class: decoderCellClass, publicWire: CoreOps.CreateRecordWire[components: LIST [ CoreOps.CreateAtomWire["Vdd"], CoreOps.CreateAtomWire["Gnd"], CoreOps.CreateSequenceWire[name: "AdrBit", base: CoreOps.CreateAtomWire[], count: decoderCellType.bitCount], CoreOps.CreateSequenceWire[name: "nAdrBit", base: CoreOps.CreateAtomWire[], count: decoderCellType.bitCount], CoreOps.CreateSequenceWire[name: "nDecode", base: CoreOps.CreateAtomWire[], count: decoderCellType.wordCount]]], data: decoderCellType]] }; PropPrintClass: CoreOps.PrintClassProc = {Print[NARROW[data], out]}; Print: PUBLIC PROC [decoderCellType: DecoderCellType, out: STREAM] = { }; Start[]; END. 0CoreDecoderImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Barth, August 23, 1985 2:57:23 pm PDT decCell: DecoderCellType _ NARROW[me.data]; recCell: CoreRecord.RecordCellType _ NEW[CoreRecord.RecordCellTypeRec]; new _ NEW[CellTypeRec _ [ name: me.name, class: CoreRecord.recordCellClass, publicWire: CoreOps.CopyWire[wire: me.publicWire], data: recCell, properties: CoreProperties.CopyProps[propList: me.properties]]]; recCell.internalWire _ NEW[WireRec _ [ structure: record, elements: NEW[WireSequenceRec[new.publicWire.elements.size + 1]]]]; FOR w: NAT IN [0..new.publicWire.elements.size) DO recCell.internalWire.elements[w] _ new.publicWire.elements[w]; ENDLOOP; recCell.internalWire.elements[recCell.internalWire.elements.size - 1] _ CoreOps.CreateSequenceWire[count: decCell.wordCount, base: CoreOps.CreateSequenceWire[count: decCell.bitCount - 1, base: CoreOps.CreateAtomWire[]]]; FOR word: NAT IN [0..decCell.wordCount) DO FOR bit: NAT IN [0..decCell.bitCount) DO bitCell: CellType _ decCell.cellTypes[decCell.select[word, bit, decCell]]; newActual: Wire _ NEW[WireRec _ [ structure: record, elements: NEW[WireSequenceRec[bitCell.publicWire.elements.size]]]]; newActual.elements[0] _ recCell.internalWire.elements[0]; newActual.elements[1] _ recCell.internalWire.elements[1]; newActual.elements[2] _ recCell.internalWire.elements[2].elements[bit]; newActual.elements[3] _ recCell.internalWire.elements[3].elements[bit]; newActual.elements[4] _ recCell.internalWire.elements[4].elements[word]; newActual.elements[5] _ IF bit=0 THEN recCell.internalWire.elements[1] ELSE recCell.internalWire.elements[5].elements[word].elements[bit-1]; newActual.elements[6] _ IF bit=decCell.bitCount-1 THEN recCell.internalWire.elements[4].elements[word] ELSE recCell.internalWire.elements[5].elements[word].elements[bit]; recCell.instances _ CONS[ NEW[CoreRecord.CellInstanceRec _ [ name: IF bitCell.name=NIL THEN NIL ELSE IO.PutFR["%g%gx%g", IO.rope[bitCell.name], IO.int[word], IO.int[bit]], actualWire: newActual, type: bitCell]], recCell.instances]; ENDLOOP; ENDLOOP; ΚU– "cedar" style˜codešœ™Kšœ Οmœ1™™>Kšžœ™—Kšœά™άšžœžœžœž™*šžœžœžœž™(KšœJ™Jšœžœ ™!Kšœ™Kšœ žœ6™C—Kšœ9™9Kšœ9™9KšœG™GKšœG™GKšœH™HKšœžœžœ"žœA™ŒKšœžœžœ1žœ?™ͺšœžœ™šžœ™"Kšœžœžœžœžœžœžœžœžœ žœ ™nKšœ™Kšœ™—Kšœ™—Kšžœ™—Kšžœ™—Kšœ˜K˜—š Ÿœžœžœ*žœžœžœ˜išœ žœ˜Kšœ ˜ Kšœ˜šœ1žœ˜7Kšœ˜Kšœ˜Kšœl˜lKšœm˜mKšœp˜p—Kšœ˜—Kšœ˜K˜—Jšœ0žœ˜DšŸœžœžœ)žœ˜FKšœ˜K˜—Kšœ˜K˜Kšžœ˜K˜—…—Œ