IS this a right way of writing SKILL code

Discussion in 'Cadence' started by lokeshraje, May 25, 2009.

  1. lokeshraje

    lokeshraje Guest

    Hi ,
    I wanted to change the name of an INSTANCE and i did it by the
    following way:
    1)First i have to select the instance in the layout that i have to
    rename
    2)Copy the following code and paste in the CIW
    leHiEditProp()

    geiPlSetPropValue("editorNum0" "attribute" "Name" "string" "new_name")

    geiPlInvokePlistAction("editorNum0" "done")

    where "new_name" is my new INSTANCE name.

    Athough it seems to work fine, i want to do this quite a large number
    of times .hence i wrote the following procedure

    procedure(change_ROD_name(new_name)
    leHiEditProp()

    geiPlSetPropValue("editorNum0" "attribute" "Name" "string" "new_name")

    geiPlInvokePlistAction("editorNum0" "done")
    );procedure

    But when i try to pass a value for the "new_name" in the procedure
    "change_ROD_name", it gives error.
    *What is the Error in the code?
    *Is this a good way of doing it?.
    *I searched our group and found lot of similar post's but the codes
    given there seems to be complex(atleast for a newbie like me)
    Thanks and regards,
    Lokesh rajendran
     
    lokeshraje, May 25, 2009
    #1
  2. lokeshraje

    I-F AB Guest

    Hi,
    Whether it is the right way to right code or not, I'll let the
    expereinced guys comment on that when they get online.
    But I have a suggestion.
    Using :
    cvID = deGetCellView() /*gets your current
    cell view database*/
    What is a database? It's just an assignment by the tools given to an
    object.
    You get your current cellview, than you can observe properties using
    methods such as:
    cvID~>? /*shows available properties*/ cvID~>?? /*shows
    available properties AND their values*/
    So, just try play around with the properties:
    cvID ~> cellView
    cvID ~> name
    cvID ~> instances
    etc. & you will find that this is quite an easy way to access a
    database & their properties.

    This is similar with cells/instances database. You can use "~>" to
    check their properties.
    cvID ~> instances ~>name
    cvID ~> instances ~>pins
    Or make it simpler with:
    FifthCellInList = nthelem(5 instances ~>name)
    FifthCellInList ~>name
    FifthCellInList ~>pins
    etc. If you want a database of only all the instances in a cellview
    (i.e. no nets, pins, etc.):
    CellList = setof( EACHInst cvID ~> instances
    EACHInst ~> purpose ==
    "cell")
    Here you will get a database list of all cells.
    And you can check their properties with:
    CellList ~> name
    Modifying a property, you can just use this format `CELL_DATABASE` ~>
    `PROPERTY` = `NEW PROPERTY`.
    In our case, for e.g. :
    FifthCellInList ~>name = "NewName5"
    You can run loops for a large no. of cells, use `if-else` consitions,
    etc.

    Regarding 'geiPlSetPropValue' & the rest, I'll have to say I'm not
    familiar with this function.
    And I think it will be better to post the Error message since anybody
    else trying to replicate your code might see a different type of Error
    message.

    How about taking a look at a previous post: "Code for selecting
    Cellnames and Instance Terms" ?
    It might give you some ideas.
    Hope this is helpful enough.

    Best regards,
    I-FAB
     
    I-F AB, May 26, 2009
    #2
  3. lokeshraje

    lokeshraje Guest

    Hi FAB ..Thanks for your reply
    the following is what i did to write my code given in the first post
    (Hope this will help some newbies).
    Whatever task i want to do,(say in this case changing the name of a
    instance) I do it manually by quering and changing its properties
    (i.e., the name).After which I go to my "CDS.log" file and there is a
    record of all the past commands that you worked on(and nice thing is
    its in skill). Hence i copy those and put in a procedure for future
    use...
    In this way i have written more than fifteen bindkeys for my own
    use....
    May be a dumb way of using .. but still it works...

    People please do comment on this and the previous post.

    Thanks FAB once again
     
    lokeshraje, May 26, 2009
    #3
  4. lokeshraje

    lokeshraje Guest

    Hi the following is a simple code that i wrote to change the name of
    an instance :
    here "newname" is the name that you want to keep for the instance
    (renaming)
    ;Hi the following is to change the instance name
    ;Please note that the instance has to be manually pointed/highlighted
    by the user
    ;After selecting the instance for which you want to change the name
    procedure(inst_name_change(newname);Note newname should be in double
    quotes
    cv=geGetSelSet()
    cv~>name=newname
    );proc
    Regards,
    Lokesh rajendran
     
    lokeshraje, May 26, 2009
    #4
  5. lokeshraje

    KB.How Guest

    Hi lokeshr,

    Are you sure this procedure will works? Based on my experience, we
    cannot change an instances name by just changing the name, u will have
    database issue. BUT, if this can works, then should be fine. :)

    Regards,
    How
     
    KB.How, May 26, 2009
    #5
  6. lokeshraje

    lokeshraje Guest

    Hi K.B,
    I have used the procedure and it is working...
    Please do inform me if something weird is happening with the code...
    May be if Andrew or Riad sees this they can comment on it.....
    Thanks and regards,
    Lokesh rajendran.
     
    lokeshraje, May 27, 2009
    #6
  7. Changing an instance name this way is fine. However, bear in mind that your code
    won't work properly if you have more than one thing selected... perhaps you
    should have some error checking in there...

    Perhaps K.B. is thinking of changing the cellName - you can't change the
    cellName this way - you have to change the "master" attribute...

    So perhaps something like:

    procedure(LRchangeInstName(newName)
    let((inst)
    inst=car(setof(fig geGetSelSet() fig~>objType=="inst"))
    when(inst
    inst~>name=newName
    ) ; when
    ) ; let
    ) ; procedure LRchangeInstName

    Note that it's a good idea to give your functions a prefix to avoid clashing
    with other function names. I tend to use "camel" case for my names rather than
    underscores, but that's just a personal preference.

    Also, in your code you used cv as the variable for something that was an
    instance. cv implies it's a cellView, whereas an instance is not the same as a
    cellView. Care with variable names enhances the readability of code.

    Regards,

    Andrew.
     
    Andrew Beckett, May 27, 2009
    #7
  8. lokeshraje

    lokeshraje Guest

    Hi Andrew,
    Thanks for the comment...
    I was playing with your code for minutes together.......
    It is nothing short of awesome......
    Regards,
    Lokesh rajendran.
     
    lokeshraje, May 27, 2009
    #8
  9. lokeshraje

    KB.How Guest

    Thanks Andrew for clarify my doubt.

    Hi Lokeshr,

    DO let us know if you have any concern. Cheers.


    Regards,
    How
     
    KB.How, May 28, 2009
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.