MakeRangeExtractor:
PUBLIC
PROC [design:
CD.Design, index, subSize, size:
NAT]
RETURNS [wires: Wires, obj:
CD.Object] = {
l: INT = design.technology.lambda;
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;
obj ← PW.CreateEmptyCell[];
The structured wire
PutPin[structWire, obj, [19*l/2, l/2], [0, 2*l]];
The extracted wire
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/2, 3*l/2], CD.commentLayer], [5*l/2, 0]];
PutPin[subWire, obj, [l/2, 3*l/2], [3*l, 0]];
The rectangle
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [27*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutFR["%g/%g", IO.int[index], IO.int[subSize]], font], [13*l/4, -13*l/4]];
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [13*l/4, 5*l/4]];
CDProperties.PutObjectProp[obj, $ExtractorIndex, NEW [INT ← index]];
CDProperties.PutObjectProp[obj, $ExtractorSubSize, NEW [INT ← subSize]];
CDProperties.PutObjectProp[obj, $ExtractorSize, NEW [INT ← size]];
CDProperties.PutObjectProp[obj, Sisyph.mode.extractProcProp, $WireIconsExtractRangeExtractor];
PW.SetInterestRect[obj, [19*l/2, 7*l/2]];
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
ExtractRangeExtractor: Sinix.ExtractProc = {
cx: Sisyph.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[Sisyph.GetDesign[cx], index, subSize, size].wires;
};