Merge branch 'master' into magic-8.2

This commit is contained in:
Tim Edwards 2020-03-06 03:00:08 -05:00
commit 6c698b040c
9 changed files with 104 additions and 27 deletions

View File

@ -1 +1 @@
8.2.190 8.2.192

View File

@ -1434,7 +1434,7 @@ CmdCif(w, cmd)
if (!ToolGetBox(&rootDef, &box)) if (!ToolGetBox(&rootDef, &box))
{ {
TxError("Use the box to select the area in"); TxError("Use the box to select the area in");
TxError(" which you want to see CIF.\n"); TxError(" which you want to paint CIF.\n");
return; return;
} }
if (argc == 5) if (argc == 5)

View File

@ -361,7 +361,8 @@ drcWhyCreate(whystring)
int i; int i;
char **newList; char **newList;
newList = (char **)mallocMagic((DRCCurStyle->DRCWhySize + 51) * sizeof(char *)); newList = (char **)mallocMagic((DRCCurStyle->DRCWhySize + 51) * sizeof(char *));
for (i = 0; i < DRCCurStyle->DRCWhySize; i++) newList[0] = (char *)NULL;
for (i = 1; i <= DRCCurStyle->DRCWhySize; i++)
newList[i] = DRCCurStyle->DRCWhyList[i]; newList[i] = DRCCurStyle->DRCWhyList[i];
if (DRCCurStyle->DRCWhySize > 0) if (DRCCurStyle->DRCWhySize > 0)
freeMagic((char *)DRCCurStyle->DRCWhyList); freeMagic((char *)DRCCurStyle->DRCWhyList);

View File

@ -2873,7 +2873,14 @@ int spcnAP(node, resClass, scale, asterm, psterm, m, outf, w)
if (!esDistrJunct || w == -1) goto oldFmt; if (!esDistrJunct || w == -1) goto oldFmt;
dsc = w / ((nodeClient*)node->efnode_client)->m_w.widths[resClass]; if (((nodeClient*)node->efnode_client)->m_w.widths != NULL)
dsc = w / ((nodeClient*)node->efnode_client)->m_w.widths[resClass];
else
{
TxError("Device missing records for source/drain area/perim.\n");
dsc = w;
}
if (esScale < 0) if (esScale < 0)
{ {
if (asterm) if (asterm)

View File

@ -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

View File

@ -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:
@ -1287,6 +1305,35 @@ DefReadVias(f, sname, oscale, total)
blayer = LefReadLayer(f, FALSE); blayer = LefReadLayer(f, FALSE);
clayer = LefReadLayer(f, FALSE); clayer = LefReadLayer(f, FALSE);
tlayer = LefReadLayer(f, FALSE); tlayer = LefReadLayer(f, FALSE);
/* Provisional behavior: A known tool generating */
/* DEF uses the order (bottom, top, cut). This may */
/* be a bug in the tool and an issue is being */
/* raised. However, there is no harm in detecting */
/* which layer is the cut and swapping as needed. */
if (!DBIsContact(clayer))
{
TileType swaplayer;
LefError(DEF_WARNING, "Improper layer order for"
" VIARULE.\n");
if (DBIsContact(tlayer))
{
swaplayer = clayer;
clayer = tlayer;
tlayer = swaplayer;
}
else if (DBIsContact(blayer))
{
swaplayer = clayer;
clayer = blayer;
blayer = swaplayer;
}
else
LefError(DEF_ERROR, "No cut layer specified in"
" VIARULE.\n");
}
generated = TRUE; generated = TRUE;
break; break;
case DEF_VIAS_PROP_CUTSPACING: case DEF_VIAS_PROP_CUTSPACING:
@ -1619,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;
@ -1796,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]);

View File

@ -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
defLabelNets = TRUE;
}
}
} }
else
goto wrongNumArgs;
} }
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)
@ -190,13 +206,15 @@ CmdLef(w, cmd)
lefTopCell = FALSE; lefTopCell = FALSE;
else if (!strncmp(cmd->tx_argv[i], "-tech", 5)) else if (!strncmp(cmd->tx_argv[i], "-tech", 5))
lefTech = TRUE; lefTech = TRUE;
else if (!strncmp(cmd->tx_argv[i], "-hide", 5))
lefHide = TRUE;
else if (!strncmp(cmd->tx_argv[i], "-all", 4)) else if (!strncmp(cmd->tx_argv[i], "-all", 4))
recurse = TRUE; recurse = TRUE;
else goto wrongNumArgs; else goto wrongNumArgs;
} }
else goto wrongNumArgs; else goto wrongNumArgs;
} }
LefWriteAll(selectedUse, lefTopCell, lefTech, recurse); LefWriteAll(selectedUse, lefTopCell, lefTech, lefHide, recurse);
} }
break; break;
case LEF_WRITE: case LEF_WRITE:

View File

@ -1133,10 +1133,11 @@ lefWriteMacro(def, f, scale, hide)
*/ */
void void
LefWriteAll(rootUse, writeTopCell, lefTech, recurse) LefWriteAll(rootUse, writeTopCell, lefTech, lefHide, recurse)
CellUse *rootUse; CellUse *rootUse;
bool writeTopCell; bool writeTopCell;
bool lefTech; bool lefTech;
bool lefHide;
bool recurse; bool recurse;
{ {
CellDef *def, *rootdef; CellDef *def, *rootdef;
@ -1190,7 +1191,7 @@ LefWriteAll(rootUse, writeTopCell, lefTech, recurse)
{ {
def->cd_client = (ClientData) 0; def->cd_client = (ClientData) 0;
if (!SigInterruptPending) if (!SigInterruptPending)
lefWriteMacro(def, f, scale); lefWriteMacro(def, f, scale, lefHide);
} }
/* End the LEF file */ /* End the LEF file */

View File

@ -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