• 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. Sorting Schematic Instance by location

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 143
  • Views 15066
  • 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

Sorting Schematic Instance by location

nosaj
nosaj over 10 years ago

How do I sort schematic instances ( cv~>instHeaders ) based on the X location on the schematic?

  • Cancel
Parents
  • nosaj
    nosaj over 10 years ago

     foreach(ih cv~>instHeaders
       when( !member(ih~>libName skipLibList)
         foreach(inst ih~>instances
           instNameList = cons(inst~>name instNameList)
             printf("\tname=%s\txy=%L\n", inst~>name, inst~>xy)    
         )
       )
     )
     printf("instNameList 1=%L\n", instNameList)
     printf("instNameList s=%L\n", sort(instNameList nil))


     foreach(ih cv~>instHeaders
       when( !member(ih~>libName skipLibList)
         instancesSortedbyX=sort(ih~>instances lambda((a b) xCoord(a~>xy) < xCoord(b~>xy)))
         foreach(inst instancesSortedbyX     
           instNameList2 = cons(inst~>name instNameList2)
             printf("\tname=%s\txy=%L\n", inst~>name, inst~>xy)    
         )
       )
     )

     printf("instNameList2=%L\n", instNameList2)


    OUTPUT :

        name=I0        xy=(-2.1875 1.125)
        name=I5        xy=(2.3125 0.3125)
        name=I2        xy=(-0.375 0.8125)
        name=Iz1    xy=(-1.375 0.0)
        name=I3        xy=(0.25 0.8125)
        name=I4        xy=(1.25 0.0625)
    instNameList 1=("I4" "I3" "Iz1" "I2" "I5" "I0")
    instNameList s=("I0" "I2" "I3" "I4" "I5" "Iz1")
        name=I0        xy=(-2.1875 1.125)
        name=I2        xy=(-0.375 0.8125)
        name=I5        xy=(2.3125 0.3125)
        name=Iz1      xy=(-1.375 0.0)
        name=I3        xy=(0.25 0.8125)
        name=I4        xy=(1.25 0.0625)
    instNameList2=("I4" "I3" "Iz1" "I5" "I2" "I0")

    See the output from the 2nd foreach, the instances were not sorted by x coordinate, correct order should be I0, Iz1, I2, I3, I4, I5.

    Pretty sure I'm not doing it correctly if you got it to work.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • nosaj
    nosaj over 10 years ago

     foreach(ih cv~>instHeaders
       when( !member(ih~>libName skipLibList)
         foreach(inst ih~>instances
           instNameList = cons(inst~>name instNameList)
             printf("\tname=%s\txy=%L\n", inst~>name, inst~>xy)    
         )
       )
     )
     printf("instNameList 1=%L\n", instNameList)
     printf("instNameList s=%L\n", sort(instNameList nil))


     foreach(ih cv~>instHeaders
       when( !member(ih~>libName skipLibList)
         instancesSortedbyX=sort(ih~>instances lambda((a b) xCoord(a~>xy) < xCoord(b~>xy)))
         foreach(inst instancesSortedbyX     
           instNameList2 = cons(inst~>name instNameList2)
             printf("\tname=%s\txy=%L\n", inst~>name, inst~>xy)    
         )
       )
     )

     printf("instNameList2=%L\n", instNameList2)


    OUTPUT :

        name=I0        xy=(-2.1875 1.125)
        name=I5        xy=(2.3125 0.3125)
        name=I2        xy=(-0.375 0.8125)
        name=Iz1    xy=(-1.375 0.0)
        name=I3        xy=(0.25 0.8125)
        name=I4        xy=(1.25 0.0625)
    instNameList 1=("I4" "I3" "Iz1" "I2" "I5" "I0")
    instNameList s=("I0" "I2" "I3" "I4" "I5" "Iz1")
        name=I0        xy=(-2.1875 1.125)
        name=I2        xy=(-0.375 0.8125)
        name=I5        xy=(2.3125 0.3125)
        name=Iz1      xy=(-1.375 0.0)
        name=I3        xy=(0.25 0.8125)
        name=I4        xy=(1.25 0.0625)
    instNameList2=("I4" "I3" "Iz1" "I5" "I2" "I0")

    See the output from the 2nd foreach, the instances were not sorted by x coordinate, correct order should be I0, Iz1, I2, I3, I4, I5.

    Pretty sure I'm not doing it correctly if you got it to work.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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