1 Reply Latest reply on Aug 22, 2016 11:39 AM by samantha_lizak

    Flattening gds is taking hours

    sanketkumar.patel@cirrus.com

      Hi all,

       

      I have been using following tcl script for flattening data and deleting unused cell references

      But it is taking more then 10 hours to complete the process for some reason.

      The gds I am using is top level Chip cell. But not so big.

      Please help me to detect what is wrong with this script which might be causing this long run time.

       

      I am using following command to run the tcl script.

      calibredrv   /tools/cad/bin/flattenGds.tcl   -gds chipTop_tmp.gds   -output chipTop_plot.gds >> calibreDRV.log

       

      TCL script is as follows:

       

      #   Script flattens data and deletes unused cell references

      #   Intended for use with nodePlot.

      #   Procedure to define the options for the run

       

       

      proc get_options { argv } {

         global option

       

         set option(gds) " "

         set option(output) " "

         set len [ llength $argv ]

         set ptr 0

         while { $ptr < $len } {

            set opt [ lindex $argv $ptr ]

            switch -exact -- $opt {

               -gds { set option(gds) [ lindex $argv [ expr $ptr + 1 ] ] }

               -output { set option(output) [ lindex $argv [ expr $ptr + 1 ] ] }

               default {

                  puts "ILLEGAL OPTION: $opt"

                  exit

               }

            }

            set ptr [ expr $ptr + 2 ]

         }

      }

      #  get command line options

      get_options $argv

       

      # ABORT job if gds files do not exist

      if { ![ file exists $option(gds) ] } {

         puts "ERROR: gds file $option(gds) not found"

         exit

      }

       

      # Open GDS

      set DB1 [ layout create $option(gds) -dt_expand ]

      # Get topcell

      set topcell [$DB1 topcell]

      # Get cell name list

      set cell_list [$DB1 cells]

      # Flatten each cell and delete unused cells

      foreach cell $cell_list {

         $DB1 expand cell $cell

         if { $cell != $topcell } {

           $DB1 delete cell $cell

         }

      }

       

      # Create New GDS

      $DB1 gdsout $option(output) "-noEmptyCells"  "noRefs"

      puts "##### Flattening GDS Has Completed ##### \n\n\n"

       

      Please guide. I appreciate your help.

      Thanks

      Sanket

        • 1. Re: Flattening gds is taking hours
          samantha_lizak

          Hi Sanket-

           

          I am not a scripting guru, but given that the command reference manual lists "$L children" for showing just the immediate hierarchy and "$L cells" for showing all the cells, I suspect that when the design has a depth of more than 2 you are getting the lower-level cells repeatedly.  This would cause a lot of unnecessary work.

           

          Speaking of which, why the complete flattening?  If you would like to see the layout without hierarchy, why not just run calibre -drc without -hier, and write out the results using COPY and DRC CHECK MAP?

           

          Also, I checked with a co-worker who knows the DRC side better than I do.  He tells me "There is no such thing as an unused cell reference.  Unused cells, yes; references, no."  I'm guessing you do mean cells here, but if you truly are just concerned with references that don't have attached cells, you don't need to be.

           

          Hope that helps-

           

          Sam.