home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gdead.berkeley.edu
/
gdead.berkeley.edu.tar
/
gdead.berkeley.edu
/
pub
/
cad-tools
/
ciftomann.tar
/
Include
/
cd.h
< prev
next >
Wrap
C/C++ Source or Header
|
1988-01-28
|
9KB
|
422 lines
/*
* cd.h
*
* Copyright -C- 1981 Kenneth H. Keller, Giles C. Billingsley
* sccsid "%W% %G%"
*
* CD is a CIF database package that was developed by the integrated
* circuits group of the Electronics Research Laboratory and the
* Department of Electrical Engineering and Computer Sciences at
* the University of California, Berkeley, California. The programs in
* CD are available free of charge to any interested party.
* The sale, resale, or use of these programs for profit without the
* express written consent of the Department of Electrical Engineering
* and Computer Sciences, University of California, Berkeley, California,
* is forbidden.
*/
/*
* CD package data structures.
*
* Giles Billingsley
* Ken Keller
*/
#include <stdio.h>
#include <math.h>
#include "nmalloc.h"
#include "macros.h"
#include "xforms.h"
#ifdef vms
#define void int
#endif
#define CDDelete CDDeleteObjectDesc
#define FILENAMESIZE 16 /* maximum size of a file name */
/*
* Values routines return in StatusInt of CDOpen, CDBeginMakeCall,
* CDTo, CDFrom, or CDParseCIF.
*/
#define CDPARSEFAILED 1 /* (FATAL) parse failed */
#define CDOLDSYMBOL 2 /* symbol already exists in database */
#define CDNEWSYMBOL 3 /* (empty) symbol not in search path */
#define CDSUCCEEDED 4 /* new symbol(s) found in search path */
/*
* Valid arguments to CDError().
*/
#define CDMALLOCFAILED 11 /* (FATAL) out of memory */
#define CDBADBOX 12 /* zero width or length box */
#define CDXFORMSTACKFULL 13 /* transform stack overflow */
#define CDBADPATH 14 /* bad directory name in search path */
/*
* Types of geometries
*/
#define CDSYMBOLCALL 'c'
#define CDPOLYGON 'p'
#define CDROUNDFLASH 'r'
#define CDLABEL 'l'
#define CDWIRE 'w'
#define CDBOX 'b'
/*
* Types of transformations
*/
#define CDMIRRORX 'x' /* mirror in the direction of x */
#define CDMIRRORY 'y' /* mirror in the direction of y */
#define CDROTATE 'r' /* rotate by vector X,Y */
#define CDTRANSLATE 't' /* translate to X,Y */
/*
* CD Control flags; See struct d below.
*/
#define DCONTROLCDOPEN 'o'
#define DCONTROLPCIF 'p'
#define DCONTROLCDTO 't'
#define DCONTROLVANILLA 'v'
/*
* Coordinate system with 1 micron features and 1 cm dice.
* Remember that there are 100 CIF units per micron.
*/
#define INFINITY 100000000
/*
* These are the numbers that CD uses to determine which bin an object
* resides in. They should reflect the average size of a layout being
* edited by KIC. KIC will not fail if the numbers are too small.
* Anything outside of this window is placed in the residual bin.
* If these numbers become too large, CDIntersect() must use floating
* point calculations.
*/
#define CDBINMAXX 500000
#define CDBINMAXY 500000
#define CDBINMINX (-CDBINMAXX)
#define CDBINMINY (-CDBINMAXY)
/*
* PLEASE NOTE
* ^^^^^^^^^^^
* Because a char is used as the layer and info fields, the absolute
* maximum number of layers is 117. The may be increase by recompiling
* kic with the Layer and Info fields typed as ints.
*/
#define CDNUMBINS 10
#define CDNUMLAYERS 35
/*
* Number of symbols stored in the symbol table for any given CIF file.
*/
#define CDNUMREMEMBER 1000
/*
* Storage for diagnostics of CDError().
*/
extern char *CDStatusString;
extern int CDStatusInt;
/*
* Master list desc.
*/
struct m {
int mReferenceCount;
int mLeft,mBottom,mRight,mTop;
char *mName;
struct m *mPred,*mSucc;
};
/*
* Propety List desc.
*/
struct prpty {
int prpty_Value;
char *prpty_String;
struct prpty *prpty_Succ;
};
/*
* Symbol desc.
*/
struct s {
int sLeft,sBottom,sRight,sTop;
int sBBValid;
int sA,sB;
char *sName;
short sInfo;
/*
* One bin foe each layer. Layer 0 is for call descs.
* Each bin points to a double linked list of object descs.
* Bin[.][0][0] are the RESIDUAL bins--Bin[.][0][1] and Bin[.][1][0]
* are unused TUNABLE. NumBins should be as big as it can be.
* For 20 layers and 100 bins per layer,
* the data structure becomes 2000 words.
*/
struct o ***sBin[CDNUMLAYERS+1];
struct m *sMasterList;
struct prpty *sPrptyList;
};
/*
* Object desc.
*/
struct o {
int oLeft,oBottom,oRight,oTop;
char oType;
char oLayer;
short oInfo;
struct o *oRep;
struct o *oPred,*oSucc;
struct prpty *oPrptyList;
};
/*
* Polygon desc.
*/
struct po {
struct p *poPath;
};
/*
* Round flash desc.
*/
struct r {
int rWidth,rX,rY;
};
/*
* Wire desc.
*/
struct w {
int wWidth;
struct p *wPath;
};
/*
* Call desc.
*/
struct c {
int cNum;
/* Pointer to transformation descriptor. */
struct t *cT;
/* Pointer to master list descriptor. */
struct m *cMaster;
/* Array parameters. */
int cNumX,cNumY,cDX,cDY;
};
/*
* Transform desc.
* If MX, tType == CDMIRRORX.
* If MY, tType == CDMIRRORX.
* If R, tType == CDROTATE, tX == XDirection, tY == YDirection.
* If T, tType == CDTRANSLATE, tX == TX, tY = TY;
*/
struct t {
char tType;
int tX,tY;
struct t *tSucc;
};
/*
* Label desc.
*/
struct la {
char *laLabel;
int laX,laY;
};
/*
* Linked path structure
*/
struct p {
int pX,pY;
struct p *pSucc;
};
/*
* Generator desc.
* Search Bin[Layer][0][0] first.
* Then Bin[Layer][BeginX..EndX][BeginY..EndY].
* Bin[Layer][X][Y] is the current bin.
* Pointer points to the current desc in the current bin.
*/
struct g {
int gLeft,gBottom,gRight,gTop;
int gBeginX,gX,gEndX,gBeginY,gY,gEndY;
char gLayer;
struct o *gPointer;
};
/*
* CD's current parameter struct
*/
struct d {
/*
* DCONTROLCDOPEN denotes CD is in CDOpen
* DCONTROLPCIF denotes CD is in CDOpen and parsing CIF rather than kic
* DCONTROLCDTO denotes CD is in CDTo
* DCONTROLVANILLA denotes CD is in none of the above
*/
char dControl;
/* Current parameters for symbol being parsed in CDOpen. */
int dNumX,dDX,dNumY,dDY;
/* Scale factors for CDTo and CDFrom. */
int dA,dB;
/* Symbol scale factors. */
int dDSA,dDSB;
struct o *dPointer;
struct s *dSymbolDesc;
struct s *dRootCellDesc;
/* UNIX file names are limited to 14 characters */
char dSymbolName[FILENAMESIZE];
FILE *dSymbolFileDesc;
/*
* Fields used in CDTo follow.
*/
/* True if parsing root symbol. */
int dRoot;
/* Root's file desc. */
FILE *dRootFileDesc;
/* Current property list for symbol being parsed */
struct prpty *dPrptyList;
/*
* dProgram == 'h' if IGS gened it.
* == 'i' if Icarus gened it.
* == 's' if Sif gened it.
* == 'n' if none of the above.
*/
char dProgram;
/*
* Symbol name table.
* 16 comes from the fact that a UNIX file name is only 14 characters
* long and each symbol name is a UNIX file name. VMS file names are
* smaller.
*/
char dSymTabNames[CDNUMREMEMBER][FILENAMESIZE];
int dSymTabNumbers[CDNUMREMEMBER];
int dNumSymbolTable;
/*
* Because CIF files may have FORWARD references, CDTo must pass
* over the CIF file TWICE.
* On the first pass, it just fills up the symbol name table.
* On the second pass, it does the translation to KIC format.
*/
int dFirstPass;
/*
* True if debugging.
*/
int dDebug;
int dNumSymbolsAllocated;
}
CDDesc;
/*
* CD layer table
*/
struct l
{
char lTechnology;
char lMask[3];
/*True if CDFrom should output layer.*/
char lCDFrom;
}
CDLayer[CDNUMLAYERS+1];
/*
* Hash table of symbol descs keyed on symbol's name.
*/
struct bu
{
struct s *buSymbolDesc;
struct bu *buPred;
struct bu *buSucc;
};
struct bu *CDSymbolTable[CDNUMLAYERS+1];
/*
* Ousterhout's file name package.
*/
FILE *POpen();
char *PGetPath();
/*
* CD routines
*/
extern void CDInit();
extern void CDSetLayer();
extern void CDDebug();
extern void CDSymbol();
extern void CDCheckPath();
extern void CDDeleteObjectDesc();
extern void CDCall();
extern void CDBox();
extern void CDLabel();
extern void CDPolygon();
extern void CDWire();
extern void CDRoundFlash();
extern void CDInfo();
extern void CDSetInfo();
extern void CDProperty();
extern void CDType();
extern void CDIntersect();
extern void CDGen();
extern void CDInitTGen();
extern void CDTGen();
extern int CDBB();
extern int CDOpen();
extern int CDPath();
extern int CDClose();
extern int CDReflect();
extern int CDPatchInstances();
extern int CDAddProperty();
extern int CDRemoveProperty();
extern int CDMakeBox();
extern int CDMakeLabel();
extern int CDMakePolygon();
extern int CDMakeWire();
extern int CDMakeRoundFlash();
extern int CDBeginMakeCall();
extern int CDT();
extern int CDEndMakeCall();
extern int CDInsertObjectDesc();
extern int CDInitGen();
extern int CDUpdate();
extern int CDGenCIF();
extern int CDTo();
extern int CDFrom();
extern int CDParseCIF();
extern int CDUnmark();
extern int CDError();