I would like some hints for SKILL code.
I am writing a function which can be summarized " where are all the places this instance is used".
I want to search all cells in all libraries .
The only code I have seen that is close are these two:
CCSfindInstCellLib = find a instance in ONE library
CCSFindCellInLibrary = finds a CELL in all libraries
I have been trying to combine these two but have no luck so far.
My plan is something like this:
foreach(cell in library... search for instance "inv2"
print the results.
Not sure the criteria of how you want to search of whole string or substring, but will provide a skeleton to started
findCellStr = substring searching
schLayBool = t schematic nil layoutfindCellStringAllLib("INV" t)
procedure(findCellStringAllLib(findCellStr schLayBool)let( (cellDb fndList instList)foreach(lib sort(ddGetLibList()~>name nil) printf("Searching %s\n" lib) foreach(cName ddGetObj(lib)~>cells~>name if(schLayBool then when(ddGetObj(lib cName "schematic") cellDb = dbOpenCellViewByType(lib cName "schematic" "schematic" "r") instList = setof(i cellDb~>instances dbIsId(i) && rexMatchp(findCellStr i~>cellName))~>cellName) else when(ddGetObj(lib cName "layout") cellDb = dbOpenCellViewByType(lib cName "layout" "maskLayout" "r") instList = setof(i cellDb~>instances dbIsId(i) && rexMatchp(findCellStr i~>cellName))~>cellName) )
when(instList fndList = cons(strcat(lib " " cName) fndList)) instList = nil ))
if(fndList then printf("%L\n\n" sort(fndList nil))else printf("%s not found\n" findCellStr)))); end of findCellStringAllLib
That worked perfect except for one unseen situation - during the run, memory usage jumped from 2gb to 27gb before I stopped it. It was probably due to the "dbOpen" function which loads the cell into memory, and was loading hundreds of cells into memory. I will see if there is a purge command to purge each cell after it is done.