Added a way to subvert the adding of a prefix to subcells of a dumped

GDS library from an abstract view, by defining the property LEFview
in the cell as "no_prefix" instead of "TRUE".
This commit is contained in:
Tim Edwards 2020-04-23 16:03:29 -04:00
parent 0f16b7da6c
commit 669ae1dfcc
1 changed files with 47 additions and 30 deletions

View File

@ -470,8 +470,8 @@ calmaDumpStructure(def, outf, calmaDefHash, filename)
newnameptr = strname; /* Should never happen */ newnameptr = strname; /* Should never happen */
else else
{ {
newnameptr = mallocMagic(strlen(strname) + strlen(prefix) + 9); newnameptr = mallocMagic(strlen(strname) + strlen(prefix) + 8);
sprintf(newnameptr, "1%s_%s", prefix, strname); sprintf(newnameptr, "1%s%s", prefix, strname);
HashSetValue(he, (char *)newnameptr); HashSetValue(he, (char *)newnameptr);
} }
} }
@ -485,8 +485,8 @@ calmaDumpStructure(def, outf, calmaDefHash, filename)
newnameptr = strname; /* Should never happen */ newnameptr = strname; /* Should never happen */
else else
{ {
newnameptr = mallocMagic(strlen(strname) + strlen(prefix) + 9); newnameptr = mallocMagic(strlen(strname) + strlen(prefix) + 8);
sprintf(newnameptr, "1%s_%s", prefix, strname); sprintf(newnameptr, "1%s%s", prefix, strname);
HashSetValue(he, (char *)newnameptr); HashSetValue(he, (char *)newnameptr);
} }
} }
@ -538,12 +538,12 @@ calmaDumpStructure(def, outf, calmaDefHash, filename)
/* the same way used for structure definitions. */ /* the same way used for structure definitions. */
newnameptr = (char *)mallocMagic(strlen(strname) + newnameptr = (char *)mallocMagic(strlen(strname) +
strlen(prefix) + 9); strlen(prefix) + 8);
sprintf(newnameptr, "0%s_%s", prefix, strname); sprintf(newnameptr, "0%s%s", prefix, strname);
edef = DBCellLookDef(newnameptr + 1); edef = DBCellLookDef(newnameptr + 1);
if (edef != NULL) if (edef != NULL)
sprintf(newnameptr, "0%s_%s[[0]]", prefix, strname); sprintf(newnameptr, "0%s%s[[0]]", prefix, strname);
HashSetValue(he, (char *)newnameptr); HashSetValue(he, (char *)newnameptr);
calmaOutStringRecord(CALMA_SNAME, newnameptr + 1, outf); calmaOutStringRecord(CALMA_SNAME, newnameptr + 1, outf);
} }
@ -602,8 +602,9 @@ calmaFullDump(def, fi, outf, filename)
char *filename; char *filename;
{ {
int version, rval, i; int version, rval, i;
char *libname = NULL, uniqlibname[3]; char *libname = NULL, uniqlibname[4];
char *sptr; char *sptr, *viewopts;
bool isAbstract;
HashTable calmaDefHash; HashTable calmaDefHash;
HashEntry *he; HashEntry *he;
@ -633,32 +634,48 @@ calmaFullDump(def, fi, outf, filename)
// Record the GDS library so it will not be processed again. // Record the GDS library so it will not be processed again.
he = HashFind(&calmaLibHash, filename); he = HashFind(&calmaLibHash, filename);
/* Generate a SHORT name for this cell (else it is easy to run into the /* If property LEFview is defined as "no_prefix" instead of "TRUE",
* GDS 32-character cellname limit). Save it in the hash record. The * then do not create a unique prefix for subcells. This is generally
* chance of generating the same prefix for a library that has items * ill-advised, but can be needed if a foundry runs specific DRC checks
* with conflicting names is vanishingly small, but to be pedantic, store * on specific cell names, in which case adding a prefix can cause DRC
* the prefix in a hash table and check to make sure that uniqueness is * errors to appear. It is then incumbent on the user to ensure that
* ensured. * names in the GDS file do not shadow any names in the database.
*/ */
while (TRUE)
{
HashEntry *he2;
for (i = 0; i < 2; i++) { viewopts = (char *)DBPropGet(def, "LEFview", &isAbstract);
rval = random() % 62; if ((!isAbstract) || (strcasecmp(viewopts, "no_prefix")))
rval = (rval < 26) ? ('A' + rval) : ((rval < 52) ? ('a' + rval - 26) : {
('0' + rval - 52));
uniqlibname[i] = (char)(rval & 127); /* Generate a SHORT name for this cell (else it is easy to run into the
} * GDS 32-character cellname limit). Save it in the hash record. The
uniqlibname[2] = '\0'; * chance of generating the same prefix for a library that has items
he2 = HashLookOnly(&calmaPrefixHash, uniqlibname); * with conflicting names is vanishingly small, but to be pedantic, store
if (he2 == NULL) * the prefix in a hash table and check to make sure that uniqueness is
* ensured.
*/
while (TRUE)
{ {
he2 = HashFind(&calmaPrefixHash, uniqlibname); HashEntry *he2;
break;
for (i = 0; i < 2; i++) {
rval = random() % 62;
rval = (rval < 26) ? ('A' + rval) : ((rval < 52) ? ('a' + rval - 26) :
('0' + rval - 52));
uniqlibname[i] = (char)(rval & 127);
}
uniqlibname[2] = '_';
uniqlibname[3] = '\0';
he2 = HashLookOnly(&calmaPrefixHash, uniqlibname);
if (he2 == NULL)
{
he2 = HashFind(&calmaPrefixHash, uniqlibname);
break;
}
} }
HashSetValue(he, StrDup(NULL, uniqlibname));
} }
HashSetValue(he, StrDup(NULL, uniqlibname)); else
HashSetValue(he, StrDup(NULL, ""));
while (calmaDumpStructure(def, outf, &calmaDefHash, filename)) while (calmaDumpStructure(def, outf, &calmaDefHash, filename))
if (SigInterruptPending) if (SigInterruptPending)