Home->Products-> Slam-Edit

# Scan all the cells in mergeFromLibName. If a corresponding # cell exists in mergeToLibName, then copy all the data # in the mergeFromLibName cell to the mergeToLibName # cell. # This routine is useful to merge the data generated from # a DRC into the main cell. Generally, you would # 1. Create the "mergeToLibName" by streaming in the # data USED by the DRC program. # 2. Create the mergeFromLibName by streaming in the # data CREATED by the DRC program. # 3. Run this script. # 4. Stream out the data from the mergeToLibName top cell. ## usage # set x [ssInstallDir] # source $x/example/tclExample/mergeCellData.tcl # mergeCellData ## Alternatively a GUI interface can be displayed with # menuMergeCellData # This first procedure copies all the data fromCellId to toCellId # Because we are assuming this is DRC data, only copy shapes. # IE paths, polys rects. Could also copy insts and inst arrays # vias etc by sequencing them as well; but DRC output wouldn't # have these objects. proc mergeOneCell { fromCellId toCellId } { set polyCnt 0 set pathCnt 0 set rectCnt 0 edbSeq loopVar $fromCellId rectangle { edbCopyObject $fromCellId --targetCellId $toCellId $loopVar {0 0} incr rectCnt } edbSeq loopVar $fromCellId path { edbCopyObject $fromCellId --targetCellId $toCellId $loopVar {0 0} incr pathCnt } edbSeq loopVar $fromCellId polygon { edbCopyObject $fromCellId --targetCellId $toCellId $loopVar {0 0} incr polyCnt } puts " Copied $rectCnt rectangles $pathCnt paths $polyCnt polygons" } proc mergeCellData { mergeFromLibName mergeToLibName } { # find or open the libraries, to must be in write mode set fromLibId [edbFindLibraryId $mergeFromLibName] if { $fromLibId == 0 } { set fromLibId [edbOpenLibrary $mergeFromLibName r] puts "Opened library $fromLibId" } set toLibId [edbFindLibraryId $mergeToLibName] if { $toLibId == 0 } { set toLibId [edbOpenLibrary $mergeToLibName w] puts "Opened library $toLibId" } else { edbChangeLibraryAccessMode $toLibId w } # Get a list of all cells. Assume the lay view is being used for all cells. set fromClist [edbGetLibCellIndex $fromLibId -cellOnly] set toClist [edbGetLibCellIndex $toLibId -cellOnly] # Protect in a catch to make sure we unlock when done # Locking is not required, but will speed things up edbLockLibrary $toLibId edbLockLibrary -read $fromLibId if { [catch { foreach cellName $fromClist { if { [lsearch -exact $toClist $cellName] != -1 } { puts "Merge cell $cellName" set fromCellId [edbFindCellId $fromLibId $cellName lay] if { $fromCellId == 0 } { set fromCellId [edbOpenCell $fromLibId $cellName lay -mode read] set fromOpened 1 } else { set fromOpened 0 } set toCellId [edbFindCellId $toLibId $cellName lay] if { $toCellId == 0 } { set toCellId [edbOpenCell $toLibId $cellName lay -mode write] set toOpened 1 } else { edbChangeCellAccessMode $toCellId write set toOpened 0 } mergeOneCell $fromCellId $toCellId if { $toOpened == 1 } { edbSaveAndCloseCell $toCellId } if { $fromOpened == 1 } { edbSaveAndCloseCell $fromCellId } } else { puts "Cell $cellName present in from library but cell was not in target library." } } } eString] != 0 } { puts "Failed because $eString" } edbUnlockLibrary $toLibId edbUnlockLibrary $fromLibId } proc menuMergeCellData { } { set dialogName .mergeCellData toplevel $dialogName frame $dialogName.but frame $dialogName.d1 frame $dialogName.d2 wm title $dialogName "Merge Cell Data" button $dialogName.ok -text Ok -command "menuEMergeCellData 1" button $dialogName.apl -text Apply -command "menuEMergeCellData 0" button $dialogName.cancel -text Cancel -command "destroy $dialogName" label $dialogName.fTitle -text "From Library" entry $dialogName.fName label $dialogName.tTitle -text "To Library" entry $dialogName.tName pack $dialogName.but $dialogName.d1 $dialogName.d2 -anchor w pack $dialogName.ok $dialogName.apl $dialogName.cancel -side left -in $dialogName.but pack $dialogName.fTitle $dialogName.fName -side left -in $dialogName.d1 pack $dialogName.tTitle $dialogName.tName -side left -in $dialogName.d2 } proc menuEMergeCellData { wipe } { set dialogName .mergeCellData set fName [$dialogName.fName cget -text] set tName [$dialogName.tName cget -text] mergeCellData $fName $tName if { $wipe } { destroy $dialogName } }

©2011 Stabie-Soft, Inc. All Rights Reserved.