PTilerDoc.tioga
Written by: Bob Mayo, June 12, 1984 11:40:42 am PDT
WRITING MODULE GENERATORS USING PTILER
WRITING MODULE GENERATORS USING PTILER
CEDAR 5.2 — FOR INTERNAL XEROX USE ONLY
CEDAR 5.2 — FOR INTERNAL XEROX USE ONLY
Writing Module Generators Using Ptiler
Bob Mayo (June 12, 1984)
Filed on: /Indigo/ChipNDale/5.2/PTiler/PTilerDoc.tioga (eventually)

© Copyright 1984 Xerox Corporation. All rights reserved.
Abstract: PTiler is a Cedar module that places down tiles (cells) of VLSI layout using alignment marks on those tiles. It is intended to be used as the layout portion of module generators, and allows those generators to be used interactively from ChipNDale. This document gives a tutorial introduction to PTiler, presents an example generator, and concludes with a reference manual for the PTiler module.
XEROX  Xerox Corporation
   Palo Alto Research Center
    3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
About PTiler Module Generators
PTiler serves two purposes. The first is to provide convenient primitives for the layout of VLSI structures, and the second is to allow module generators to be run interactively from ChipNDale. As a result, a PTiler generator sits between PTiler's user-interface and its layout back-end. A generator will register itself with PTiler, later PTiler may invoke the generator on the user's behalf. The generator will then prompt for input parameters, construct a module (using the PTiler layout primitives), and return the module to PTiler to be placed into the user's design or to be written out to a file.
This PTiler implementation is specific to ChipNDale. However, it is likely that another implementation could be written for another layout editor without changing the interface. Thus, PTiler module generators have some degree of portability.
Tiles & Their Placement
Tiles are the basic building block out of which modules are built. They are cells of geometry with some special features. The most important special feature is the existence of alignment marks. Alignment marks (or marks for short) are named points in a cell. PTiler places down new cells by aligning a mark on the new cell with a mark on a previously placed cell. For example, you can tell PTiler (using the AlignCell procedure) to place down the cell inverter next to cell driver such that point out on inverter coincides with point in on driver. By changing the location of these marks the tile designer can control the alignment and overlap of the tiles placed by the module generator.
In addition to user-supplied marks, there are 4 special marks called left, right, top, and bottom that always exist. The user may define these marks, but if they aren't defined PTiler will assume that they are located at the center of the appropriate edge. It is especially easy to align cells using these 4 marks because PTiler provides a procedure (AdjacentCell) that implicitly names these marks. AdjacentCell places a new cell next to another cell (above, below, to the right of, or to the left of) in a particular orientation (mirrored, rotated, etc.).
I'm one of those people that learns best by example, so let's jump right in.......
An Example
Here is the Mirror module generator. It's a very simple one -- it arrays a cell in the usual manner but can mirror alternate rows and columns.
File: Mirror.mesa   
Last Edited by: Mayo, June 8, 1984 12:41:26 pm PDT
-- This is a sample of a module generator built using PTiler. It creates an array of tiles in which alternate rows and columns are flipped.
DIRECTORY
PTiler USING [ModuleGeneratorProc, RegisterCommand, PlacedCell, Cell, Design, ReadDesign, GetCell, NewDesign, AdjacentCell, GetTechnology, IdentityOrient, Direction, Orientation],
TerminalIO USING [RequestRope, RequestInt, WriteRope, UserSaysYes],
CDOrient USING [rotate90, mirrorX, rotate270, ComposeOrient],
Rope USING [ROPE];
Mirror: CEDAR PROGRAM    
IMPORTS PTiler, TerminalIO, CDOrient = BEGIN
MirrorProc: PTiler.ModuleGeneratorProc = BEGIN
-- user parameters
tileSetName, cellName: Rope.ROPE;
cell: PTiler.Cell;
flipRows, flipCols: BOOL;
numRows, numCols: NAT;
-- state information
tiles, module: PTiler.Design;
prevTile: PTiler.PlacedCell;   -- the previous tile placed
prevRow: PTiler.PlacedCell;  -- the first tile in the previous row
orient: PTiler.Orientation ← PTiler.IdentityOrient;
-- constants
mirrorY: PTiler.Orientation ← CDOrient.ComposeOrient[CDOrient.ComposeOrient[CDOrient.rotate90, CDOrient.mirrorX], CDOrient.rotate270];
-- query user for parameters
tileSetName ← TerminalIO.RequestRope["What file contains the tiles? "];
tiles ← PTiler.ReadDesign[tileSetName];
IF tiles = NIL THEN GOTO BadFile;
cellName ← TerminalIO.RequestRope["What tile do you want to array? "];
cell ← PTiler.GetCell[tiles, cellName];
IF cell = NIL THEN GOTO BadCell;
numRows ← TerminalIO.RequestInt["How many rows? "];
numCols ← TerminalIO.RequestInt["How many columns? "];
flipRows ← TerminalIO.UserSaysYes["Flip alternate rows? "];
flipCols ← TerminalIO.UserSaysYes["Flip alternate columns? "];
-- initialize data structures
[module, prevTile] ← PTiler.NewDesign[PTiler.GetTechnology[tiles]];
prevRow ← prevTile;
-- main body of module generator
FOR y: NAT IN [0..numRows) DO
lastOrient: PTiler.Orientation;
lastOrient ← orient;
FOR x: NAT IN [0..numCols) DO
IF x = 0 THEN
prevRow ← prevTile ← PTiler.AdjacentCell[prevRow, cell, below, orient]
ELSE
prevTile ← PTiler.AdjacentCell[prevTile, cell, rightOf, orient];
IF flipCols THEN orient ← CDOrient.ComposeOrient[orient, CDOrient.mirrorX];
ENDLOOP;
orient ← lastOrient;
IF flipRows THEN orient ← CDOrient.ComposeOrient[orient, mirrorY];
ENDLOOP;
-- pass result back to PTiler
TerminalIO.WriteRope["Mirror done.\n"];
RETURN[module];
-- error exits
EXITS
BadFile => BEGIN
TerminalIO.WriteRope["Could not load tiles -- goodbye!\n"];
RETURN[NIL];
END;
BadCell => BEGIN
TerminalIO.WriteRope["Could not find that cell -- goodbye!\n"];
RETURN[NIL];
END;
END;
-- register this generator with PTiler
[] ← PTiler.RegisterCommand["Mirror", MirrorProc];
END.
The outermost block imports PTiler, TerminalIO (an IO package for use with ChipNDale and PTiler), and CDOrient (which provides definitions of rotation and mirroring). The outermost block just registers a command with the PTiler package, telling it to call MirrorProc when it needs a module.
MirrorProc keeps three sorts of information: parameters set by the user, state information, and a constant to make up for the fact that CDOrient does not have a mirrorY constant. When it executes it queries the user for parameters and initializes its data structures. prevTile is a pointer to the last cell placed, and prevRow is a pointer to the first tile in the previous row. orient contains the orientation of the cell about to be placed. As Mirror advances it calls CDOrient to flip orient in X and Y.
The calls to AdjacentCell actually place down the tiles. AdjacentCell takes prevTile (or if a new row, prevRow) and places the new tile to the right of it (or if a new row, below it). The tile is placed with the orientation orient. The procedure AdjacentCell places cells by aligning the left, right, top, or bottom marks on those cells. If a more complex placement was desired (using different marks, for instance), the AlignCell routine would be used instead. There is even a way to place cells at absolute coordinates, but I doubt that you will want to do that.
After all the tiles are placed, the result is returned to PTiler which will do some checking (see the Verification section) and place the module into the user's design or write it out to a file.
There are other procedures for stretching tiles, placing down pins & new alignment marks, and other operations -- see the reference manual for details.
Tile Stretching
This section is a proposal, not a description of an implementation.
Sometimes a module generator needs to be able to stretch tiles or particular parts of tiles (such as Vdd or Ground). PTiler provides the ability to stretch tiles in certain ways. The functionality is best described by explaining the construct provided, called stretch-rects.
A stretch-rect is a rectangle on a particular layer -- just like a normal ChipNDale rectangle. However, in addition to its default size it has a maximum size shown as a dotted outline. The stretch-rect also has an arrow with a label attached and this label names a register maintained by the module generator. When a tile is placed, all stretch-rects in it are expanded in the direction of the arrow by the amount specified by their registers. If a stretch-rect needs to be expanded to more than its maximum size the entire cell will be stretched by the surplus amount in order to make room.
Routing
This section isn't even a complete proposal.
Module generators often need some automatic routing in portions of their modules, and a river router would often be sufficient. River routers are simple to write, the main problem being one of finding a convenient input specification. I think that PTiler should have such a router, but there is not one now.
Verification Aids
In addition to a name, alignment marks may have checking information associated with them. A mark called
xyz/pat
is a mark named xyz, and in the finished module it must align with some mark whose name matches pat. The result of a module generator is automatically checked to detect any violation of these constraints. pat is a search pattern in the format accepted by Tioga.
Note that this mechanism places the checking information into the set of tiles. This means that the module generator does not have to know about any particular peculiarities of the set of tiles being used -- the tile designer is the person that decides what alignments need to be verified.
Reference Manual
This section is missing, since the interface is not solid yet. Eventually we will have the ability to stretch cells, and I will figure out what we want to do with pins.