• 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. dx==0.05 is not true even dx is 0.05

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 952
  • 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

dx==0.05 is not true even dx is 0.05

Venu Ch
Venu Ch over 11 years ago

 Hi all,

I have written below code for increasing metal widths of source and drain of every mos device in layout. This is because pcell default souce and drain metal widths are minimum.  I don't want minimum metal widths. So I palnning to identify minimum metal widths for each and every mos and increase it by 0.01.

m1=list("M1" "drawing")

polyVia=techFindViaDefByName( techId "PCCAM1")

procedure(CSVsourceAndDrainMinWidth()
cv=geGetEditCellView()
foreach(inst cv~>instances
when(car(parseString(inst~>cellName "egpnlvt"))=="f" ;this is for getting mos device
when(inst~>prop    ;this is for make sure it is pcell
m1Lay  =dbGetOverlaps(cv inst~>bBox m1 2 t)
abCopyOverlapShape(m1Lay)
m1Lay2=setof(x tempObjs x~>lpp==m1)
result=dbLayerTile(cv "y4"  m1Lay2 )
tempObjs~>lpp=y1
foreach(objct result
dx=abs(caadr(objct~>bBox)-caar(objct~>bBox))
dy=abs(cadar(objct~>bBox)-cadadr(objct~>bBox))
printf("%f  " dx)
when(dx==0.05
print("yes")
m1Lay3=dbLayerSize(cv m1 list(obj) 0.01)
))

y2y3y4prBoundary=nconc(tempObjs result)
foreach(deleteLayer y2y3y4prBoundary
dbDeleteObject(deleteLayer)
)
))))

 procedure(abCopyOverlapShape(objcts)
tempObjs=nil
flattenendFigList2=foreach(mapcar overlap objcts
 srcShape=abGetOverlapShape(overlap)
tempObj=dbCopyFig(srcShape cv dbGetHierPathTransform(overlap))
tempObjs=cons(tempObj tempObjs)
)
)

procedure(abGetOverlapShape(overlap)
if(listp(overlap) then
when(overlap

      abGetOverlapShape(cadr(overlap))
)

  else
      overlap
  )
)

In some cases dx is 0.05  (please see in output) it is not printing "yes"

Output:

0.050000  0.960000  0.050000  0.050000  0.960000  0.050000  0.050000  0.082000  0.050000 
(db:0x25bce793 db:0x25bce792 db:0x25bce794)

Thank you,

Chandaka

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    This is due to floating point rounding errors, which will happen in any programming language. There have been numerous posts on this and lots of discussion about this in pretty much any programming language which uses IEEE floating point arithmetic. See this post where I describe the problem.

    What it boils down to is that you should never do an exact comparison of two floating point numbers unless you can be absolutely sure that they have originated from the same source. What you should do instead is:

    when(abs(dx-0.05)<1e-4 ...

    Or some small "epsilon" which is smaller than the resolution you need. If your database units are 1000 DBUPerUU (i.e. a database unit is 1nm), then something smaller than 1nm absolute error must be rounding error.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago

    Some cope with these issues by computing coordinates as fixnums instead of flonums.

    It is unfortunate that the SKILL database API uses floats to represent coordinates, which the fab is going to convert back into integers anyway. 

    Aren't they stored in the OA/CDB file as integers as well (hence the "DBUPerUU" constant)?

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

    They are stored as integers in the database, but the APIs deal with user units rather than database units. Having to always deal with database units would be really unfriendly (the OA APIs also work with user units rather than database units).

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Venu Ch
    Venu Ch over 11 years ago

    Thanks Andrew for detailed explanation. It is working now.

    Thank you,

    Venu

    • 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