'VHDL'에 해당하는 글 1건

vim for vhdl

카테고리 없음 2011. 4. 27. 22:28
출처 : http://0x7.ch/vim/vhdl/

학교과제 하다가 찾게되었습니다.

VHDL with Vim

If you intend to code VHDL with Vim, it is a good idea to take some time and set up Vim for VHDL. You can do amazing stuff if you invest a little time (and some features don't even need to be set up - take a look at :help ins-completion for instance).

During a semester project at ETH Zurich, I created some VHDL related Vim settings. They make Vim quite efficient - during my project I was able to do most of the work from within Vim, even running test-benches and doing simulations. I hope they may be useful to others as well and will therefore show you how to set them up.

ctags

First, we need ctags. Since ctags does not support VHDL, I created some simple regular expressions. To use them, copy this ctags-file to ~/.ctags. You also need to set the variable g:tlistvhdlsettings correctly (see my vimrc).

If you don't know what ctags is, look at the ctags homepage.

Taglist plugin

Now that we have ctags working, we can also use the taglist plugin for Vim, which allows to navigate through the code in a nice way. You can find it here.

Code highlighting and indenting

Scripts for highlighting and indenting come with Vim. If you happen to work at the ETH Zurich, you'll probably want to use DZ signal naming conventions and appropriate highlighting. For this, copy the file vhdl.vim to ~/.vim/syntax/. It only seems to work with GVim, which is what I usually used.

Automatic entity declaration and port mapping

For this, I found some scripts on the net and adjusted them to my needs. They are far from perfect, but useful nonetheless. You can find them in the scripts directory.

Automatic code aligning

For code aligning, I wrote some scripts on my own. However, I later discovered a generic Vim align plugin, which does a much better job. You may want to add appropriate key mappings for visual mode (see :help vmap).

Commenting

I use the Enhanced Commentify Plugin for easy commenting of blocks.

vimrc (lots of fun stuff)

The most important thing is of course the .vimrc file itself. It provides useful stuff like

  • automatic template loading
  • Hit F5 to compile and Vim automatically jumps to the relevant line if there is an error (requires a Makefile and you may need to adjust the errorformat)
  • jump between errors with F9 and F10 (also goes nicely with grep, btw.)
  • shortcuts (e.g. write a process name and hit CTRL-E p to create the process body; hit CTRL-j to jump to the mark (requires the jump-function from the vim-latex plugin))
  • abbreviations (e.g. write slv for std_logic_vector)
  • shortcuts for component declaration and instantiation
  • omni-completion is set to syntax-complete
  • automatically update sensitivity lists (this one is a bit dangerous, as it uses the Emacs VHDL-mode and runs Emacs in batch mode - see the comment in the vimrc) file

If you want to know more, just take a look at the the .vimrc file. This one only contains VHDL related settings.

Screenshot

Here's a nice screenshot with some of the features:

Vim rocks!

If you have questions or comments, just drop me a note.



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,