From 798e87deaff43411414af4138b376b5aff02158f Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 1 Oct 2019 19:32:52 -0400 Subject: [PATCH] Corrected method relating to use of array notation in the base use name (not part of an array in magic). This was failing in ext2spice due to code in extflat dealing incorrectly with the array delimiters. The correction fixes the problem but leaves the possibility that there could be a conflict between a use name that is an array and a use name that has the array index as part of the name. --- ext2spice/ext2hier.c | 33 +++++++++++++++------------------ extflat/EFbuild.c | 4 ++-- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ext2spice/ext2hier.c b/ext2spice/ext2hier.c index 93236df8..62dbc13b 100644 --- a/ext2spice/ext2hier.c +++ b/ext2spice/ext2hier.c @@ -1576,24 +1576,22 @@ esMakePorts(hc, cdata) bool is_array; /* Ignore array information for the purpose of tracing */ - /* 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. */ + /* the cell definition hierarchy. If a cell use name */ + /* contains a bracket, check first if the complete name */ + /* matches a use. If not, then check if the part */ + /* the last opening bracket matches a known use. */ - aptr = strchr(portname, '['); - 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 = strrchr(portname, '['); + *tptr = '\0'; + is_array = FALSE; + if (aptr != NULL) { - is_array = TRUE; - *aptr = '\0'; - } - else - { - is_array = FALSE; - *tptr = '\0'; + he = HashFind(&updef->def_uses, portname); + if (he == NULL) + { + *aptr = '\0'; + is_array = TRUE; + } } // Find the cell for the instance @@ -1606,8 +1604,7 @@ esMakePorts(hc, cdata) } if (is_array) *aptr = '['; - else - *tptr = '/'; + *tptr = '/'; portname = tptr + 1; // Find the net of portname in the subcell and diff --git a/extflat/EFbuild.c b/extflat/EFbuild.c index 3d56225f..3c83efe4 100644 --- a/extflat/EFbuild.c +++ b/extflat/EFbuild.c @@ -553,8 +553,8 @@ efBuildDeviceParams(name, argc, argv) if (name[0] == ':') { newparm->parm_name = StrDup((char **)NULL, argv[n]); - newparm->parm_type[1] = '0' + n / 10; - newparm->parm_type[0] = '0' + n % 10; + newparm->parm_type[0] = '0' + n / 10; + newparm->parm_type[1] = '0' + n % 10; } else newparm->parm_name = StrDup((char **)NULL, pptr + 1);