• 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. Sending SKILL commands to a running instance of ICFB

Stats

  • Locked Locked
  • Replies 18
  • Subscribers 145
  • Views 30387
  • 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

Sending SKILL commands to a running instance of ICFB

gsimard
gsimard over 16 years ago

Hi all !

 

 I was wondering if it would be possible to send SKILL instructions to a running instance of ICFB, just as if I was typing them in the console of the ICFB, but from an external process. The idea is to use my favorite editor (emacs) and being able to interact with the ICFB process (sending code, retrieving replies, in the best scenario).

 

Thank you for any advice !

Guillaume

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    I have seen similar issues. Best to contact customer support with the specific examples, or alternatively write the SKILL statements to a file, and then just send load("/path/to/the/file.il") instead - that way you are not over-loading the IPC channel.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Stephane A
    Stephane A over 15 years ago

    Dear Andrew,

    Thank you. I have contacted the customer support and I gave them the little testcase above.

    I will wait for their answer, but your work around of writing the commands to a file should be a robut solution I guess. Thanks for the idea.

    Best regards.
    Stéphane.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Stephane A
    Stephane A over 15 years ago

    Here is the work around that work wery well on the first tests:

     #!/usr/bin/perl

    # load("test.il")

    #Flushes the perl STDOUT buffer after each print:
    $|=1;

    print "cv=deGetEditCellView() ";
    print "cw=hiGetCurrentWindow() ";
    print "geDeleteAllHilightSet(cv) ";
    print "hiZoomIn(cw list(-10:-10 10:10)) ";
    print "hlSetId = geCreateHilightSet(cv \'(\"y1\" \"drawing\")) ";
    print "hlSetId->enable = t ";

    #Draws a disk with thousands of rays.
    #The Skill commands are buffered to a unix temp file. The temp file is
    #then loaded in dfII with a "load" command.
    $output="test_cmd.il";
    open(TMPFILE, ">$output") || die ("*** Error: Can't open $output !\n\n");
    for ($j = 1; $j <= 3.141*2000; $j++) {
      $x2=10*cos($j/1000);
      $y2=10*sin($j/1000);
      print TMPFILE "geAddHilightLine(hlSetId list(0:0 $x2:$y2)) \n";
    }
    close(TMPFILE) || die "Can't close $output !";

    print "load(\"test_cmd.il\") ";
    print "hiRedraw(cw) ";

    Best regards.
    Stéphane.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ebecheto
    ebecheto over 15 years ago

    Thank you so much all of you, my "emacs -> icfb communication" dream is so close to become true !

    Since I know 'skill language, I've always wanted to be able to launch my code direcly from emacs rather than 'middle-click paste' or 'load "myFile.il"' . Like in gnuplot-mode with :'Send line to gnuplot' 'Send line & move forward' ''Send region to gnuplot'' and 'Send buffer to gnuplot. Here I am describing the features I want in gsimard futur skill-mode. Guillaume, could you do that for me please ? I am not asking you, but begging you, imploring you, respecting you so much for sharing this futur skill-mode.el.

    I've heard  a long time ago about a similar feature so called 'gate to opus. But I have never been able to find/use it. I have meerly tried also a former skillmode4.4 made by Jonas jarnestrom. That mode looked very powerfull but had no syntax highlight (or I was using it uncorrecly...). I now use a skillMode.el ; created    07/02/07 by M.Masa, but it is not enough powerfull.

    I am mastering emacs shortcut, but I never write code in emacs lisp (unfortunatly) but it is so similar to skill that I should be able to do so. Actualy skill and emacs-lisp came from the same lisp parser... is that right Andrew ?

    Here coms my contribution : I have done as Stephane A has sugested :

     

    ;; load "test.il" ;; in ICFB
    procedure(socketHandler(ipcId data)
      printf("COMMAND: %L\n" data)
      evalstring(data)
    )
    ipcBeginProcess("emacs" "" 'socketHandler)
    

    loading this file in icfb opens an emacs. I this emacs I open a file.el in Emacs-lisp mode in which I have the following lines :

    (send-string-to-terminal "pwd")
    (send-string-to-terminal " println(\"hello\") \n")
    (send-string-to-terminal "pwd()")
    (send-string-to-terminal " println(\"world\\n\")")
    (send-string-to-terminal " println(\"!\")")
    (send-string-to-terminal " printf(\"Hello\\n\\t World!\")")
    

     Then I 'Evaluate buffer' (or C-x C-e on every line) and ! magic ! icfb prints :

    COMMAND: "pwd println(\"hello\") \npwd()"
    COMMAND: " println(\"world\\n\") println(\"!\") printf(\"Hello\\n\\t World!\")"
    "world\n"
    "!"
    Hello

     Do you see my problem ? First, there is a missing "World!" not printed,icfb expecting a Return or something. Second, I have tobackslash every dbl quote. I suppose it could be treated with some emacs macro (still I don't know how, due to my too few knowledge in emacs-lisp). Third problem : pwd is probably evaluated, but it is not outputed in the icfb window...

    Any hints we be welcomed.

     

    gsimard said:

    To Andrew: Maybe someday I'll come up with my own emacs mode for skill, if that's so I'll release the source code ;)

    I am, as you might have understood, eagerly expexting your release. I will be please to help you to develop such mode Guillaume, but I am more an anlog designer than an emacs geek. Please let me know if I can 'beta test' your code.

     Thanks for this tread.

    ++Ed

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Fassage
    Fassage over 15 years ago

    Hello Everyone,

    Sorry to gate-crash this thread, but i have a related question !

    An external C++ application needs to perform many skill command executions/interrogations within ICFB. Is the asyncronous input/output handler implementation found in the "Interprocess Communication SKILL Functions".pdf manual the best approach to use ?

    In addition, whats the difference between ipcBeginProcess and ipcSkillProcess ? Are there any advantages in using either ? There seems to be little if no good documentation regarding the ipcSkillProcess.

    Many thanks for your valuable time and support in advance.

    Best regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ebecheto
    ebecheto over 15 years ago

    See bellow my example of emacs skill-mode from an existing work of Mr Masar.
    If you launch in icfb the following code :

    procedure(socketHandler(ipcId data)
    when(inPort
        while(gets(nextLine inPort) 
            return(print(evalstring(nextLine)))
        )
        close(inPort))) ipcBeginProcess("emacs ~/Skill/my-log.txt" "" 'socketHandler)

    Then you can send command from a skill file, line by line, function by function, or your entire file,
    directly to icfb by the shortcuts : Ctrl-c-v Ctrl-c-f or Ctrl-c-b
    It needs to have load correctly the skillMode.el file into emacs obviously.
    One little remaining annoying problem is that icfb does not flush the result of the command at every command.
    Andrew, can you help me with that ?

    If for instance ~/Skill/my-log.txt contains :
    x=4;;; There is 3 way of wrinting in skill
    printf "The value of x is %n \n" x    ;; simplest way but wont be clear for a function of functions
    printf("The value of x is %n \n" x)   ;; standard C-like syntax
    (printf "The value of x is %n \n" x)  ;; standart lisp syntax, the recommend way to use it, but people usualy prefer C-like

    Icfb output :
    ipc:2
    4The value of x is 4

    Only after the execution of the third line of 'send-function-to-icfb-mv-forward execution …  I don’t get it.

    I tried to use the socket handler with some function like return, hiFlush … nothing better. Do you think that the problem comes from emacs that does not flush the io-pipe or something, or is it the socketHandler that is not ‘interactive enough’ ?

    I hope with this mode that vi user will switch to emacs : ). Any help is welcomed. Thanks for sharing.
    ++Ed

     





    _ _ _ __ _ _  _ _ _ _ _ _ _ _ _ ___ _ _ _ skillMode.el _ _ _ _ _ _ _ _ _ _ _ _ __ _ _ __ _ __ _ _ _ _ _ __

     

     

      ;--- mode for SKILL ---

    ; created    07/02/07 by M.Masar
    ; modified   10/02/24 by ebecheto : added send-[region/line/buffer]-to-icfb with idea of http://www.cadence.com/community/forums/T/12956.aspx

    ; put this file in the directory ~/.emacs.d/
    ; add the line : (add-to-list 'load-path "~/.emacs.d/")  (load "skillMode.el") ; in your ~/.emacs file
    ; Skill-mode, associated with the .il .ocn and .cdf files
    ; To use the skill mode for another file, use "M-x skill-mode"


    (defvar skill-mode-hook nil)


    (defun skill-indent-line ()
      (interactive) 
      (newline)
      (indent-relative)
    )

    (provide 'skill-indent-line)

    ;; Ed modifs.end
    (setq comment-start ";; ")
    (global-set-key  "\C-cu" 'uncomment-region)
    ;; (global-set-key  "\C-cc" 'comment-region);; ca marchouille
    (global-set-key  [(control c) (control c)] 'comment-region)




    (defvar skill-mode-map
      (let ((skill-mode-map (make-keymap)))
        (define-key skill-mode-map "\C-j" 'skill-indent-line)
        skill-mode-map)
      "Keymap for SKILL major mode")

    ;binding with file endings
    (add-to-list 'auto-mode-alist '("\\.il\\'" . skill-mode))
    (add-to-list 'auto-mode-alist '("\\.ocn\\'" . skill-mode))
    (add-to-list 'auto-mode-alist '("\\.cdf\\'" . skill-mode))




    (defconst skill-font-lock-keywords-1
      (list
           (cons (concat "\\<" (regexp-opt '( "add1" "and" "apply" "argc" "argv" "arrayp" "arrayref" "atof" "atoi" "atom" "band" "begin" "bitfield1" "bitfield"
                                              "blankstrp" "bnand" "bnor" "bnot" "booleanp" "bor" "boundp" "bxnor" "bxor" "case" "caseq" "ceiling" "concat" "cond"
                                              "cons" "constar" "copy" "copyDefstructDeep" "declare" "declareLambda" "declareNLambda" "declareSQNLambda" "define"
                                              "defmacro" "defprop" "defstruct" "defstructp" "defun" "defUserInitProc" "defvar" "do" "dtpr" "eq" "equal" "eqv" "err"
                                              "error" "errset" "errsetstring" "eval" "evalstring" "evenp" "exit" "expandMacro" "fboundp" "fixp" "floatp" "for"
                                              "forall" "foreach" "funcall" "funobj" "gc" "gensym" "geqp" "get" "get_pname" "get_string" "getd" "getFnWriteProtect"
                                              "getFunType" "getq" "getqq" "getVarWriteProtect" "greaterp" "if" "then" "else" "inportp" "inScheme" "inSkill" "integerp"
                                              "intToChar" "isCallable" "isInfinity" "isNaN" "lambda" "leftshift" "leqp" "lessp" "let" "letrec" "letseq" "listp"
                                              "listToVector" "load" "loadi" "loadstring" "makeTable" "makeVector" "map" "mapc" "mapcan" "mapcar" "maplist" "minus"
                                              "minusp" "mod" "modulo" "mprocedure" "needNCells" "negativep" "neq" "nequal" "newline" "nindex" "nlambda" "not"
                                              "nprocedure" "null" "numberp" "oddp" "onep" "openportp" "or" "otherp" "outportp" "pairp" "plist" "plus" "plusp" "portp"
                                              "postdecrement" "postincrement" "predecrement" "preincrement" "procedure" "procedurep" "prog" "prog1" "prog2" "progn"
                                              "putd" "putprop" "putpropq" "putpropqq" "quote" "quotient" "realp" "regExitAfter" "regExitBefore" "remainder"
                                              "remExitProc" "remprop" "return" "rexCompile" "rexExecute" "rexMagic" "rexMatchAssocList" "rexMatchList" "rexMatchp"
                                              "rexReplace" "rexSubstitute" "rightshift" "round" "set" "setarray" "setFnWriteProtect" "setplist" "setq" "setqbitfield1"
                                              "setqbitfield" "setVarWriteProtect" "stringp" "sub1" "sxtd" "symbolp" "symeval" "symstrp" "system" "tablep" "tailp" "times"
                                              "truncate" "type" "typep" "unalias" "unless" "vector" "vectorp" "warn" "when" "which" "while" "xdifference" "xplus"
                                              "xquotient" "xtimes" "zerop" "zxtd" ) t )
                                  "\\>")  'font-lock-keyword-face)
           (cons (concat "\\<" (regexp-opt '("nil" "t") t)  "\\>")  'font-lock-constant-face)

      )
      "Basic SKILL functions - arithmetic&logic operators, type tests, flow control, loops, rounding")


    (defconst skill-font-lock-keywords-2
      (append skill-font-lock-keywords-1
              (list
               (cons (concat "\\<" (regexp-opt '( "append" "append1" "bcdp" "buildString" "caar" "caaar" "caadr" "cadr" "caddr" "cdar" "cddr" "car" "cdr" "cdsGetInstPath"
                                                  "changeWorkingDir" "charToInt" "clearExitProcs" "close" "compress" "defMathConstants" "deleteDir" "deleteFile" "difference"
                                                  "display" "drain" "exists" "fileLength" "fileSeek" "fileTell" "fileTimeModified" "fprintf" "fscanf" "scanf" "sscanf"
                                                  "get_filename" "getc" "getchar" "getDirFiles" "gets" "getWorkingDir" "infile" "instring" "isDir" "isExecutable" "isFile"
                                                  "isFileEncrypted" "isFileName" "isLargeFile" "isLink" "isMacro" "isReadable" "isWritable" "last" "lconc" "length" "lineread"
                                                  "linereadstring" "list" "makeTempFileName" "member" "memq" "memv" "nconc" "ncons" "nth" "nthcdr" "nthelem" "numOpenFiles"
                                                  "outfile" "parseString" "pprint" "print" "printf" "printlev" "println" "read" "readstring" "readTable" "renameFile" "reverse"
                                                  "rplaca" "rplacd" "setcar" "setcdr" "setof" "simplifyFilename" "sort" "sortcar" "sprintf" "strcat" "strcmp" "stringToFunction"
                                                  "stringToSymbol" "stringToTime" "strlen" "strncat" "strncmp" "subst" "substring" "symbolToString" "tconc" "upperCase"
                                                  "vectorToList" "write" "writeTable" "xcons" "xCoord" "yCoord") t )
                                      "\\>")  'font-lock-keyword-face)
               )
      )
      "Additional SKILL functions - mostly string, list and file operations")



    (defconst skill-font-lock-keywords-3
      (append skill-font-lock-keywords-2
              (list
               (cons (concat "\\<" (regexp-opt '("abs" "acos" "addDefstructClass" "alias" "alphalessp" "alphaNumCmp" "asin" "assoc" "assq" "assv" "atan"
                                                 "atan2" "compareTime" "cos" "cputime" "createDir" "csh" "ed" "edi" "edit" "edl" "envobj" "exp" "expt"
                                                 "fix" "float" "floor" "getCurrentTime" "getInstallPath" "getLogin" "getPrompts" "getTempDir" "getShellEnvVar"
                                                 "getSkillPath" "getSkillVersion" "getVersion" "getWarn" "go" "help" "importSkillVar" "index" "log" "log10"
                                                 "lowerCase" "max" "measureTime" "min" "prependInstallPath" "random" "range" "remd" "remdq" "remove" "remq"
                                                 "rindex" "schemeTopLevelEnv" "setPrompts" "setShellEnvVar" "setSkillPath" "sh" "shell" "sin" "sqrt" "srandom"
                                                 "sstatus" "status" "tableToList" "tan" "theEnvironment" "timeToString" "timeToTm" "tmToTime" "vi" "vii" "vil" ) t)

                                      "\\>")  'font-lock-keyword-face) ) )
      "Other SKILL functions")



    (defvar skill-font-lock-keywords skill-font-lock-keywords-3
      "Default highlighting expressions for SKILL mode.")


    (defvar skill-mode-syntax-table
      (let ((skill-mode-syntax-table (make-syntax-table)))
       
       
        ; block comments
        (modify-syntax-entry ?/ ". 14" skill-mode-syntax-table)
        (modify-syntax-entry ?* ". 23" skill-mode-syntax-table)

        ; line comments
        (modify-syntax-entry ?\; "< b" skill-mode-syntax-table)
        (modify-syntax-entry ?\n "> b" skill-mode-syntax-table)

     
       skill-mode-syntax-table)
      "Syntax table for skill-mode")



     
    (defun skill-mode ()
      (interactive)
      (kill-all-local-variables)
      (use-local-map skill-mode-map)
      (set-syntax-table skill-mode-syntax-table)
      ;; Set up font-lock
      (set (make-local-variable 'font-lock-defaults) '(skill-font-lock-keywords))
      ;; Register our indentation function
      (setq major-mode 'skill-mode)
      (setq mode-name "SKILL")
      (run-hooks 'skill-mode-hook))

    (provide 'skill-mode)



    ;; ed modif pour emacs2icfb
    (defun send-buffer-to-icfb () "" (interactive)
    ;;      (write-region (point-min) (point-max) "~/.emacs2icfb.buffer.il");; pas besoin de creer un fichier, il suffit d'envoyer le fichier en cours (buffer)
            (send-string-to-terminal (buffer-file-name)))
    (defun send-region-to-icfb () "" (interactive)
            (write-region (region-beginning) (region-end) "~/.emacs2icfb.region.il")
            (send-string-to-terminal (format "~/.emacs2icfb.region.il")))
    (defun send-line-to-icfb () "" (interactive)
            (write-region (line-beginning-position) (line-end-position) "~/.emacs2icfb.line.il")
            (send-string-to-terminal (format "load(\"%s\") \n" "~/.emacs2icfb.line.il")))
    (defun send-line-to-icfb-mv-forward () "" (interactive)
            (write-region (line-beginning-position) (line-end-position) "~/.emacs2icfb.line.il")
            (send-string-to-terminal "~/.emacs2icfb.line.il")
            (forward-line 1))
    (defun send-function-to-icfb-mv-forward () "" (interactive)
            (write-region (point) (forward-list) "~/.emacs2icfb.function.il")
            (send-string-to-terminal "~/.emacs2icfb.function.il"))



      (define-key skill-mode-map "\C-c\C-b" 'send-buffer-to-icfb)
      (define-key skill-mode-map "\C-c\C-r" 'send-region-to-icfb)
      (define-key skill-mode-map "\C-c\C-l" 'send-line-to-icfb)
      (define-key skill-mode-map "\C-c\C-v" 'send-line-to-icfb-mv-forward)
      (define-key skill-mode-map "\C-c\C-f" 'send-function-to-icfb-mv-forward)

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 10 years ago

    I'm with Analog Devices and I'm trying to use this code to make our back-annotation of node voltages occur automatically when a simulation is finished. We use our own in-house simulator, not ADE and back-annotation is not automatic. We have to remember to click a button in a form to update the back-annotation. This can be confusing, having used ADE for most of my career (I am new to ADI).

    I got it to work with one Cadence session, but when two are open (ie, icfb) the annotation always occurs in the first session, the second one doesn't do anything. I would have thought that a another socket would be opened that would 'connect' a given icfb with the skillServer.il script.

    The documentation in the skillServer TCL script implies that it might work (multiple channels), but maybe that's from within the same icfb session.

    Any recommendations? I can post my code if needed, but it may complicate things because of the weird interface I need between our simulator and icfb.

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 10 years ago
    I thought I had quoted Andrew's code in the reply but I guess I didn't. That's what I'm referring to when I say 'this code'.
    • 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