;; Program to Print the Hierarchy Tree on the Schematic Editor ;; The Menu appears on Design->Hierarchy Menu on the Schematic Editor ;; ;--------------------------------------------------------------------; ; Adding a tree to the regular menus. Scroll down for the tree code ;--------------------------------------------------------------------; procedure( COSAddHierSliderItem() let( ( myMenuItem fileMenu slider ) fileMenu = car( setof( menu hiGetBannerMenus( hiGetCurrentWindow() ) rexMatchp("^schFileMenu" menu ) ) ) if( fileMenu slider=eval( car( setof( item eval( fileMenu )->? rexMatchp( "^schHierSlider" item )) ) ) ) myMenuItem = hiCreateMenuItem( ?name 'two1 ?itemText "Tree..." ?callback "COSShowTree()" ) when( !slider->two1 hiInsertMenuItem( slider myMenuItem length( slider->? ) ) ) );let );procedure procedure( COSUserPostInstallTrigger( args ) COSAddHierSliderItem() );procedure deRegUserTriggers( "schematic" nil nil 'COSUserPostInstallTrigger ) ;--------------------------------------------------------------------; ; Schematic Tree ;--------------------------------------------------------------------; procedure( COSShowTree( @key ( cvId geGetEditCellView() ) ( tab "" ) ( viewList "schematic cmos_sch symbol" ) port ) let( ( file title ) unless( port && portp( port ) port = outfile( file=makeTempFileName( "/tmp/tree" ) ) ) fprintf( port "\ \n Design Hierarchy \ \n*********************************************************************\ \nLibrary : %s\ \nCell : %s\ \nView : %s\ \nOption : Top to bottom \ \nStop Level : Top to bottom \ \n*****************************************************************\n\n" cvId~>libName cvId~>cellName cvId~>viewName ) COSgoDeep( cvId ?tab strcat( tab " " ) ?viewList viewList ?port port ) sprintf( title "CDS Tree: %s/%s/%s" cvId~>libName cvId~>cellName cvId~>viewName ) view( file list( 25:25 900:800 ) title ) deleteFile( file ) );let );procedure procedure( COSgoDeep( cvId @key ( tab "" ) ( viewList "schematic cmos_sch symbol" ) ( port poport ) ) let( ( inst tmp ) foreach( hdr cvId~>instHeaders if( ( length( hdr~>instances ) > 0 ) && ( inst = car( hdr~>instances ) ) && ( tmp = dbGetAnyInstSwitchMaster( inst viewList ) ) then fprintf( port "%s%s %s %s ( %d )\n" tab hdr->libName hdr->cellName hdr->viewName length( hdr~>instances ) ) unless( tmp->cellViewType == "schematicSymbol" COSgoDeep( tmp ?tab strcat( tab " " ) ?viewList viewList ?port port ) );unless );if );foreach drain( port ) );let );procedure /* End of Script */