Implemented the "def read ... -labels" option, which labels each net
with the name given to the net in the DEF file. Especially useful for LVS.
This commit is contained in:
parent
7413d89da1
commit
a37fc1e242
|
|
@ -23,6 +23,6 @@ lefRead.o: lefRead.c ../tcltk/tclmagic.h ../utils/magic.h \
|
||||||
../lef/lefInt.h
|
../lef/lefInt.h
|
||||||
defRead.o: defRead.c ../tcltk/tclmagic.h ../utils/magic.h \
|
defRead.o: defRead.c ../tcltk/tclmagic.h ../utils/magic.h \
|
||||||
../utils/geometry.h ../tiles/tile.h ../utils/hash.h ../utils/undo.h \
|
../utils/geometry.h ../tiles/tile.h ../utils/hash.h ../utils/undo.h \
|
||||||
../database/database.h ../windows/windows.h ../dbwind/dbwind.h \
|
../utils/utils.h ../database/database.h ../windows/windows.h \
|
||||||
../utils/malloc.h ../graphics/graphics.h ../utils/main.h ../cif/cif.h \
|
../dbwind/dbwind.h ../utils/malloc.h ../graphics/graphics.h \
|
||||||
../lef/lefInt.h
|
../utils/main.h ../cif/cif.h ../lef/lefInt.h
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||||
#include "tiles/tile.h"
|
#include "tiles/tile.h"
|
||||||
#include "utils/hash.h"
|
#include "utils/hash.h"
|
||||||
#include "utils/undo.h"
|
#include "utils/undo.h"
|
||||||
|
#include "utils/utils.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "windows/windows.h"
|
#include "windows/windows.h"
|
||||||
#include "dbwind/dbwind.h"
|
#include "dbwind/dbwind.h"
|
||||||
|
|
@ -73,11 +74,12 @@ enum def_netspecial_shape_keys {
|
||||||
DEF_SPECNET_SHAPE_DRCFILL};
|
DEF_SPECNET_SHAPE_DRCFILL};
|
||||||
|
|
||||||
char *
|
char *
|
||||||
DefAddRoutes(rootDef, f, oscale, special, defLayerMap)
|
DefAddRoutes(rootDef, f, oscale, special, netname, defLayerMap)
|
||||||
CellDef *rootDef; /* Cell to paint */
|
CellDef *rootDef; /* Cell to paint */
|
||||||
FILE *f; /* Input file */
|
FILE *f; /* Input file */
|
||||||
float oscale; /* Scale factor between LEF and magic units */
|
float oscale; /* Scale factor between LEF and magic units */
|
||||||
bool special; /* True if this section is SPECIALNETS */
|
bool special; /* True if this section is SPECIALNETS */
|
||||||
|
char *netname; /* Name of the net, if net is to be labeled */
|
||||||
LefMapping *defLayerMap; /* magic-to-lef layer mapping array */
|
LefMapping *defLayerMap; /* magic-to-lef layer mapping array */
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
|
@ -85,6 +87,7 @@ DefAddRoutes(rootDef, f, oscale, special, defLayerMap)
|
||||||
Point refp; /* reference point */
|
Point refp; /* reference point */
|
||||||
bool valid = FALSE; /* is there a valid reference point? */
|
bool valid = FALSE; /* is there a valid reference point? */
|
||||||
bool initial = TRUE;
|
bool initial = TRUE;
|
||||||
|
bool labeled = TRUE;
|
||||||
Rect locarea;
|
Rect locarea;
|
||||||
int extend, lextend, hextend;
|
int extend, lextend, hextend;
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
|
|
@ -124,6 +127,8 @@ DefAddRoutes(rootDef, f, oscale, special, defLayerMap)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (netname != NULL) labeled = FALSE;
|
||||||
|
|
||||||
while (initial || (token = LefNextToken(f, TRUE)) != NULL)
|
while (initial || (token = LefNextToken(f, TRUE)) != NULL)
|
||||||
{
|
{
|
||||||
/* Get next point, token "NEW", or via name */
|
/* Get next point, token "NEW", or via name */
|
||||||
|
|
@ -605,6 +610,16 @@ endCoord:
|
||||||
/* paint */
|
/* paint */
|
||||||
DBPaint(rootDef, &routeTop->r_r, routeTop->r_type);
|
DBPaint(rootDef, &routeTop->r_r, routeTop->r_type);
|
||||||
|
|
||||||
|
/* label */
|
||||||
|
if (labeled == FALSE)
|
||||||
|
{
|
||||||
|
Rect r;
|
||||||
|
r.r_xbot = r.r_xtop = (routeTop->r_r.r_xbot + routeTop->r_r.r_xtop) / 2;
|
||||||
|
r.r_ybot = r.r_ytop = (routeTop->r_r.r_ybot + routeTop->r_r.r_ytop) / 2;
|
||||||
|
DBPutLabel(rootDef, &r, GEO_CENTER, netname, routeTop->r_type, 0);
|
||||||
|
labeled = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* advance to next point and free record (1-delayed) */
|
/* advance to next point and free record (1-delayed) */
|
||||||
freeMagic((char *)routeTop);
|
freeMagic((char *)routeTop);
|
||||||
routeTop = routeTop->r_next;
|
routeTop = routeTop->r_next;
|
||||||
|
|
@ -636,15 +651,17 @@ enum def_netprop_keys {
|
||||||
DEF_NETPROP_PROPERTY};
|
DEF_NETPROP_PROPERTY};
|
||||||
|
|
||||||
void
|
void
|
||||||
DefReadNets(f, rootDef, sname, oscale, special, total)
|
DefReadNets(f, rootDef, sname, oscale, special, dolabels, total)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
CellDef *rootDef;
|
CellDef *rootDef;
|
||||||
char *sname;
|
char *sname;
|
||||||
float oscale;
|
float oscale;
|
||||||
bool special; /* True if this section is SPECIALNETS */
|
bool special; /* True if this section is SPECIALNETS */
|
||||||
|
bool dolabels; /* If true, create a label for each net */
|
||||||
int total;
|
int total;
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
char *netname = NULL;
|
||||||
int keyword, subkey;
|
int keyword, subkey;
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
LefMapping *defLayerMap;
|
LefMapping *defLayerMap;
|
||||||
|
|
@ -684,8 +701,8 @@ DefReadNets(f, rootDef, sname, oscale, special, total)
|
||||||
case DEF_NET_START:
|
case DEF_NET_START:
|
||||||
|
|
||||||
/* Get net name */
|
/* Get net name */
|
||||||
/* Presently, we ignore net names completely. */
|
|
||||||
token = LefNextToken(f, TRUE);
|
token = LefNextToken(f, TRUE);
|
||||||
|
if (dolabels) netname = StrDup((char **)NULL, token);
|
||||||
|
|
||||||
/* Update the record of the number of nets processed */
|
/* Update the record of the number of nets processed */
|
||||||
/* and spit out a message for every 5% finished. */
|
/* and spit out a message for every 5% finished. */
|
||||||
|
|
@ -725,10 +742,11 @@ DefReadNets(f, rootDef, sname, oscale, special, total)
|
||||||
case DEF_NETPROP_FIXED:
|
case DEF_NETPROP_FIXED:
|
||||||
case DEF_NETPROP_COVER:
|
case DEF_NETPROP_COVER:
|
||||||
token = DefAddRoutes(rootDef, f, oscale, special,
|
token = DefAddRoutes(rootDef, f, oscale, special,
|
||||||
defLayerMap);
|
netname, defLayerMap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (dolabels) freeMagic(netname);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEF_NET_END:
|
case DEF_NET_END:
|
||||||
|
|
@ -1648,8 +1666,9 @@ enum def_sections {DEF_VERSION = 0, DEF_NAMESCASESENSITIVE,
|
||||||
DEF_END};
|
DEF_END};
|
||||||
|
|
||||||
void
|
void
|
||||||
DefRead(inName)
|
DefRead(inName, dolabels)
|
||||||
char *inName;
|
char *inName;
|
||||||
|
bool dolabels;
|
||||||
{
|
{
|
||||||
CellDef *rootDef;
|
CellDef *rootDef;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
@ -1825,13 +1844,15 @@ DefRead(inName)
|
||||||
token = LefNextToken(f, TRUE);
|
token = LefNextToken(f, TRUE);
|
||||||
if (sscanf(token, "%d", &total) != 1) total = 0;
|
if (sscanf(token, "%d", &total) != 1) total = 0;
|
||||||
LefEndStatement(f);
|
LefEndStatement(f);
|
||||||
DefReadNets(f, rootDef, sections[DEF_SPECIALNETS], oscale, TRUE, total);
|
DefReadNets(f, rootDef, sections[DEF_SPECIALNETS], oscale, TRUE,
|
||||||
|
dolabels, total);
|
||||||
break;
|
break;
|
||||||
case DEF_NETS:
|
case DEF_NETS:
|
||||||
token = LefNextToken(f, TRUE);
|
token = LefNextToken(f, TRUE);
|
||||||
if (sscanf(token, "%d", &total) != 1) total = 0;
|
if (sscanf(token, "%d", &total) != 1) total = 0;
|
||||||
LefEndStatement(f);
|
LefEndStatement(f);
|
||||||
DefReadNets(f, rootDef, sections[DEF_NETS], oscale, FALSE, total);
|
DefReadNets(f, rootDef, sections[DEF_NETS], oscale, FALSE,
|
||||||
|
dolabels, total);
|
||||||
break;
|
break;
|
||||||
case DEF_IOTIMINGS:
|
case DEF_IOTIMINGS:
|
||||||
LefSkipSection(f, sections[DEF_IOTIMINGS]);
|
LefSkipSection(f, sections[DEF_IOTIMINGS]);
|
||||||
|
|
|
||||||
34
lef/lefCmd.c
34
lef/lefCmd.c
|
|
@ -92,6 +92,10 @@ CmdLef(w, cmd)
|
||||||
* only the immediate children of the
|
* only the immediate children of the
|
||||||
* top level cell are output.
|
* top level cell are output.
|
||||||
*/
|
*/
|
||||||
|
bool defLabelNets = FALSE; /* If TRUE, attach a label to the
|
||||||
|
* center of the first rectangle
|
||||||
|
* found on that net.
|
||||||
|
*/
|
||||||
|
|
||||||
static char *cmdLefOption[] =
|
static char *cmdLefOption[] =
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +105,8 @@ CmdLef(w, cmd)
|
||||||
" write [filename] -hide hide all details other than ports",
|
" write [filename] -hide hide all details other than ports",
|
||||||
"writeall write all cells including the top-level cell\n"
|
"writeall write all cells including the top-level cell\n"
|
||||||
" writeall -notop write all children of the top-level cell\n"
|
" writeall -notop write all children of the top-level cell\n"
|
||||||
" writeall -all recurse on all subcells of the top-level cell",
|
" writeall -all recurse on all subcells of the top-level cell\n",
|
||||||
|
" writeall -hide hide all details other than ports",
|
||||||
"help print this help information",
|
"help print this help information",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
@ -109,7 +114,8 @@ CmdLef(w, cmd)
|
||||||
static char *cmdDefOption[] =
|
static char *cmdDefOption[] =
|
||||||
{
|
{
|
||||||
"read [filename] read a DEF file filename[.def]",
|
"read [filename] read a DEF file filename[.def]",
|
||||||
"write [cell] [-allspecial] write DEF for current or indicated cell",
|
"write [cell] [-allspecial] write DEF for current or indicated cell\n",
|
||||||
|
"write -labels label every net in NETS with the net name",
|
||||||
"writeall (use \"flatten -nosubckt\" + \"def"
|
"writeall (use \"flatten -nosubckt\" + \"def"
|
||||||
" write\" instead)",
|
" write\" instead)",
|
||||||
"help print this help information",
|
"help print this help information",
|
||||||
|
|
@ -157,22 +163,32 @@ CmdLef(w, cmd)
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case LEF_READ:
|
case LEF_READ:
|
||||||
if (cmd->tx_argc != 3)
|
if (cmd->tx_argc > 3)
|
||||||
{
|
{
|
||||||
if (cmd->tx_argc == 4)
|
for (i = 3; i < cmd->tx_argc; i++)
|
||||||
{
|
{
|
||||||
if (*(cmd->tx_argv[3]) == '-')
|
if (*(cmd->tx_argv[i]) == '-')
|
||||||
if (!strncmp(cmd->tx_argv[3], "-import", 7))
|
{
|
||||||
|
if (!strncmp(cmd->tx_argv[i], "-import", 7))
|
||||||
lefImport = TRUE;
|
lefImport = TRUE;
|
||||||
}
|
else if (!strncmp(cmd->tx_argv[i], "-label", 6))
|
||||||
|
{
|
||||||
|
if (is_lef)
|
||||||
|
TxPrintf("The \"-labels\" option is only for def read\n");
|
||||||
else
|
else
|
||||||
goto wrongNumArgs;
|
defLabelNets = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cmd->tx_argc < 3)
|
||||||
|
goto wrongNumArgs;
|
||||||
|
|
||||||
namep = cmd->tx_argv[2];
|
namep = cmd->tx_argv[2];
|
||||||
if (is_lef)
|
if (is_lef)
|
||||||
LefRead(namep, lefImport);
|
LefRead(namep, lefImport);
|
||||||
else
|
else
|
||||||
DefRead(namep);
|
DefRead(namep, defLabelNets);
|
||||||
break;
|
break;
|
||||||
case LEF_WRITEALL:
|
case LEF_WRITEALL:
|
||||||
if (!is_lef)
|
if (!is_lef)
|
||||||
|
|
|
||||||
|
|
@ -1156,7 +1156,7 @@ mainInitFinal()
|
||||||
LefRead(temporary->fn, FALSE);
|
LefRead(temporary->fn, FALSE);
|
||||||
break;
|
break;
|
||||||
case FN_DEF_FILE:
|
case FN_DEF_FILE:
|
||||||
DefRead(temporary->fn);
|
DefRead(temporary->fn, FALSE);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue