P
PolyPusher
Guest
Hi All,
I found this code from Andrew/Cadence to create a hierarchical tree
from schematic. Instead of having a view list passed, is it possible
to get the actual view name? For example, what if a symbol is
calling(not sure if that is the right way to describe it) a schematic
view name "schematic_not_used" where the Library Cell View would be
"bgap_work bandgap shematic_not_used".
Thank you in advance for any help,
Eric
/* abSchTree.il
Author A.D.Beckett
Group Structured Custom, Cadence Design Systems Ltd.
Machine SUN
Date Oct 30, 1995
Modified
By
Function to perform the equivalent of the "tree" function
for schematics
There are two entry points in this file:
(abSchTree [optional key arguments])
Low level entry point - no form. Just uses arguments to define how
and
where the tree gets created
(abHiSchTree)
Form interface to abSchTree.
***************************************************
SCCS Info: @(#) abSchTree.il 08/07/01.15:31:07 1.1
*/
/***************************************************************
* *
* (abCompareCellName inst1 inst2) *
* *
* Comparison function when sorting the instHeaders *
* *
***************************************************************/
(procedure (abCompareCellName inst1 inst2)
(let (result)
(forall property '(libName cellName viewName)
(equal (setq result (strcmp (dbGet inst1 property)
(dbGet inst2 property))) 0))
(lessp result 0)))
/
************************************************************************
*
*
* (abSchTree @key (cellView
(geGetEditCellView)) *
* (viewList "schematic cmos.sch
symbol") *
* (stopList
"symbol") *
* (port
poport) *
* (displayPins
nil) *
* (indent
0)) *
*
*
* Recursive function to output a "tree" like display from the
specified *
* cellView downwards using the specified view and stop lists. The
pins *
* can be displayed as well if desired. The indent is for internal
use *
* only and controls the indent level that this cellView's
instances *
* are printed
at. *
*
*
************************************************************************/
(procedure (abSchTree @key (cellView (geGetEditCellView))
(viewList "schematic cmos.sch symbol")
(stopList "symbol")
(port poport)
(displayPins nil)
(indent 0))
(let (sortedHeaders formatString count stopAtList)
(setq stopAtList (parseString stopList))
(setq sortedHeaders (sort (dbGetq cellView instHeaders)
'abCompareCellName))
(foreach header sortedHeaders
/* count the number of instances */
(setq count (length
(if displayPins
/* if we're displaying pins, count
them all regardless */
(dbGetq header instances)
/* otherwise only count those without
purpose pin */
(setof inst
(dbGetq header instances)
(nequal (dbGetq inst purpose)
"pin")))))
/* when there was at least one (so that pins can be
filtered out) */
(when (greaterp count 0)
(sprintf formatString "%%%ds %%s %%s %%s (%%d)
\n" indent)
(fprintf port formatString ""
(dbGetq header libName)
(dbGetq header cellName)
(dbGetq header viewName)
count)
/* switch views */
(setq switchedView (dbGetAnyInstSwitchMaster
(car (dbGetq header
instances))
viewList))
(when switchedView
(unless (member (dbGetq switchedView
viewName) stopAtList)
(abSchTree ?cellView switchedView
?viewList viewList
?stopList stopList
?port port
?displayPins
displayPins
?indent (plus indent
2)))
/* I did try closing the switched cell,
but it
didn't work properly. Have to live with
this, I suppose! */
)
)
)
t))
/***************************************************************
* *
* (abCreateHiSchTreeForm) *
* *
* Create the form for the schematic tree function *
* *
***************************************************************/
(procedure (abCreateHiSchTreeForm)
(let (topOrCurrent viewList stopList displayPins)
(setq topOrCurrent
(hiCreateRadioField
?name 'topOrCurrent
?prompt "Starting cell"
?choices '("current" "top")))
(setq viewList
(hiCreateStringField
?name 'viewList
?prompt "View list"
?value "schematic cmos.sch symbol"))
(setq stopList
(hiCreateStringField
?name 'stopList
?prompt "Stop list"
?value "symbol"))
(setq displayPins
(hiCreateBooleanButton
?name 'displayPins
?buttonText "Display pins"
?value nil))
(setq abHiSchTreeForm
(hiCreateAppForm
?name 'abHiSchTreeForm
?formTitle "Schematic Tree"
?callback 'abHiSchTreeCB
?fields (list
topOrCurrent viewList stopList displayPins)))
abHiSchTreeForm))
/***************************************************************
* *
* (abHiSchTreeCB form) *
* *
* Callback for the schematic tree form. *
* Opens the file, outputs the header information and *
* then calls abSchTree to recursively descend down the *
* hierarchy. *
* Then the output file is viewed and deleted. *
* *
***************************************************************/
(procedure (abHiSchTreeCB form)
(let (cellView port fileName)
(setq cellView
(if (equal (getq (getq form topOrCurrent) value) "top")
(geGetTopLevelCellView (getq form treeWindow))
(geGetEditCellView (getq form treeWindow))))
(if cellView
(progn
(setq oport (outfile (setq fileName (makeTempFileName "/
tmp/schTree"))))
(if oport
(progn
(fprintf oport "%40s\n","Design Hierarchy")
(fprintf oport
"*******************************************************\n")
(fprintf oport "Library : %s\n" (dbGetq cellView
libName))
(fprintf oport "Cell : %s\n" (dbGetq cellView
cellName))
(fprintf oport "View : %s\n" (dbGetq cellView
viewName))
(fprintf oport "Option : %s to bottom\n" (getq (getq
form topOrCurrent) value))
(fprintf oport
"*******************************************************\n\n")
(abSchTree ?cellView cellView
?viewList (getq (getq form viewList)
value)
?stopList (getq (getq form stopList)
value)
?displayPins (getq (getq form displayPins)
value)
?port oport
)
(close oport)
(view fileName nil "Tree")
(deleteFile fileName)
)
(error "Couldn't open output file"))
)
(error "Couldn't find cellView"))
))
/***************************************************************
* *
* (abHiSchTree) *
* *
* Display a form controlling the tree generation *
* *
***************************************************************/
(procedure (abHiSchTree)
/* create the form if it doesn't exist */
(unless (and (boundp 'abHiSchTreeForm) abHiSchTreeForm)
(abCreateHiSchTreeForm))
/* store the window on the form so that it will always use the
window
that was current when the command was invoked */
(putpropq abHiSchTreeForm (hiGetCurrentWindow) treeWindow)
(hiDisplayForm abHiSchTreeForm))
I found this code from Andrew/Cadence to create a hierarchical tree
from schematic. Instead of having a view list passed, is it possible
to get the actual view name? For example, what if a symbol is
calling(not sure if that is the right way to describe it) a schematic
view name "schematic_not_used" where the Library Cell View would be
"bgap_work bandgap shematic_not_used".
Thank you in advance for any help,
Eric
/* abSchTree.il
Author A.D.Beckett
Group Structured Custom, Cadence Design Systems Ltd.
Machine SUN
Date Oct 30, 1995
Modified
By
Function to perform the equivalent of the "tree" function
for schematics
There are two entry points in this file:
(abSchTree [optional key arguments])
Low level entry point - no form. Just uses arguments to define how
and
where the tree gets created
(abHiSchTree)
Form interface to abSchTree.
***************************************************
SCCS Info: @(#) abSchTree.il 08/07/01.15:31:07 1.1
*/
/***************************************************************
* *
* (abCompareCellName inst1 inst2) *
* *
* Comparison function when sorting the instHeaders *
* *
***************************************************************/
(procedure (abCompareCellName inst1 inst2)
(let (result)
(forall property '(libName cellName viewName)
(equal (setq result (strcmp (dbGet inst1 property)
(dbGet inst2 property))) 0))
(lessp result 0)))
/
************************************************************************
*
*
* (abSchTree @key (cellView
(geGetEditCellView)) *
* (viewList "schematic cmos.sch
symbol") *
* (stopList
"symbol") *
* (port
poport) *
* (displayPins
nil) *
* (indent
0)) *
*
*
* Recursive function to output a "tree" like display from the
specified *
* cellView downwards using the specified view and stop lists. The
pins *
* can be displayed as well if desired. The indent is for internal
use *
* only and controls the indent level that this cellView's
instances *
* are printed
at. *
*
*
************************************************************************/
(procedure (abSchTree @key (cellView (geGetEditCellView))
(viewList "schematic cmos.sch symbol")
(stopList "symbol")
(port poport)
(displayPins nil)
(indent 0))
(let (sortedHeaders formatString count stopAtList)
(setq stopAtList (parseString stopList))
(setq sortedHeaders (sort (dbGetq cellView instHeaders)
'abCompareCellName))
(foreach header sortedHeaders
/* count the number of instances */
(setq count (length
(if displayPins
/* if we're displaying pins, count
them all regardless */
(dbGetq header instances)
/* otherwise only count those without
purpose pin */
(setof inst
(dbGetq header instances)
(nequal (dbGetq inst purpose)
"pin")))))
/* when there was at least one (so that pins can be
filtered out) */
(when (greaterp count 0)
(sprintf formatString "%%%ds %%s %%s %%s (%%d)
\n" indent)
(fprintf port formatString ""
(dbGetq header libName)
(dbGetq header cellName)
(dbGetq header viewName)
count)
/* switch views */
(setq switchedView (dbGetAnyInstSwitchMaster
(car (dbGetq header
instances))
viewList))
(when switchedView
(unless (member (dbGetq switchedView
viewName) stopAtList)
(abSchTree ?cellView switchedView
?viewList viewList
?stopList stopList
?port port
?displayPins
displayPins
?indent (plus indent
2)))
/* I did try closing the switched cell,
but it
didn't work properly. Have to live with
this, I suppose! */
)
)
)
t))
/***************************************************************
* *
* (abCreateHiSchTreeForm) *
* *
* Create the form for the schematic tree function *
* *
***************************************************************/
(procedure (abCreateHiSchTreeForm)
(let (topOrCurrent viewList stopList displayPins)
(setq topOrCurrent
(hiCreateRadioField
?name 'topOrCurrent
?prompt "Starting cell"
?choices '("current" "top")))
(setq viewList
(hiCreateStringField
?name 'viewList
?prompt "View list"
?value "schematic cmos.sch symbol"))
(setq stopList
(hiCreateStringField
?name 'stopList
?prompt "Stop list"
?value "symbol"))
(setq displayPins
(hiCreateBooleanButton
?name 'displayPins
?buttonText "Display pins"
?value nil))
(setq abHiSchTreeForm
(hiCreateAppForm
?name 'abHiSchTreeForm
?formTitle "Schematic Tree"
?callback 'abHiSchTreeCB
?fields (list
topOrCurrent viewList stopList displayPins)))
abHiSchTreeForm))
/***************************************************************
* *
* (abHiSchTreeCB form) *
* *
* Callback for the schematic tree form. *
* Opens the file, outputs the header information and *
* then calls abSchTree to recursively descend down the *
* hierarchy. *
* Then the output file is viewed and deleted. *
* *
***************************************************************/
(procedure (abHiSchTreeCB form)
(let (cellView port fileName)
(setq cellView
(if (equal (getq (getq form topOrCurrent) value) "top")
(geGetTopLevelCellView (getq form treeWindow))
(geGetEditCellView (getq form treeWindow))))
(if cellView
(progn
(setq oport (outfile (setq fileName (makeTempFileName "/
tmp/schTree"))))
(if oport
(progn
(fprintf oport "%40s\n","Design Hierarchy")
(fprintf oport
"*******************************************************\n")
(fprintf oport "Library : %s\n" (dbGetq cellView
libName))
(fprintf oport "Cell : %s\n" (dbGetq cellView
cellName))
(fprintf oport "View : %s\n" (dbGetq cellView
viewName))
(fprintf oport "Option : %s to bottom\n" (getq (getq
form topOrCurrent) value))
(fprintf oport
"*******************************************************\n\n")
(abSchTree ?cellView cellView
?viewList (getq (getq form viewList)
value)
?stopList (getq (getq form stopList)
value)
?displayPins (getq (getq form displayPins)
value)
?port oport
)
(close oport)
(view fileName nil "Tree")
(deleteFile fileName)
)
(error "Couldn't open output file"))
)
(error "Couldn't find cellView"))
))
/***************************************************************
* *
* (abHiSchTree) *
* *
* Display a form controlling the tree generation *
* *
***************************************************************/
(procedure (abHiSchTree)
/* create the form if it doesn't exist */
(unless (and (boundp 'abHiSchTreeForm) abHiSchTreeForm)
(abCreateHiSchTreeForm))
/* store the window on the form so that it will always use the
window
that was current when the command was invoked */
(putpropq abHiSchTreeForm (hiGetCurrentWindow) treeWindow)
(hiDisplayForm abHiSchTreeForm))