;; 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 ;--------------------------------------------------------------------; (defun COSAddHierSliderItem () (let (myMenuItem fileMenu slider) (setq fileMenu (car (setof menu (hiGetBannerMenus (hiGetCurrentWindow)) (rexMatchp "^schFileMenu" menu)))) (cond (fileMenu (setq slider (eval (car (setof item ((eval fileMenu)->?) (rexMatchp "^schHierSlider" item)))))) ); cond (setq myMenuItem (hiCreateMenuItem ?name 'two1 ?itemText "Tree..." ?callback "(COSShowTree)")) (when (not slider->two1) (hiInsertMenuItem slider myMenuItem (length slider->?)) ) ); let ); defun (defun COSUserPostInstallTrigger (args) (COSAddHierSliderItem) ); defun (deRegUserTriggers "schematic" nil nil 'COSUserPostInstallTrigger) ;--------------------------------------------------------------------; ; Schematic Tree ;--------------------------------------------------------------------; (defun COSShowTree (@key (cvId (geGetEditCellView)) (tab "") (viewList "schematic cmos_sch symbol") port ) (let (file title) unless(port && (portp port) (setq port (outfile (setq 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 ); defun (defun COSgoDeep (cvId @key (tab "") (viewList "schematic cmos_sch symbol") (port poport) ) (let (inst tmp) (foreach hdr cvId~>instHeaders if((length(hdr~>instances) > 0) && (setq inst (car hdr~>instances)) && (setq 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 ); defun /* End of Script */