• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to calculate area for a given schematic

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 143
  • Views 21975
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to calculate area for a given schematic

IC Layout
IC Layout over 16 years ago

 Hello! Every body, I am using cadence IC514 version and a 90nm PDK kit called "gpdk090".
My intention is to calculate area for a given schematic.
I wrote a procedure called "area()" which will calculate area in the current level (means for transistors, capacitors and resistors only).
Now I need to call this procedure for every instance which is not a transistor,cap or a resistor.
I wrote something like this........................
foreach( inst geGetEditCellView()~>instances
    when( inst~>purpose == "cell"
        if( inst~>libName == "gpdk090" then
            area()
        else
            label:
            cv1=dbOpenCellViewByType(inst~>libName inst~>cellName "schematic")
            foreach( inst1 cv1~>instances
                when( inst1~>purpose == "cell"
                    if( inst1~>libName == "gpdk090" then
                        area()
                    else
                        goto label
        ]
Can some body guide me in this way...
                Thanks in Advance...    
                                                                Prabhakar. K

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Most likely you're going to want to have your area function take the cellView it is analysing as an argument, and return the area so that you can sum it up in the parent.

    Secondly the goto you have there is just going to make this an infinite loop as soon as it comes across a pin in the schematic. I suspect that's not what you want.

    You're probably going to want to have a recursive function too - so that you descend down the hierarchy, view switching as you go.

    So, something like this pseudo-code:

    procedure(PKsumArea(@optional (cv geGetEditCellView()))
      let((totalArea master)
        foreach(inst cv~>instances
          if(inst~>libName=="gpdk090" then
            totalArea=totalArea+area(inst)
          else
            when(inst~>purpose=="cell"
             master=dbOpenCellViewByType(inst~>libName inst~>cellName "schematic")
             when(master
               totalArea=totalArea+PKsumArea(master)
             )
          )
        )
        totalArea
     )
    )

    Something like that...

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     Hello, Sir! I have re-written the code but still I am not able to display the result in user units (i.e sq.microns)..

    I am in confusion.......Please kindly read this code and suggest me........

    ************************area.il****************************

     Ap = Ac = Ar = An = evalstring("0u")
    div_fac = evalstring("1f")
    count = 0
    procedure( area(cv)
        foreach(inst cv~>instances
        when( and(inst~>purpose == "cell" inst~>libName == "gpdk090")
            if(inst~>cellName == "pmos2v" then
                w1 = evalstring(cdfFormatFloatString(dbGetq(inst "w") "u"))
                l1 = evalstring(cdfFormatFloatString(dbGetq(inst "l") "u"))
                m1 = evalstring(dbGetq(inst "m"))    
                f1 = evalstring(dbGetq(inst "fingers"))    
                
                wp = w1 + evalstring("1.4u") ; (0.7u + 0.7u) oxide to nwell enclosure in vertical direction for "pmos2v"
                lp = (f1*l1) + ((f1-1)*evalstring("0.36u")) + evalstring("2u")
                ;0.36u is space b/w poly fingers
                ;(1u + 1u)  poly to nwell enclosure in horizontal direction for "pmos2v"
                areap = m1*wp*lp
                Ap = Ap + areap
                Ap1 = atof(cdfFormatFloatString(artMakeString(Ap) "p"))
            else
            if(inst~>cellName == "nmos2v" then
                w1 = evalstring(cdfFormatFloatString(dbGetq(inst "w") "u"))
                l1 = evalstring(cdfFormatFloatString(dbGetq(inst "l") "u"))
                m1 = evalstring(dbGetq(inst "m"))    
                f1 = evalstring(dbGetq(inst "fingers"))    
                
                wn = w1 + evalstring("0.6u") ; (0.3u + 0.3u) oxide to oxide_thk enclosure in vertical direction for "nmos2v"
                ln = (f1*l1) + ((f1-1)*evalstring("0.36u")) + evalstring("1.12u")
                ;0.36u is space b/w poly fingers
                ;(0.56u + 0.56u)  poly to oxide_thk enclosure in horizontal direction for "nmos2v"
                arean = m1*wn*ln
                An = An + arean
                An1 = atof(cdfFormatFloatString(artMakeString(An) "p"))
            else
            if( inst~>cellName == "mimcap" then
                c1 = evalstring(dbGetq(inst "c"))
                m1 = evalstring(dbGetq(inst "m"))
                
                areac = m1*c1
                ratio = areac/div_fac
                Ac = Ac + ratio
            else
            if( inst~>cellName == "resnsppoly" then
                w1 = evalstring(cdfFormatFloatString(dbGetq(inst "segW") "u"))
                l1 = evalstring(cdfFormatFloatString(dbGetq(inst "segL") "u"))
                m1 = evalstring(dbGetq(inst "segments"))
                
                wr = (m1*w1) + (m1-1)*evlastring("0.6u") + evalstring("0.56u")
                lr = l1 + evalstring("1.12u")
                arear = wr*lr
                Ar = Ar + arear
                Ar1 = atof(cdfFormatFloatString(artMakeString(Ar) "p"))
            else
            println("Nothing to calculate")
    );if
    );if
    );if
    );if
    );when
            when( and(inst~>purpose == "cell" inst~>libName != "gpdk090")
                cv1 = dbOpenCellViewByType(inst~>libName inst~>cellName "schematic")
                println(inst~>cellName)
                count = count + 1
                area(cv1) ;function call
                dbClose(cv1)
    );when
    );foreach
    );procedure

    area(geGetEditCellView())

    area = Ap1 + An1 + Ar1 + Ac
    printf("Number of instances/blocks in the design : %d \n" count)
    println(area)
    ;printf("The Total area of the design : %f \n" area)
    *************************end of area.il********************************

    And one more kind request How to get the area of each instance/block (which are in toplevel schematic only).

    Thanks in advance

                                 Prabhakr. K - Layout Design Engineer

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Why are you using evalstring() all over the place, including with constants? For example, you are doing things like evalstring("0.56u") when you could just use 0.56u directly (engineering suffixes are understood in SKILL natively). In other places you're doing things like:

      evalstring(cdfFormatFloatString(dbGetq(inst "segL") "u"))

    I cannot fathom out why you're doing that. Reformatting a number to be in engineering suffixes, and then using evalstring on it? Why? If it's a string in the first place, just use:

      cdfParseFloatString(inst~>segL)

    Later on  you have:

      Ar=Ar+arear
      Ar1=atof(cdfFormatFloatString(artMakeString(Ar) "p"))

    You're converting to a string, reformatting to have a "p" suffix, and then using atof (which will ignore the suffix) back to a float again. Why?

    Anyway, your function area does not explicitly return anything - it will return the last thing computed in the fucntion, which will be the return value of the foreach. The return value of foreach will be the list it processed. Most likely I'd expect you to need to sum up the area of all the instances (including the return value of the recursive area() call within area()), and make that the return value. Look at what my pseudo code does - totalArea is the last statement in the function, and that will be the return value.

    Best Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     Thanks for your concern towards my problem.......sir,

    My intention is to have total area for a given schematic & also drawing rectangles for the instances/blocks which are in top level schematic only.

    With the suggestions you had given now I am able to obtain area for the entire schematic......I tried to draw rectangles for the instances which are in toplevel but in vain.......

    Please have a look at my new code " area_mod.il" and suggest me........

    ************************************ area_mod.il**************************************

     div_fac = 1f

     procedure( area_mod(inst)

     if(inst~>cellName == "pmos2v" then
                w1 = cdfParseFloatString(dbGetq(inst "w") )
                l1 = cdfParseFloatString(dbGetq(inst "l") )
                m1 = evalstring(dbGetq(inst "m"))    
                f1 = evalstring(dbGetq(inst "fingers"))  

               wp = w1 + 1.4u

               lp = f1*l1 + (f1-1)*0.36u + 2u

               AREA = wp*lp

    else

           if(inst~>cellName == "nmos2v" then
                w1 = cdfParseFloatString(dbGetq(inst "w") )
                l1 = cdfParseFloatString(dbGetq(inst "l") )
                m1 = evalstring(dbGetq(inst "m"))    
                f1 = evalstring(dbGetq(inst "fingers"))  

               wn = w1 + 0.6u

               ln = f1*l1 + (f1-1)*0.36u +1.12u

               AREA = wn*ln

    else

               if(inst~>cellName == "resnsppoly" then

               w1 = cdfParseFloatString(dbGetq(inst "segW") )
                l1 = cdfParseFloatString(dbGetq(inst "segL") )
                m1 = evalstring(dbGetq(inst "segments"))
                
                wr = m1*w1 + (m1-1)*0.6u + 0.56u

                lr = l1 + 1.12u

               AREA = wr*lr

    else

                if( inst~>cellName == "mimcap" then
                c1 = cdfParseFloatString(dbGetq(inst "c"))
                m1 = evalstring(dbGetq(inst "m"))
                
                areac = m1*c1
                AREA = areac/div_fac

    ) ) ) )

    AREA

    );procedure

     procedure(PKsumArea(@optional (cv geGetEditCellView()))
          foreach(inst cv~>instances
          if(inst~>libName=="gpdk090" then
            totalArea=totalArea+area_mod(inst)

    ;;;;shall I write 'dbCreateRect(.....) statement here.....for the toplevel transistors/res/caps

          else

            when(inst~>purpose=="cell"
             master=dbOpenCellViewByType(inst~>libName inst~>cellName "schematic")
             when(maste          

            println(master~>cellName)

            PKsumArea(master)

            ;;;;shall I write 'dbCreateRect(.....) statement here.....for the toplevel blocks (after calculating whole block area)
     

    ) ) ) )

    totalArea

    )

    PKsumArea()

    println(totalArea)

    ******************************************** end of area_mo.il************************************

    I have used ' cdfFofmatFloatString ' for the purpose of drawing rectangles (by formating every value to suffix "p" in other case it's giving errors).

     I hope you are understanding my problem...........

    I am very very sorry....if you feel inconvinence..

    Thanks & regards........

                        Prabhakar. K
     

     

        
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     I am sorry ....I forgot to write a statement at the top of the code....

    Please notice this .........

    totalArea = 0u

    thanks & regards

                           Prabhakar. K
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Why are you trying to draw rectangles in the schematic? Since you have those lines missing, I can't work out what you're trying to do or why it failed...

    Also, your code could seriously do with using local variables. At the moment everything is global, which in a recursive function is asking for trouble...

    And you still have unnecessary evalstring() calls in the code.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     No, I would like to draw rects in a layout window....

    I got part of solution....drawing rects for transisitors/caps/resistors  which are in top level....

    ***************************************************

      totalArea = 0u
      top = geGetEditCellView()~>cellName

       procedure( PKsumArea(@optional (cv geGetEditCellView()))
           foreach(inst cv~>instances
                   if(inst~>libName == "gpdk090" && cv~>cellName == top then
                   totalArea = totalArea + area(inst)
                   fig1=dbCreateRect(rv list("Metal1" "drawing") list(0:0 sqrt(atof(cdfFormatFloatString(artMakeString(area(inst)) "p"))):sqrt(atof(cdfFormatFloatString(artMakeString(area(inst)) "p")))))
                   ;where ' rv ' is a opend layout window
                   println(inst~>cellName)
                   else
                   if(inst~>libName == "gpdk090" && cv~>cellName != top then
                   totalArea = totalArea + area(inst)
                   else
                   when(inst~>purpose == "cell"
                   master = dbOpenCellViewByType(inst~>libName inst~>cellName "schematic")
                   ;;for this particular 'master' I need to get/print area separately
                   when(master
                   println(master~>cellName)
                   PKsumArea(master)
                   )
           )
    )
    )
    )
    totalArea
    )
    PKsumArea()
    println(totalArea)
    println(cdfFormatFloatString(artMakeString(totalArea) "p"))

    ******************************************************************

    ;;;You might be surprised why I again wrote the bad statement  atof(cdfFormatFloatString(artMakeString(area(inst)) "p")

    ;;;;But I find this is the way to draw rectangles
    ;;;;if I wrote like this "dbCreateRect(rv list("Metal1" "drawing") list(0:0 sqrt(area(inst)):sqrt(area(inst))))"
    ;;;;I am getting this error " *WARNING* Rectangle being created has no area "
    ;;;;Please notice this ....and let me know the right solution.......
    ;;;;One more thing is that I am not getting the area of individual blocks which are in toplevel schematic

    thanks & regards....

                               Prabhakar. K

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    Wouldn't it be easier to do:

    ; convert to microns
    wl=sqrt(area(inst)*1e6
    dbCreateRect(rv list("Metal1" "drawing") list(0:0 wl:wl))

    What you have is a very complicated way of converting from metres to microns.

    And it only does it for the transistors because it's only in the then part of the if and not in the else part. Simple flow of control problem...

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • IC Layout
    IC Layout over 16 years ago

     Really, I tried a lot.......Still I am not getting how to access the area of individual block area which is in tolevel schematic .

    In my every attempt the area is being adding to one variable only..I tried to have one more variable to add block area still results are not satisfactory.. Also I made three procedures same thing happening..

    If you don't mind can please send me a code snippet which will guide me in accessing the whole block  area ....

    Anyway I am getting the total area of given schematic perfectly...but it's only my part of intention... 

    thanks & regards 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    It's still very unclear what you're actually trying to do. Please post the current complete code, and a detailed specification of your requirements. That way somebody might have a chance to correct your code, or at least provide pointers as to what you really want.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
>

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information