• 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. difficulty in understanding the code from sklanguser page...

Stats

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

difficulty in understanding the code from sklanguser page 372 - 382

Adhil
Adhil over 13 years ago
Hi Please refer the code taken from sklanguser( cadence skill language user guide ) page 377 - 382. i understand how to use classes, but i dont understand this code. defmethod( Update (( obj IntersectionTwoLines_Point )) printf( "Figure out my x & y from Lines %L %L\n" obj->L1 obj->L2 ) let(( A1 B1 C1 A2 B2 C2 det ) A1 = obj->L1->A B1 = obj->L1->B C1 = obj->L1->C A2 = obj->L2->A B2 = obj->L2->B C2 = obj->L2->C det = A1*B2-A2*B2 when( det == 0 error( "Can not intersect two parallel lines\n") ) obj->x = ((-C1)*B2-(-C2)*B1)*1.0/det obj->y = (A1*(-C1)-A2*(-C1))*1.0/det ) callNextMethod( obj ) ) where the A B & C are clearly variables of the class Line. they cannot be accessed by IntersectionTwoLines_Point which is a subclass of "Point" a sibling class of "Line" (refer the pages i sent you you will understand). how is A1 = obj->L1->A B1 = obj->L1->B C1 = obj->L1->C A2 = obj->L2->A B2 = obj->L2->B C2 = obj->L2->C possible? Adhil
  • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Adhil,

    A little hard to read due to the formatting (perhaps you were using Chrome - this forum doesn't seem to work very well with Chrome).

    Anyway, the answer is in the function make_IntersectionTwoLines_Point(). This is an argument that takes two line objects, and creates an instance of the IntersectionTwoLines_Point class, with L1 and L2 set to the two line objects. Each line object is of class Line or one of its subclasses, and so have slots A, B and C. Thus the newly created object from this function has obj->L1->A etc.

    Hope that clarifies things.

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Adhil
    Adhil over 13 years ago

    Hi Andrew,

    ok here is IntersectionTwoLines_ Point

    defclass( IntersectionTwoLines_Point ( Point )

    (

    ( L1  @initarg  L1)
    ( L2  @initarg  L2)

    ))

    this is the Line class

    defclass( ( GeometricObject ) 

    (

    ( A )
    ( B )
    ( C )

    ))

    therefore how do the two slots in IntersectionTwoLines_Point store the lines?

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago
    As I said in my last reply, look in the function make_IntersectionTwoLines_Point(). This creates an instance of the object and fills in the L1 and L2 slots with the two line objects, and each of these has an A, B and C slot.

    Andrew
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Adhil
    Adhil over 13 years ago

    Hi Andrew

     I just tested it out.... I  get it thanks alot!!

     Adhil

    • 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