Changed a recent commit which removed brackets from instance names

while reading DEF.  To preserve names as much as possible, such
names are now kept.  To avoid problems, EFbuild.c and ext2hier
behavior has been changed to only parse entries in a .ext file as
instance arrays if the array notation follows the specific syntax
of [ax:bx:cx][ay:by:cy], letting all other uses of brackets pass
through unaffected.
This commit is contained in:
Tim Edwards 2019-07-25 10:20:24 -04:00
parent 93d25e7cf7
commit 982bb8aa63
3 changed files with 74 additions and 29 deletions

View File

@ -1572,14 +1572,29 @@ esMakePorts(hc, cdata)
while (tptr != NULL)
{
int idum[6];
bool is_array;
/* Ignore array information for the purpose of tracing */
/* the cell definition hierarchy. */
/* the cell definition hierarchy. Complementary to the */
/* method used in EFbuild.c, only consider uses of */
/* brackets that conform to the [ax:bx:cx][ay:by:cy] */
/* notation. */
aptr = strchr(portname, '[');
if ((aptr == NULL) || (aptr > tptr))
*tptr = '\0';
else
if (aptr && (aptr < tptr) &&
(sscanf(aptr, "[%d:%d:%d][%d:%d:%d]",
&idum[0], &idum[1], &idum[2],
&idum[3], &idum[4], &idum[5]) == 6))
{
is_array = TRUE;
*aptr = '\0';
}
else
{
is_array = FALSE;
*tptr = '\0';
}
// Find the cell for the instance
portdef = NULL;
@ -1589,10 +1604,10 @@ esMakePorts(hc, cdata)
use = (Use *)HashGetValue(he);
portdef = use->use_def;
}
if ((aptr == NULL) || (aptr > tptr))
*tptr = '/';
else
if (is_array)
*aptr = '[';
else
*tptr = '/';
portname = tptr + 1;
// Find the net of portname in the subcell and
@ -1651,14 +1666,26 @@ esMakePorts(hc, cdata)
while (tptr != NULL)
{
int idum[6];
bool is_array;
/* Ignore array information for the purpose of tracing */
/* the cell definition hierarchy. */
aptr = strchr(portname, '[');
if ((aptr == NULL) || (aptr > tptr))
*tptr = '\0';
else
if (aptr && (aptr < tptr) &&
(sscanf(aptr, "[%d:%d:%d][%d:%d:%d]",
&idum[0], &idum[1], &idum[2],
&idum[3], &idum[4], &idum[5]) == 6))
{
*aptr = '\0';
is_array = TRUE;
}
else
{
*tptr = '\0';
is_array = FALSE;
}
// Find the cell for the instance
portdef = NULL;
@ -1668,10 +1695,10 @@ esMakePorts(hc, cdata)
use = (Use *)HashGetValue(he);
portdef = use->use_def;
}
if ((aptr == NULL) || (aptr > tptr))
*tptr = '/';
else
if (is_array)
*aptr = '[';
else
*tptr = '/';
portname = tptr + 1;
// Find the net of portname in the subcell and

View File

@ -1123,12 +1123,26 @@ efBuildUse(def, subDefName, subUseId, ta, tb, tc, td, te, tf)
}
else
{
*cp = '\0';
newuse->use_id = StrDup((char **) NULL, subUseId);
*cp = '[';
(void) sscanf(cp, "[%d:%d:%d][%d:%d:%d]",
/* Note: Preserve any use of brackets as-is other than the */
/* standard magic array notation below. This allows, for */
/* example, verilog instance arrays read from DEF files to */
/* be passed through correctly. */
if ((sscanf(cp, "[%d:%d:%d][%d:%d:%d]",
&newuse->use_xlo, &newuse->use_xhi, &newuse->use_xsep,
&newuse->use_ylo, &newuse->use_yhi, &newuse->use_ysep);
&newuse->use_ylo, &newuse->use_yhi, &newuse->use_ysep)) == 6)
{
*cp = '\0';
newuse->use_id = StrDup((char **) NULL, subUseId);
*cp = '[';
}
else
{
newuse->use_id = StrDup((char **) NULL, subUseId);
newuse->use_xlo = newuse->use_xhi = 0;
newuse->use_ylo = newuse->use_yhi = 0;
newuse->use_xsep = newuse->use_ysep = 0;
}
}
he = HashFind(&def->def_uses, newuse->use_id);

View File

@ -1450,18 +1450,22 @@ DefReadComponents(f, rootDef, sname, oscale, total)
/* Does use name contain brackets? If so, this can */
/* interfere with magic's use of arrays. */
/* NOTE: This has been commented out. I think */
/* the only confusion is in ext2spice and can be */
/* avoided by allowing any bracket notation in an */
/* instance name other than that used by the .ext */
/* file for dealing with arrays, which uses the */
/* specific syntax [xlo:xsep:xhi][ylo:ysep:yhi] and */
/* is easy enough to distinguish. */
/* NOTE: It is not clear that this needs to be */
/* done during DEF read. The only confusion comes */
/* from the arrays being parsed by ExtFlat when */
/* doing ext2spice. */
dptr = strchr(usename, '[');
if (dptr != NULL) {
*dptr = '_';
dptr = strchr(dptr + 1, ']');
if (dptr != NULL) *dptr = '_';
}
/*
dptr = strchr(usename, '[');
if (dptr != NULL) {
*dptr = '_';
dptr = strchr(dptr + 1, ']');
if (dptr != NULL) *dptr = '_';
}
*/
token = LefNextToken(f, TRUE);