Home > Community > Forums > Custom IC SKILL > typecasting in cadence SKILL

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 typecasting in cadence SKILL 

Last post Thu, Sep 27 2012 6:37 AM by Andrew Beckett. 6 replies.
Started by Aditya A S V 24 Sep 2012 04:47 AM. Topic has 6 replies and 1591 views
Page 1 of 1 (7 items)
Sort Posts:
  • Mon, Sep 24 2012 4:47 AM

    typecasting in cadence SKILL Reply

    Hi All,

    I have a list of string values representing the IPC id's submitted using SKILL.

    eg: ipcList = ("ipc:15" "ipc:16" "ipc:20") etc,

    I would like to query their status using ipcIsAliveProcess() and ipcReadProcess().

    ipcStatus = ipcIsAliveProcess(nth(0 ipcList)),

     but, I'm unable to do so as the datatypes do not match. Is there a way I can convert these "string" data values to "o_childId" type. Kindly guide me in solving this prolem.

    Thanks in advance,

    Aditya.

    • Post Points: 20
  • Mon, Sep 24 2012 4:57 AM

    Re: typecasting in cadence SKILL Reply

    Aditya,

    You can't. Why did you convert them to strings in the first place? ipc:N is just the print representation of an IPC ID, it's not the ID itself. The IPC ID is a specific object type, and as far as I know there's no API (public or private) to convert from a number or string into the corresponding IPC ID.

    If you store them as their original object types - even as a  list of them - then you can use them directly

    listOfIpcIds=nil
    for(i 1 10
      listOfIpcIds=cons(ipcBeginProcess("sleep 100") listOfIpcIds)
    )

    then you can do

    statuses=foreach(mapcar ipcId listOfIpcIds
      ipcIsAliveProcess(ipcId)
    )

    Regards,

    Andrew.

    • Post Points: 20
  • Mon, Sep 24 2012 6:27 AM

    Re: typecasting in cadence SKILL Reply

     

    Hi Andrew,

    Thank you for your quick reply.

    The code is a part of much larger, GUI based script. It actually submits and moitors the various jobs given by the user. I am basically storing the jobs and their corresponding ipcIds as choices inside a report field "hiCreateReportField" as passing values becomes easy and I can minimise my "variables" count (in my opinion), but report field takes in only string, float and int as values. Hence the string list.

    My typical Report Field display in my GUI,

     Sl.No       Cell Name     Job Name      Job Status

        1            NandGate         DRC           Running

        2            NorGate            LVS           Complete

        3            Inverter              DRC            Running

    And, If I cannot convert the string to other dataTypes, then I
    guess I will have to maintain a separate list variable to work on and
    then pass it to the GUI report field as choices.



    Thank a lot :)

    Aditya.

    • Post Points: 20
  • Mon, Sep 24 2012 6:45 AM

    Re: typecasting in cadence SKILL Reply

    Aditya.

    You can avoid having to have a global variable for this by storing the mapping as a property on the field or the form. For example:

    reportField->ipcStringToIdMappingTable=...

    You can add whatever user-defined properties on the form or field objects as you wish. This could be a simple hash table (e.g. association table produced using makeTable()).

    Regards,

    Andrew

    • Post Points: 20
  • Mon, Sep 24 2012 10:39 PM

    Re: typecasting in cadence SKILL Reply

    Andrew, 

    Thank you for you inpus, but I am not really sure how to implement the suggestion you have put forward. Could you kindly provide me with some more insight, perhaps a snippet code might do the trick.

     Thanks,

    Aditya.

    • Post Points: 20
  • Thu, Sep 27 2012 6:33 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 396
    • Points 7,445
    Re: typecasting in cadence SKILL Reply

    At some point in your code you have the original ipc ids before you convert them to strings for your report field. So let's say you have the following:

    ipcIds = list(of some ipc ids)
    ipcTable = makeTable("ipcIds" nil)
    foreach(ipcId ipcIds
        sprintf(ipcString "%L" ipcId)
        ipcTable[ipcString] = ipcId
    )

    Then you can store this either on your form or your report field:
    form->ipcTable = ipcTable
    or
    form->reportField->ipcTable = ipcTable

    When your Skill code that reads the currently selected item in the report field needs to know the original ipcId, you can get it from the table. First, get the ipcString from the appropriate column of the selected item in the report field, then use this:

    ipcId = form->ipcTable[ipcString]

    This is a great way to store data without having to create a lot of global variables.

    I hope this helps.

    Derek

    • Post Points: 20
  • Thu, Sep 27 2012 6:37 AM

    Re: typecasting in cadence SKILL Reply

    Thanks Derek - the day job has been preventing me from giving much more than 1 line answers during the last couple of days!

    Andrew.

    • Post Points: 5
Page 1 of 1 (7 items)
Sort Posts:
Started by Aditya A S V at 24 Sep 2012 04:47 AM. Topic has 6 replies.