I'm trying to write a procedure that will follow a signal down the hierarchy and return a list of instances which were traversed. I've been able to do this successfully, with the code below, as long as the path does not contain iterated instances. With iterated instances I'm struggling with how to map the signal name a one level to the name used at the next lower level.
My basic approach is as follows:
1) use dbFindSigByName to find the signal object assocaited with the desired signal at a given level of hierarchy.
2) from the signal object, use instTerms to determine which instance terminals the signal is connected to and at which index of that terminal the desired signal is located
3) for each instTerm, open the associated instance and use dbGetMemName to determine what name the original signal name was mapped to.
4) Repeat the whole procedure for the current instance with the mapped signal name until the desired stop cell is reached or it has descended into cell from a base cell library ("xxXxx"). At this point the instance path is printed out.
When descending into an iterated instance the mapping step with dbGetMemName fails since it doesn't account for the iterated intances. For example, consider cellview where 3 iterated instances I<0:2> have a net "upper<0:5>" connected to terminal "lower<0:1>". If I'm following the signal "upper<3>" down, I need to determine that "upper<3>" maps to "lower<1>" of instance I<1>. Are there any built-in functions to assist with this mapping or do I need to roll my own?
Any help would be greatly appreciated.
;; usage: traceSignal("signal<2>" "stopCellName")
procedure(traceSignal(sig_name stop_cell @optional (cv geGetEditCellView()) (sList '() ) (iList '("") ) (cList '() ) )
let( (net_l net net_d sig_d sig sig_l instTerm_l instTerm bit)
if(sig_d = dbFindSigByName(cv sig_name) ;; get the signal object for the signal name
sList = cons(sig_name sList) ;; add signal name to hierarchical list
instTerm = car(instTerm_l) ;; instance terminal to which signal connects
bit = cadr(instTerm_l) ;; bit index of signal on instance terminal
followDown(instTerm bit stop_cell sList iList cList)
printf("Signal %s not found\n" sig_name)
procedure(followDown(instTerm bit stop_cell sList iList cList)
let((cv term_name inst_name inst_base_name inst_num cell_name lib_name sig_name)
term_name = instTerm~>name
inst_name = instTerm~>inst~>name
cell_name = instTerm~>inst~>cellName
lib_name = instTerm~>inst~>libName
iList = cons( inst_name iList) ;; add instance name to hierarchical list
cList = cons( cell_name cList) ;; add cell name to hierarchical list
if(lib_name == "xxXxx" || cell_name == stop_cell
then ;; don't descend any further
printf("%s\n" buildString( reverse(sList) " -> " ))
printf("%s\n" buildString( reverse(cList) " : " ))
printf("%s\n" buildString( reverse(iList) "/" ))
when(cv = dbOpenCellViewByType(lib_name cell_name "schematic" ) ;; descend hierarchy
sig_name = dbGetMemName(term_name bit) ;; determine signal name at lower level
traceSignal(sig_name stop_cell cv sList iList cList) ;; look for signal