MakeRangeExtractor:
PUBLIC
PROC [design:
CD.Design, index, subSize, size:
NAT]
RETURNS [wires: Wires, obj:
CD.Object] = {
l: INT = design.technology.lambda;
il: CD.InstanceList ← NIL;
We create an extra level of hierarchy in the wires to extract things properly
structWire: Wire ← CoreOps.CreateWires[size: size];
subWire: Wire ← CoreOps.CreateWires[size: subSize];
wires ← LIST [subWire, structWire];
The composed wires
FOR i: NAT IN [0 .. size) DO structWire[i] ← CoreOps.CreateWire[] ENDLOOP;
FOR i: NAT IN [0 .. subSize) DO subWire[i] ← structWire[i+index] ENDLOOP;
The structured wire
il ← PutPin[structWire, [19*l/2, l/2], [0, 2*l], il];
The extracted wire
il ← AddRect[[l/2, 3*l/2], [5*l/2, 0], il];
il ← PutPin[subWire, [l/2, 3*l/2], [3*l, 0], il];
The rectangle
il ← AddRect[[5*l/2, l/8], [l, 3*l/2], il];
il ← AddRect[[5*l/2, l/8], [l, 3*l], il];
il ← AddRect[[l/8, 3*l/2], [l, 3*l/2], il];
il ← AddRect[[l/8, 3*l/2], [27*l/8, 13*l/8], il];
The texts
il ← AddText[IO.PutFR["%g/%g", IO.int[index], IO.int[subSize]], [13*l/4, -7*l/4], il];
il ← AddText[IO.PutR1[IO.int[size]], [13*l/4, 11*l/4], il];
obj ← PW.CreateCell[instances: il, ir: [0, 0, 19*l/2, 7*l/2], props: LIST [[$ExtractorIndex, NEW [INT ← index]], [$ExtractorSubSize, NEW [INT ← subSize]], [$ExtractorSize, NEW [INT ← size]], [PipalSisyph.mode.extractProcProp, $WireIconsExtractRangeExtractor]]];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
ExtractRangeExtractor: PipalSinix.ExtractProc = {
cx: PipalSisyph.Context = NARROW [userData];
refNat: REF INT ← NARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]];
refNat2: REF INT ← NARROW [CDProperties.GetObjectProp[obj, $ExtractorSubSize]];
refNat3: REF INT ← NARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]];
index: NAT ← NAT [refNat^];
subSize: NAT ← NAT [refNat2^];
size: NAT ← NAT [refNat3^];
result ← MakeRangeExtractor[PipalSisyph.GetDesign[cx], index, subSize, size].wires;
};