MCWireIcons.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Last Edited by: Gasbarro July 16, 1987 6:42:59 pm PDT
DIRECTORY
Atom, Core, CoreCreate, CoreOps, CoreProperties;
MCWireIcons: CEDAR PROGRAM
IMPORTS CoreCreate, CoreOps, CoreProperties
~ BEGIN
dataBits: NAT = 64;
correctBits: NAT = 8;
width: NAT = 72;
Wire: TYPE = Core.Wire;
Side: TYPE = {Top, Bottom, Left, Right};
extractSchematic: BOOLTRUE;
Corrector: PROC RETURNS [wire: Wire] ~ {
sel: Wire ← CoreCreate.Seq["Sel", 18];
left: Wire ← CoreOps.CreateWires[width, "L"];
mid: Wire ← CoreCreate.Seq["M", width];
right: Wire ← CoreCreate.Seq["R", width];
vdd: Wire ← CoreOps.CreateWire[name: "Vdd"];
FOR i: NAT IN [0..correctBits) DO
left[i] ← vdd;
mid[i] ← vdd;
right[i] ← vdd;
ENDLOOP;
FOR i: NAT IN [0..dataBits-1) DO
left[i+correctBits] ← sel[17];
mid[i+correctBits] ← sel[15 - (i/8)];
right[i+correctBits] ← sel[7 - (i MOD 8)];
ENDLOOP;
left[width-1] ← sel[16]; --the LSB of the data word maps to correction bit 62
mid[width-1] ← sel[15];
right[width-1] ← sel[6];
wire ← CoreCreate.Wires[sel, left, mid, right, vdd];
};
WirePosition: PROC [side: Side, index, size, inc, pos: NAT] RETURNS [wire: Wire] ~ {
posProp: ATOMSELECT side FROM
Top => $TopPosition,
Bottom => $BottomPosition,
Left => $LeftPosition,
Right => $RightPosition,
ENDCASE => NIL;
IF size=0 THEN ERROR;
IF inc=0 THEN ERROR;
IF pos+1>inc THEN ERROR;
IF size>1 THEN {
wire ← CoreCreate.Seq[name: "X", size: size];
FOR i: NAT IN [0..size) DO
CoreProperties.PutWireProp[wire[i], posProp, NEW[INT ← (index+i)*inc+pos]];
ENDLOOP;
} ELSE wire ← CoreOps.CreateWire[name: "X", props: CoreProperties.Props[[posProp, NEW[INT ← index*inc+pos]]]];
};
END.