• 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. IPC communication between Python and Cadence

Stats

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

IPC communication between Python and Cadence

Vijay Srini
Vijay Srini over 14 years ago

Hi All,

 I am trying to open a IPC channel between python and cadence. I managed to get one way communication from either to the other, but unable to get two way communication.

 Please help to point me in the right direction!

 

 Thanks in advance,

 

Vijay

  • Cancel
Parents
  • dmay
    dmay over 14 years ago

    I've done it this way:

    Skill:
    pyIpc = ipcBeginProcess("my.py " "" 'myIpcDataHandler 'myIpcErrHandler 'myIpcFinishHandler "/tmp/py.log")
    procedure(myIpcDataHandler(ipcId data)
      let((result)
        ;printf("in myIpcDataHandler with %L\n" data)
        foreach(d parseString(data "\n")
            unless(errset(result=evalstring(d))
                 printf("ERROR: %L\n" errset.errset)
                 ipcWriteProcess(ipcId sprintf(nil "ERROR %L\n" errset.errset))
            ) ; unless
        )
      )
    )

    procedure(myIpcErrHandler(ipcId data)
        println(list("ERROR: myIpcErrHandler called with:" ipcId data))
    )

    procedure(myIpcFinishHandler(ipcId data)
      let((exitStatus)
        printf("Finished at %s: %L %L  " getCurrentTime() ipcId data)
        exitStatus = ipcGetExitStatus(ipcId)
        printf("Return value = %L\n" exitStatus)
        if(exitStatus==0 then
            printf("The IPC call has finished!!\n")
        else
            printf("**ERROR: operation failed\n")
        )
      )
    )

    procedure(mySkillCommand(data)
        println(data)
        ipcWriteProcess(pyIpc "Skill says hello")
    )

    Python file my.py:
    import sys
    data = 'Hello from the Python world'
    sys.stdout.write('mySkillCommand("%s")\n' % data)
    sys.stdout.flush()
    returnData = sys.stdin.readline()
    #Write to a file since stdout goes to Cadence
    outFile = open('/tmp/myPy.out','w')   
    outFile.writelines( returnData )
    outFile.close()

    When done, /tmp/py.log shows commands sent from Python to skill through stdout and /tmp/myPy.out shows the Skill response.

    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • dmay
    dmay over 14 years ago

    I've done it this way:

    Skill:
    pyIpc = ipcBeginProcess("my.py " "" 'myIpcDataHandler 'myIpcErrHandler 'myIpcFinishHandler "/tmp/py.log")
    procedure(myIpcDataHandler(ipcId data)
      let((result)
        ;printf("in myIpcDataHandler with %L\n" data)
        foreach(d parseString(data "\n")
            unless(errset(result=evalstring(d))
                 printf("ERROR: %L\n" errset.errset)
                 ipcWriteProcess(ipcId sprintf(nil "ERROR %L\n" errset.errset))
            ) ; unless
        )
      )
    )

    procedure(myIpcErrHandler(ipcId data)
        println(list("ERROR: myIpcErrHandler called with:" ipcId data))
    )

    procedure(myIpcFinishHandler(ipcId data)
      let((exitStatus)
        printf("Finished at %s: %L %L  " getCurrentTime() ipcId data)
        exitStatus = ipcGetExitStatus(ipcId)
        printf("Return value = %L\n" exitStatus)
        if(exitStatus==0 then
            printf("The IPC call has finished!!\n")
        else
            printf("**ERROR: operation failed\n")
        )
      )
    )

    procedure(mySkillCommand(data)
        println(data)
        ipcWriteProcess(pyIpc "Skill says hello")
    )

    Python file my.py:
    import sys
    data = 'Hello from the Python world'
    sys.stdout.write('mySkillCommand("%s")\n' % data)
    sys.stdout.flush()
    returnData = sys.stdin.readline()
    #Write to a file since stdout goes to Cadence
    outFile = open('/tmp/myPy.out','w')   
    outFile.writelines( returnData )
    outFile.close()

    When done, /tmp/py.log shows commands sent from Python to skill through stdout and /tmp/myPy.out shows the Skill response.

    Derek

    • 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