• 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. Setting up Emacs for SKILL

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 15884
  • 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

Setting up Emacs for SKILL

snezana111
snezana111 over 9 years ago

Hello,

I am fairly new to SKILL and I don't have the option to use SKILL IDE in my version of Cadence.

My current working version of Cadence is IC6.1.6-64b.500.11

I am also novice in EMACS, and I have covered the basics in Common Lisp and SKILL, now I would like to organize my work and I understood there is a way you could use EMACS as an IDE for SKILL. I read through some threads like http://community.cadence.com/cadence_technology_forums/f/48/p/12625/1293515#1293515

but I am not sure how to set it up. What compiler to use in order to use skillMode.el that is mentioned in the link above? (like, SBCL, or can I use some that are built in in EMACS, like IELM?)

What should happen if I load skillMode.el in emacs? And what is the proper way in doing that? Does it mean I can invoke procedures and function from Emacs and get the results i.e. for adding an instance in Schematic to display in the Schematic window?

Any help and advice appreciated

  • Cancel
Parents
  • ebecheto
    ebecheto over 9 years ago
    Dir Jelena,
    I had to fix my skill mode before answering to you.
    indeed, it was not working anymore with emacs > 22, because they removed the possibility in emacs to echo a string to stdout in 'interactive mode' (still feasible in batch mode). They had for some emacsclient reason changed the function `send-string-to-terminal' (how stupid of them).
    So i manage to find a workaround with Linux named piped. But then, it should work too with Allegro skill on Window/mobaxterm (but that's another matter).
    To explain briefly, before i was doing :
    _CADENCE SIDE   ____________________________________
    ipcBeginProcess("emacs" "" (lambda (cid data) evalstring(data)))
    _EMACS SIDE ________________________________________
     (write-region (region-beginning) (region-end) "~/.emacs2icfb.il")  (send-string-to-terminal "load(\"~/.emacs3icfb.il\")")
    And magically a bindkey was executing the code in cadence.... I have a log file with few standard function and when on the line of the function, bindkey C-v will executes it like :
    geOpen(?lib "analogLib" ?cell "vdc" ?view "spectre" ?mode "r")
    would open automatically the windows. (needed Alt-tab though to come back to emacs focus)
    _____WHAT'S UP KNOW_____
    Now i use an intermediate script called "~/Skill/ipcPipe2CAT.sh" that generate a named pipe "/tmp/ipcPipe2CAT_$USER", listen on it and echo to stdout when something comes. Emacs sends a string to it and Cadence (ipcBeginProcess "~/Skill/ipcPipe2CAT.sh" "" 'socketHandler) read from it.

    HERE are the codes to put in you rep $HOME/Skill:
    _emacs_ipcPipe.il_ to load in you ~/cdsinit_personal  (add in your ~/.bashrc : export SKILLDIR=$HOME/Skill)
    defun( socketHandler (ipcId data)
    let((fp res inPort)
    (errset eval(t))
    ; printf("RCV:%L\n" data)
    ; res=load("~/.emacs2icfb.il")
    if(rexMatchp("load" data) then 
    unless(errset(res=load("~/.emacs2icfb.il")  nil)
    error(car(parseString(nth(5 errset.errset)  "*Error* "))
    ))
    else
    inPort=infile("~/.emacs2icfb.il")
    when(inPort while(gets(nextLine inPort) unless((or nextLine=="\n" rexMatchp("^ *;" nextLine) )
    ;removing comment " *;" is not necessary, was only to check warning parenthesis mistake
    ; removing \n is to prevent last res=t ...
    res=evalstring(nextLine))))  close(inPort)
    )
    printf("\nEMACS>");<== can be commented/removed
    printf("%L\n" res)
    fprintf(fp=outfile("~/.virtuoso2emacs.txt") "%L" res) close(fp) ;=> saves resutls in a file for emacs to fetch it if you want
    ))
    
    ipcBeginProcess(strcat(getShellEnvVar("SKILLDIR") "/ipcPipe2CAT.sh") "" 'socketHandler)
    

    HERE is the file:
    _ipcPipe2CAT.sh_

    #!/bin/bash
    # copy paste from http://www.linuxjournal.com/content/using-named-pipes-fifos-bash
    # while debugging load : $> ~/Skill/ipcPipeCAT.sh | tee &
    pipe=/tmp/ipcPipe2CAT_$USER
    
    trap "rm -f $pipe" EXIT
    
    if [[ ! -p $pipe ]]; then mkfifo $pipe; fi
    ret=""
    while true; do
        if read line <$pipe; then
            if [[ "$line" == 'quit' ]]; then break; fi
            ret+=$line
            if [[ "$ret" == *'EOF' ]]; then echo ${ret%EOF}; ret="" ;fi
    #        echo "GOT:$line$()__$ret"
        fi
    done
    
    echo "Reader exiting"
    

    ___now the skillMode.el modifications___ 

    ;; ed modif for emacs2icfb
    
    (if (version< emacs-version "22")
     (defun write2icfb (beg end &optional stuff ) (unless stuff (setq stuff ""))
      (write-region beg end "~/.emacs2icfb.il")
      (write-region (format "\n") t "~/.emacs2icfb.il" t) ; last t means append=tru
      (send-string-to-terminal (format "load(\"%s\") eval(t) " "~/.emacs2icfb.il"))
     )
     (defun write2icfb (beg end &optional stuff ) (unless stuff (setq stuff ""))
      (write-region beg end "~/.emacs2icfb.il")
      (write-region (format "\n") t "~/.emacs2icfb.il" t) ; last t means append=tru
    ;<= ^^ prevent : *WARNING* (reader): too few right parentheses, (')' added at EOF ;<== when load a fine with a function => force load vs read
      (shell-command-to-string (format "echo '%sEOF' > /tmp/ipcPipe2CAT_%s " stuff user-login-name))
     )
    ); if emacs>22 requires an intermediate script to create pipe to stdout
    
    
    (defun send-buffer-to-icfb () "" (interactive) (write2icfb (point-min) (point-max)))
    (defun send-region-to-icfb () "" (interactive) (write2icfb (region-beginning) (region-end) "region"))
    (defun send-func-to-icfb () "" (interactive) (write2icfb (region-beginning) (region-end) "load"))
    (defun send-line-to-icfb   () "" (interactive) (write2icfb (line-beginning-position) (line-end-position)))
    (defun send-line-to-icfb-mv-forward () "" (interactive)
            (write2icfb (line-beginning-position) (line-beginning-position 2) )
            (forward-line 1)
    )
    
    (defun send-function-from-icfb-insert () "" (interactive) 
        (newline) (forward-line -1)
        (push-mark)  (insert ";=> ") 
        (insert-file-contents "~/.virtuoso2emacs.txt")
        (end-of-line) (exchange-point-and-mark)
    )
    
    (define-key skill-mode-map "\C-c\C-f" 'send-func-to-icfb)
    (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-s" 'send-function-from-icfb-insert)

    ___

    Now to load skill mode in emacs, just add in your ~/.emacs :

    (load "~/.emacs.d/skillMode.el")

    Well normally, to prevent un necessary loading of many package you do not always use, you should add:

    ;; (add-to-list 'load-path "~/.emacs.d/")
    ;; (require 'skill-mode)
    ;; (add-to-list 'auto-mode-alist '("\\.il$" . skill-mode))

    up to you.

    Enjoy

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ebecheto
    ebecheto over 9 years ago
    Dir Jelena,
    I had to fix my skill mode before answering to you.
    indeed, it was not working anymore with emacs > 22, because they removed the possibility in emacs to echo a string to stdout in 'interactive mode' (still feasible in batch mode). They had for some emacsclient reason changed the function `send-string-to-terminal' (how stupid of them).
    So i manage to find a workaround with Linux named piped. But then, it should work too with Allegro skill on Window/mobaxterm (but that's another matter).
    To explain briefly, before i was doing :
    _CADENCE SIDE   ____________________________________
    ipcBeginProcess("emacs" "" (lambda (cid data) evalstring(data)))
    _EMACS SIDE ________________________________________
     (write-region (region-beginning) (region-end) "~/.emacs2icfb.il")  (send-string-to-terminal "load(\"~/.emacs3icfb.il\")")
    And magically a bindkey was executing the code in cadence.... I have a log file with few standard function and when on the line of the function, bindkey C-v will executes it like :
    geOpen(?lib "analogLib" ?cell "vdc" ?view "spectre" ?mode "r")
    would open automatically the windows. (needed Alt-tab though to come back to emacs focus)
    _____WHAT'S UP KNOW_____
    Now i use an intermediate script called "~/Skill/ipcPipe2CAT.sh" that generate a named pipe "/tmp/ipcPipe2CAT_$USER", listen on it and echo to stdout when something comes. Emacs sends a string to it and Cadence (ipcBeginProcess "~/Skill/ipcPipe2CAT.sh" "" 'socketHandler) read from it.

    HERE are the codes to put in you rep $HOME/Skill:
    _emacs_ipcPipe.il_ to load in you ~/cdsinit_personal  (add in your ~/.bashrc : export SKILLDIR=$HOME/Skill)
    defun( socketHandler (ipcId data)
    let((fp res inPort)
    (errset eval(t))
    ; printf("RCV:%L\n" data)
    ; res=load("~/.emacs2icfb.il")
    if(rexMatchp("load" data) then 
    unless(errset(res=load("~/.emacs2icfb.il")  nil)
    error(car(parseString(nth(5 errset.errset)  "*Error* "))
    ))
    else
    inPort=infile("~/.emacs2icfb.il")
    when(inPort while(gets(nextLine inPort) unless((or nextLine=="\n" rexMatchp("^ *;" nextLine) )
    ;removing comment " *;" is not necessary, was only to check warning parenthesis mistake
    ; removing \n is to prevent last res=t ...
    res=evalstring(nextLine))))  close(inPort)
    )
    printf("\nEMACS>");<== can be commented/removed
    printf("%L\n" res)
    fprintf(fp=outfile("~/.virtuoso2emacs.txt") "%L" res) close(fp) ;=> saves resutls in a file for emacs to fetch it if you want
    ))
    
    ipcBeginProcess(strcat(getShellEnvVar("SKILLDIR") "/ipcPipe2CAT.sh") "" 'socketHandler)
    

    HERE is the file:
    _ipcPipe2CAT.sh_

    #!/bin/bash
    # copy paste from http://www.linuxjournal.com/content/using-named-pipes-fifos-bash
    # while debugging load : $> ~/Skill/ipcPipeCAT.sh | tee &
    pipe=/tmp/ipcPipe2CAT_$USER
    
    trap "rm -f $pipe" EXIT
    
    if [[ ! -p $pipe ]]; then mkfifo $pipe; fi
    ret=""
    while true; do
        if read line <$pipe; then
            if [[ "$line" == 'quit' ]]; then break; fi
            ret+=$line
            if [[ "$ret" == *'EOF' ]]; then echo ${ret%EOF}; ret="" ;fi
    #        echo "GOT:$line$()__$ret"
        fi
    done
    
    echo "Reader exiting"
    

    ___now the skillMode.el modifications___ 

    ;; ed modif for emacs2icfb
    
    (if (version< emacs-version "22")
     (defun write2icfb (beg end &optional stuff ) (unless stuff (setq stuff ""))
      (write-region beg end "~/.emacs2icfb.il")
      (write-region (format "\n") t "~/.emacs2icfb.il" t) ; last t means append=tru
      (send-string-to-terminal (format "load(\"%s\") eval(t) " "~/.emacs2icfb.il"))
     )
     (defun write2icfb (beg end &optional stuff ) (unless stuff (setq stuff ""))
      (write-region beg end "~/.emacs2icfb.il")
      (write-region (format "\n") t "~/.emacs2icfb.il" t) ; last t means append=tru
    ;<= ^^ prevent : *WARNING* (reader): too few right parentheses, (')' added at EOF ;<== when load a fine with a function => force load vs read
      (shell-command-to-string (format "echo '%sEOF' > /tmp/ipcPipe2CAT_%s " stuff user-login-name))
     )
    ); if emacs>22 requires an intermediate script to create pipe to stdout
    
    
    (defun send-buffer-to-icfb () "" (interactive) (write2icfb (point-min) (point-max)))
    (defun send-region-to-icfb () "" (interactive) (write2icfb (region-beginning) (region-end) "region"))
    (defun send-func-to-icfb () "" (interactive) (write2icfb (region-beginning) (region-end) "load"))
    (defun send-line-to-icfb   () "" (interactive) (write2icfb (line-beginning-position) (line-end-position)))
    (defun send-line-to-icfb-mv-forward () "" (interactive)
            (write2icfb (line-beginning-position) (line-beginning-position 2) )
            (forward-line 1)
    )
    
    (defun send-function-from-icfb-insert () "" (interactive) 
        (newline) (forward-line -1)
        (push-mark)  (insert ";=> ") 
        (insert-file-contents "~/.virtuoso2emacs.txt")
        (end-of-line) (exchange-point-and-mark)
    )
    
    (define-key skill-mode-map "\C-c\C-f" 'send-func-to-icfb)
    (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-s" 'send-function-from-icfb-insert)

    ___

    Now to load skill mode in emacs, just add in your ~/.emacs :

    (load "~/.emacs.d/skillMode.el")

    Well normally, to prevent un necessary loading of many package you do not always use, you should add:

    ;; (add-to-list 'load-path "~/.emacs.d/")
    ;; (require 'skill-mode)
    ;; (add-to-list 'auto-mode-alist '("\\.il$" . skill-mode))

    up to you.

    Enjoy

    • 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