• 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. Compare syncGroup shape points list

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 144
  • Views 13386
  • 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

Compare syncGroup shape points list

psill000
psill000 over 9 years ago

Working on a script to compare shapes in syncGroups  and sync the layer color coloring.


It compares the points list from the master to the child's group shape using the points transformed from the parent.
The parent is defined by "par" prefixed to the group name

I know there will not be duplicate elements so simple code is all I need:

forall(mem list1 member(mem list2))

When it runs in the script I get a nil, but If I copy and paste the lists to a variables in the CIW and run the procedure I get a t

Running script and printing the list the value of the lists I see they are the same or one is reversed, but the code should still see they are the same.

The code does see some elements as the same but not all

Is there a rounding problem when I use the dbTransformPoint or is there something I am missing.


Code I have tried to match two lists: (probably some others but it was ugly code)

procedure(cmpPtsList0(list1 list2)
    forall(mem list1 member(mem list2))
)

procedure(cmpPtsList1(list1 list2)
    foreach(mem list1
        list2 = remove(mem list2))
null(list2)
)

procedure(cmpPtsList2(list1 list2)
let(    (x1 x2 y1 y2 list3)
foreach(mem1 list1
    x1    = xCoord(mem1)
    y1    = yCoord(mem1)
    foreach(mem2 list2
        x2    = xCoord(mem2)
        y2    = yCoord(mem2)
        when(equal(x1 x2) && equal(y1 y2)
            list2 = remove(mem1 list2)))
    )
null(list2)
))


procedure(cmpPtsList3(list1 list2)
    equal(list1 list2) || equal(list1 reverse(list2))
 )

procedure(cmpPtsListX(listA listB)
let(    ((contentCount makeTable('counts 0)))
    foreach(elem listA contentCount[elem]=contentCount[elem]+1)
    foreach(elem listB contentCount[elem]=contentCount[elem]-1)
    forall(elem contentCount zerop(contentCount[elem]))
  )
)

Paul

  • Cancel
  • theopaone
    theopaone over 9 years ago

    I could not guess why it works interactively but not in a procedure call. Some potential issues:

    1. If one of the lists is reversed, it will not be found in the other list. Try:
      or(member(mem list2) member(reverse(mem) list2))
    2. Potential roundoff, where a number after the transform, because it is floating point, is slightly off.
      1. That is harder to detect, you have to parse the points individually and compare the X's and Y's using an "almost" algorithm.
      2. Have it print out those lists it thinks are not matching and see if there is an issue.

    Ted

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • psill000
    psill000 over 9 years ago

    It must have a rounding error.

    When I convert to the float to string to float the elements match.

    procedure(ptToStrToPt(pt)
    let(    (x y)
    sprintf(x "%.3f" xCoord(pt))
    sprintf(y "%.3f" yCoord(pt))
    list(atof(x) atof(y))
    ); end of let
    ); end of ptToStrToPt

    procedure(ptToStrToPtList(ptList)
    let(    (nList)
    foreach(pt ptList
        nList    = cons(ausPSXstdLib_ptToStrToPt(pt) nList))
        xC(nList)
    nList
    ); end of let
    ); end of ptToStrToPtList

    So now this code works:

    forall(mem list1 member(mem list2))

    Paul

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • theopaone
    theopaone over 9 years ago
    Even if you print out the values, they may look the same but somewhere, about 16 bits out, there may be a difference. It is not an error but a known problem. Your solution fixed that rounding issue.
    • 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