From 2788fd70ab2e5eeec3f3920ec8d39c4031904792 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 13 Mar 2020 11:36:42 -0400 Subject: [PATCH] One more change to the extraction method to avoid extracting the substrate more than once for the same subcell, since the substrate extraction method scans the entire plane area; this was making large standard cell layouts extract very slowly, as every component cell was causing the substrate search to be repeated. --- calma/CalmaRdcl.c | 5 +++++ database/database.h.in | 5 +++++ extract/ExtHier.c | 4 ++++ extract/ExtSubtree.c | 25 +++++++++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 8ddb065f..d6c4d1af 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -345,6 +345,7 @@ calmaParseStructure(filename) } } cifReadCellDef = calmaFindCell(strname, &was_called); + def->cd_flags &= ~CDDEREFERENCE; DBCellClearDef(cifReadCellDef); DBCellSetAvail(cifReadCellDef); HashSetValue(he, cifReadCellDef); @@ -664,6 +665,10 @@ calmaElementSref(filename) TxPrintf("Cell definition %s does not exist!\n", sname); fseek(calmaInputFile, originalFilePos, SEEK_SET); def = calmaFindCell(sname, NULL); + /* Cell flags set to "dereferenced" in case there is no */ + /* definition in the GDS file. If there is a definition */ + /* made after the instance, then the flag will be cleared. */ + def->cd_flags |= CDDEREFERENCE; } } diff --git a/database/database.h.in b/database/database.h.in index d3aec04a..2aa64832 100644 --- a/database/database.h.in +++ b/database/database.h.in @@ -498,6 +498,11 @@ typedef struct celluse */ #define CU_SELECT_NET 0x02 #define CU_SELECT_CHUNK 0x04 +/* CU_SUB_EXTRACTED is a temporary flag indicating that the substrate + * of the use has been extracted and the extraction + * does not need to be repeated for this use. + */ +#define CU_SUB_EXTRACTED 0x08 /* Character prefix used to denote a locked cell use in a .mag file */ #define CULOCKCHAR '*' diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 1ad5ad57..f5a4dfe1 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -91,6 +91,10 @@ extHierSubstrate(ha, use, x, y) /* define a substrate plane or substrate connections. */ if (glob_subsnode == NULL) return; + /* If the substrate has already been extracted for this use */ + /* then there is no need to do it again. */ + if (use->cu_flags & CU_SUB_EXTRACTED) return; + def = (CellDef *)ha->ha_parentUse->cu_def; /* Register the name of the parent's substrate */ diff --git a/extract/ExtSubtree.c b/extract/ExtSubtree.c index 7b553ad9..b3da7956 100644 --- a/extract/ExtSubtree.c +++ b/extract/ExtSubtree.c @@ -93,6 +93,26 @@ void extSubtreeAdjustInit(); void extSubtreeOutputCoupling(); void extSubtreeHardSearch(); +/* + * ---------------------------------------------------------------------------- + * + * extClearUseFlags -- + * + * Callback function to clear the CU_SUB_EXTRACTED flag from each child + * use of a CellDef. + * + * ---------------------------------------------------------------------------- + */ + +int +extClearUseFlags(use, clientData) + CellUse *use; + ClientData clientData; +{ + use->cu_flags &= ~CU_SUB_EXTRACTED; + return 0; +} + /* * ---------------------------------------------------------------------------- @@ -292,6 +312,9 @@ done: /* Output connections and node adjustments */ extOutputConns(&ha.ha_connHash, f); HashKill(&ha.ha_connHash); + + /* Clear the CU_SUB_EXTRACTED flag from all children instances */ + DBCellEnum(def, extClearUseFlags, (ClientData)NULL); } #ifdef exactinteractions @@ -800,6 +823,8 @@ extSubtreeFunc(scx, ha) for (y = use->cu_ylo; y <= use->cu_yhi; y++) extHierSubstrate(ha, use, x, y); } + /* Mark substrate as having been extracted for this use. */ + use->cu_flags |= CU_SUB_EXTRACTED; /* Free the cumulative node list we extracted above */ if (ha->ha_cumFlat.et_nodes)