• 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. Finding the lowerleft(x1,y1) and upperright(x2,y2) of a...

Stats

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

Finding the lowerleft(x1,y1) and upperright(x2,y2) of a bounding box

JMCaJHU
JMCaJHU over 16 years ago

 Hi,

I'm new to Cadence and skill.  I've been studying sample code and ultimately need to make procedures that will create instances of different inv, different or gates and other logic gates in a row.  To do this, I plan to find the width of the gate, and stack them side by side.  Is there any code that will let me find a bounding box's x1 and x2?  I can then subtract to find its width and run a for loop that places an instance every n(x2-x1). 

 

I realize there is already a similar question.  I tried that code but it didnt seem to work.

JC 

  • Cancel
Parents
  • skillUser
    skillUser over 16 years ago

     Oops, hit the "Post" button prematurely there.

    Anyway, to continue my thread, the above method may seem cumbersome for just getting the width, but it can be extended to other things. Let's say you wanted to find the left most point of all of the bounding boxes stored in bBoxes, you could iterate over them manually and store the smaller X value of either the lowerleft point or the previous left-most point each iteration, or you could do it in one statement:

      apply('min mapcar('caar bBoxes))
    

    This iterates over each bBox in bBoxes and takes the caar (the car of the car) of each one to find the X ordinate of the lowerleft coordinate and then this list is passed to the min function which returns the lowest X value. Cool huh?

    Also, by the way, don't forget to use lowerLeft() and upperRight() for clarity in your code, but beware that these are simply aliases for the car and cadr functions respectively, they do not check to see if the input is a valid bounding box, they will just expect a list and operate on it, e.g. the following would not cause an error or warning:

      lowerLeft( list( 1 2 3 4 ) ) 

    However, there is a handy function, isBBox() that can be used to validate that you have a correct bounding box.

    Happy coding!

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • skillUser
    skillUser over 16 years ago

     Oops, hit the "Post" button prematurely there.

    Anyway, to continue my thread, the above method may seem cumbersome for just getting the width, but it can be extended to other things. Let's say you wanted to find the left most point of all of the bounding boxes stored in bBoxes, you could iterate over them manually and store the smaller X value of either the lowerleft point or the previous left-most point each iteration, or you could do it in one statement:

      apply('min mapcar('caar bBoxes))
    

    This iterates over each bBox in bBoxes and takes the caar (the car of the car) of each one to find the X ordinate of the lowerleft coordinate and then this list is passed to the min function which returns the lowest X value. Cool huh?

    Also, by the way, don't forget to use lowerLeft() and upperRight() for clarity in your code, but beware that these are simply aliases for the car and cadr functions respectively, they do not check to see if the input is a valid bounding box, they will just expect a list and operate on it, e.g. the following would not cause an error or warning:

      lowerLeft( list( 1 2 3 4 ) ) 

    However, there is a handy function, isBBox() that can be used to validate that you have a correct bounding box.

    Happy coding!

    Lawrence.

    • 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