ipcBeginProcess

Discussion in 'Cadence' started by andmue, Jul 29, 2008.

  1. andmue

    andmue Guest

    Hi, I tried to load a netlist with the ipc functions of skill. So my
    question is, are there some functions in skill which gives me return
    value if the netlist is loaded. Because it takes some times until the
    netlist was loaded.

    Thanks
     
    andmue, Jul 29, 2008
    #1
  2. andmue

    Riad KACED Guest

    Hi,

    Can you please give more details about what you're doing ? a code
    snippet would be great.
    I actually don't understand the meaning of loading netlists with ipcs.
    If you're using the skill 'load' function then this one will return
    't' if the file is successfully loaded but I guess you now this
    already.
    I'm getting a bit confused ... Every little detail would be great.

    Cheers,
    Riad.
     
    Riad KACED, Jul 29, 2008
    #2
  3. andmue

    andmue Guest

    Hi i tried to control spectre simulator with tcl/tk

    I wrote in tcl/tk some functions which i send with ipcBeginProcess
    function of skill to ocean:


    proc TCLSkill_Send {command} {
    puts stdout $command
    flush stdout
    }

    proc TCLSkill_Recv {} {
    set response [read stdin]
    while {! [info complete $response]}{
    append response [read stdin]
    }
    }

    proc SpectreSimulator {} {
    TCLSkill_Send simulator('spectre)
    }

    proc CircuitLoad {path} {
    TCLSkill_Send design("$path")
    }

    proc ResultDirectory {path} {
    TCLSkill_Send resulsDir("$path")


    }

    proc TransientAnalysis {time_length} {
    TCLSkill_Send "analysis('tran ?stop $time_length)"

    }

    proc DcOppointAnalysis {} {
    TCLSkill_Send "analysis('dc ?saveOppoint t)"
    }


    proc RunSimulation {} {
    TCLSkill_Send run()

    }


    proc SelectResult {analysis} {
    TCLSkill_Send selectResult('$analysis)
    }

    proc ReturnValue_DcOppoint {} {
    TCLSkill_Send a=v("vref")
    TCLSkill_Send "ipcWriteProcess(pid sprintf(nil, \"dcOppoint = %L V
    \" a))"
    }


    And I have some tcl interpreter for skill :


    (defun tclInterp (x_childID t_data)
    ;; this function assumes that the data received
    ;; is a skill command list such as (setq a 1)
    ;; convert the data received to a string
    cmd_list = stringToList(t_data)
    if( null(cmd_list) then
    printf("Could not process request from client\n\t%s\n" t_data)
    else
    ;; again even though cmd_list could contain multiple commands
    ;; we just evaluate and execute the first one for now...
    cmd = car(cmd_list)
    ;; print the cmd we execute, so we can see whats going on
    printf("\n********************************\n")
    printf("eval( %L )\n" cmd)
    ;; evaluate the cmd, this will execute the command or
    ;; report an error
    ;; if the command had issues
    result = errset( eval( cmd ) )
    ;; print it so we can see
    printf("\neval_result %L\n")
    printf("********************************\n" result)
    ;; send \n to tcl app indicating that we are done
    ipcWriteProcess(x_childID "\n")
    );if null(cmd_list)
    ) ;tclInterp

    ;;
    --------------------------------------------------------------------
    ;; Convert a string to a list.
    ;;
    ;; The input string might be "(setq a 1) (setq b 2)"
    ;; which would make (quote) fail because it expects a single argument.
    ;; To avoid this, we wrap the input in another level of ().
    ;; The caller should use (foreach) or similar to loop through
    ;; each list from the input string.
    ;;
    ;; For example:
    ;; (setq a '((a b c) (d e f)))
    ;; (sprintf b "%L" a)
    ;; (setq c (car (stringToList b)))
    ;; makes a and c equivalent lists (that is, (equal a c) returns t).
    (defun stringToList (s)
    (let (result)
    ;; Make sure no warnings are hanging about to interfere with
    our test
    ;; after the errsetstring.
    (getWarn)
    ;; Try to convert the string to a list
    (setq result (car (errsetstring (sprintf nil "(quote (%s))" s)
    nil)))
    ;; If we have a warning in the conversion above, return nil.
    ;; Otherwise, return the result of the conversion.
    (if (getWarn) nil result)
    );; let
    );; stringToList


    The problem is when I tried to simulate a netlist, ocean does not wait
    until the netlist is loaded and execute all commands imediatly. So I
    need some command which stop this interprocess comunication until the
    design is loaded.


    tcl commands:

    SpectreSimulator
    CircuiLoad /home/test/netlist
    ResultDirectory /home/test
    DcOppointAnalysis
    RunSimulation
    SelectResult dcOp
    ReturnValue_Dcoppoint


    Thanks
     
    andmue, Jul 29, 2008
    #3
  4. andmue

    S. Badel Guest

    Hi i tried to control spectre simulator with tcl/tk
    I don't understand this sentence... you are saying that you're using ipcBeginProcess to send
    functions from skill to ocean... doesn't seem either like what you're doing or something you would
    like to do anyway...

    By the way, I don't know if it's intentional, but your tcl interpreter is quite overkill since there
    is an existing mechanism to send skill commands from an external process (ipcSkillProcess)
    You don't seem to implement any kind of handshaking. Basically, your TCL program just writes
    commands to a pipe with TCLSkill_Send, but it has no reason to wait until the command is complete.
    Each call should be followed by a TCLSkill_Recv to collect the "\n" that indicates the completion of
    the command.


    Stéphane
     
    S. Badel, Jul 29, 2008
    #4
  5. andmue

    Riad KACED Guest

    Hi,

    That's rather a big listing, isn't it ?! I was expecting a little tiny
    snippet only ;-)
    Well thanks, what you've provided was truly helpful.

    A quick view at your Tcl/Skill code shows a little mistake in the
    skill part (function tclInterp):
    ;;
    printf("\neval_result %L\n")
    printf("********************************\n" result)
    ;;
    The right expression would be:
    ;;
    printf("\neval_result %L\n" result)
    printf("********************************\n")
    ;;

    So if your script gets stuck at this point, it would never execute the
    ipcWriteProcess and then would never send the "\n" back to your TCL.
    Can you please tidy up your skill and launch your entire routine
    afterwards ?

    My advice when writing such a complicated mix-languages thing is to
    make separate testbenches for each bit and then concentrate on the
    interfacing.

    Hope this help !
    Riad.

    PS: I do agree with Stéphane comments but I don't want to argue your
    choices. It's good to take those advices though.
     
    Riad KACED, Jul 30, 2008
    #5
  6. andmue

    andmue Guest

    Hi,

    I'm sorry for my bad english. First thanks for your help. I think
    there is an undestanding mistake. I need a comunication between tcl/tk
    programm and ocean (skill). so I start the tcl/tk programm with
    ipcBeginProcess from ocean.
     
    andmue, Jul 30, 2008
    #6
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.