2017-04-25 14:41:48 +02:00
|
|
|
/*
|
|
|
|
|
* lefInt.h --
|
|
|
|
|
*
|
|
|
|
|
* This file defines things that are used by internal LEF routines in
|
|
|
|
|
* various files.
|
|
|
|
|
*
|
|
|
|
|
* rcsid $Header: /usr/cvsroot/magic-8.0/lef/lefInt.h,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _LEFINT_H
|
|
|
|
|
#define _LEFINT_H
|
|
|
|
|
|
|
|
|
|
#include "utils/magic.h"
|
|
|
|
|
|
|
|
|
|
/* Some constants for LEF and DEF files */
|
|
|
|
|
|
|
|
|
|
#define LEF_LINE_MAX 2048 /* Maximum length fixed by LEF/DEF specifications */
|
|
|
|
|
#define LEF_MAX_ERRORS 100 /* Max # errors to report; limits output if */
|
|
|
|
|
/* something is really wrong about the file */
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_WIDTH 3 /* Default metal width for routes if undefined */
|
|
|
|
|
#define DEFAULT_SPACING 4 /* Default spacing between metal if undefined */
|
|
|
|
|
|
|
|
|
|
/* Various modes for writing nets. */
|
|
|
|
|
#define DO_REGULAR 0
|
|
|
|
|
#define DO_SPECIAL 1
|
|
|
|
|
#define ALL_SPECIAL 2 /* treat all nets as SPECIALNETS */
|
|
|
|
|
|
2020-12-04 03:37:32 +01:00
|
|
|
/* Used with defMakeInverseLayerMap() */
|
|
|
|
|
#define LAYER_MAP_NO_VIAS FALSE
|
|
|
|
|
#define LAYER_MAP_VIAS TRUE
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
/* For a linked list of rectangular areas, use the LinkedRect structure */
|
|
|
|
|
/* defined in utils/geometry.h. */
|
|
|
|
|
|
|
|
|
|
/* Structure used for returning information about polygon geometry */
|
|
|
|
|
|
|
|
|
|
typedef struct _linkedPoint {
|
|
|
|
|
Point pos;
|
|
|
|
|
TileType type;
|
|
|
|
|
struct _linkedPoint *point_next;
|
|
|
|
|
} linkedPoint;
|
|
|
|
|
|
|
|
|
|
/* Structure used to maintain default routing information for each */
|
|
|
|
|
/* routable layer type. */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int width; /* width, in lambda */
|
|
|
|
|
int spacing; /* minimum spacing rule, in lambda */
|
|
|
|
|
int pitch; /* route pitch, in lambda */
|
|
|
|
|
bool hdirection; /* horizontal direction preferred */
|
|
|
|
|
} lefRoute;
|
|
|
|
|
|
|
|
|
|
/* Structure used to maintain default generation information for each */
|
|
|
|
|
/* via or viarule (contact) type. If "cell" is non-NULL, then the via */
|
|
|
|
|
/* is saved in a cell (pointed to by "cell"), and "area" describes the */
|
|
|
|
|
/* bounding box. Otherwise, the via is formed by magic type "type" */
|
|
|
|
|
/* with a minimum area "area" for a single contact. */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
Rect area; /* Area of single contact, or cell bbox */
|
|
|
|
|
/* in units of 1/2 lambda */
|
|
|
|
|
CellDef *cell; /* Cell for fixed via def, or NULL */
|
|
|
|
|
LinkedRect *lr; /* Extra information for vias with */
|
|
|
|
|
/* more complicated geometry. */
|
|
|
|
|
TileType obsType; /* Secondary obstruction type */
|
|
|
|
|
} lefVia;
|
|
|
|
|
|
|
|
|
|
/* Defined types for "lefClass" in the lefLayer structure */
|
|
|
|
|
|
|
|
|
|
#define CLASS_ROUTE 0 /* routing layer */
|
|
|
|
|
#define CLASS_VIA 1 /* via or cut layer */
|
|
|
|
|
#define CLASS_MASTER 2 /* masterslice layer */
|
|
|
|
|
#define CLASS_OVERLAP 3 /* overlap layer */
|
|
|
|
|
#define CLASS_BOUND 4 /* boundary-defining layer */
|
|
|
|
|
#define CLASS_IGNORE 5 /* inactive layer */
|
|
|
|
|
|
|
|
|
|
/* Structure defining a route or via layer and matching it to a magic */
|
|
|
|
|
/* layer type. This structure is saved in the LefInfo hash table. */
|
|
|
|
|
/* To allow multiple names to refer to the same structure, we keep a */
|
|
|
|
|
/* reference count of the number of times a hash table value points to */
|
|
|
|
|
/* this structure. */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
TileType type; /* magic tile type, or -1 for none */
|
|
|
|
|
TileType obsType; /* magic type to use if this is an obstruction */
|
|
|
|
|
short refCnt; /* reference count for memory deallocation */
|
|
|
|
|
char * canonName; /* name to use when writing LEF output */
|
|
|
|
|
unsigned char lefClass; /* is this a via, route, or masterslice layer */
|
|
|
|
|
union {
|
|
|
|
|
lefRoute route; /* for route layers */
|
|
|
|
|
lefVia via; /* for contacts */
|
|
|
|
|
} info;
|
|
|
|
|
} lefLayer;
|
|
|
|
|
|
|
|
|
|
/* Inverse mapping structure for returning the primary LEF */
|
|
|
|
|
/* layer corresponding to a magic tile type. */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char *lefName; /* Primary name of LEF layer */
|
|
|
|
|
lefLayer *lefInfo; /* Pointer to information about the layer */
|
|
|
|
|
} LefMapping;
|
|
|
|
|
|
2022-03-23 15:49:02 +01:00
|
|
|
/* Structure used for non-default rules. */
|
|
|
|
|
|
2022-03-23 22:08:39 +01:00
|
|
|
typedef struct _lefRule {
|
2022-03-23 15:49:02 +01:00
|
|
|
lefLayer *lefInfo; /* Layer or via referenced by the rule */
|
|
|
|
|
int width; /* Non-default width value for layer */
|
|
|
|
|
int spacing; /* Non-default spacing value for layer */
|
2022-03-23 22:08:39 +01:00
|
|
|
struct _lefRule *next;
|
2022-03-23 15:49:02 +01:00
|
|
|
} lefRule;
|
|
|
|
|
|
|
|
|
|
/* Structure to hold nondefault rules required by nets */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char *name;
|
|
|
|
|
lefRule *rule;
|
|
|
|
|
} LefRules;
|
|
|
|
|
|
|
|
|
|
/* Structure holding the counts of regular and special nets */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int regular;
|
|
|
|
|
int special;
|
2022-03-24 22:58:05 +01:00
|
|
|
int blockages;
|
2022-03-23 15:49:02 +01:00
|
|
|
bool has_nets;
|
|
|
|
|
} NetCount;
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
/* External declaration of global variables */
|
|
|
|
|
extern int lefCurrentLine;
|
|
|
|
|
extern HashTable LefInfo;
|
2022-03-23 15:49:02 +01:00
|
|
|
extern HashTable LefNonDefaultRules;
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
|
|
|
|
|
|
int lefDefInitFunc(), lefDefPushFunc();
|
|
|
|
|
FILE *lefFileOpen();
|
|
|
|
|
|
|
|
|
|
char *LefGetInput();
|
|
|
|
|
int LefParseEndStatement();
|
|
|
|
|
void LefSkipSection();
|
|
|
|
|
void LefEndStatement();
|
|
|
|
|
CellDef *lefFindCell();
|
|
|
|
|
char *LefNextToken();
|
|
|
|
|
char *LefLower();
|
|
|
|
|
LinkedRect *LefReadGeometry();
|
|
|
|
|
void LefEstimate();
|
|
|
|
|
lefLayer *LefRedefined();
|
|
|
|
|
void LefAddViaGeometry();
|
2019-07-03 19:58:13 +02:00
|
|
|
void LefGenViaGeometry();
|
2017-04-25 14:41:48 +02:00
|
|
|
Rect *LefReadRect();
|
|
|
|
|
TileType LefReadLayer();
|
2022-04-05 15:50:36 +02:00
|
|
|
void LefReadLayerSection();
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
LefMapping *defMakeInverseLayerMap();
|
|
|
|
|
|
2019-06-06 15:59:56 +02:00
|
|
|
void LefError(int, char *, ...); /* Variable argument procedure requires */
|
|
|
|
|
/* parameter list. */
|
|
|
|
|
|
2022-10-10 11:50:15 +02:00
|
|
|
/* C99 compat */
|
|
|
|
|
extern void LefRead();
|
|
|
|
|
extern void DefRead();
|
|
|
|
|
|
|
|
|
|
void LefWriteAll();
|
|
|
|
|
void DefWriteCell();
|
|
|
|
|
void LefWriteCell();
|
|
|
|
|
int DRCGetDefaultLayerWidth();
|
|
|
|
|
void LefTechInit();
|
|
|
|
|
void lefRemoveGeneratedVias();
|
|
|
|
|
|
2019-06-06 15:59:56 +02:00
|
|
|
/* Definitions for type passed to LefError() */
|
|
|
|
|
|
|
|
|
|
#define LEF_ERROR 0
|
|
|
|
|
#define LEF_WARNING 1
|
|
|
|
|
#define LEF_INFO 2
|
|
|
|
|
#define LEF_SUMMARY 3
|
|
|
|
|
#define DEF_ERROR 4
|
|
|
|
|
#define DEF_WARNING 5
|
|
|
|
|
#define DEF_INFO 6
|
|
|
|
|
#define DEF_SUMMARY 7
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
#endif /* _LEFINT_H */
|