( ESNUG 325 Item 9 ) ---------------------------------------------- [8/18/99]

Subject: ( ESNUG 324 #14 )  Some Useful Dc_shell & Makefile Vim Syntax Files

> I am looking for vim syntax files for dc_shell (script and log) and
> others EDA tools syntax files.
>
>     - Benoit Durand
>       STMicroelectronics


From: Gzim Derti <gderti@intrinsix.com>

Hi John,

I started playing with VIM not long ago and wanted to pretty up what I was
seeing in my Synopsys scripts, so I started to generate a rudimentary .vim
syntax file for Synopsys tools.

I basically bastardized the syntax file for another language and added in
the comment definitions from C-language (seems to work for me).

Remember to also add an entry in the /usr/local/share/vim/syntax/syntax.vim
language definition file so that vim knows that the new synopsys.vim
file exists.  Here's what my entry looks like...

  " Synopsys
  au BufNewFile,BufRead *.syn,*.scr,*.pt,*synopsys* so $VIM/syntax/synopsys.vim


NOTE: that the 'au' line above is a single line!!!!

I've added most of the commands that I've run into so far.  More can and
probably will be added in the future as they present themselves.  I also was
running into issues when trying to define "syn match" rather than "syn
keyword" using regular expressions so I just defaulted to using keywords
for everything.

One final note, I've been using vim -g -fg white -bg black to make things
stand out better.  I find that it's also a little easier on my eyes after
staring at the tube all day... but YMMV!!

    - Gzim Derti
      Intrinsix Corp.                                 Rochester, NY


filename="synopsys.vim"

" Vim syntax file
" Language: Synopsys	
" Maintainer:	<vacancy>
" Credits:	Stephan Hegel <ea273@fen.baynet.de>
"		Czo (Olivier Sirol) <sirol@cao-vlsi.ibp.fr>
" $Id: synop.vim,v 1.4 1998/03/28 19:37:33 steve Exp $

" Remove any old syntax stuff hanging around
syn clear

" case is not significant
syn case ignore

" Synopsys keywords
syn keyword synopStatement dc_shell

syn keyword synopStatement analyze elaborate
syn keyword synopStatement include echo read write compile

syn keyword synopStatement alias
syn keyword synopStatement all_connected

syn keyword synopStatement change_names
syn keyword synopStatement characterize write_script
syn keyword synopStatement check_design
syn keyword synopStatement current_design current_instance
syn keyword synopStatement create_design create_cell create_port create_net
syn keyword synopStatement connect_net
syn keyword synopStatement create_clock

syn keyword synopStatement designer
syn keyword synopStatement company
syn keyword synopStatement disconnect_net

syn keyword synopStatement echo_include_commands

syn keyword synopStatement filter find 

syn keyword synopStatement get_unix_variable
syn keyword synopStatement get_attribute

syn keyword synopStatement link uniquify quit

syn keyword synopStatement remove_license remove_design remove_variable remove_port
syn keyword synopStatement remove_input_delay
syn keyword synopStatement remove_attribute
syn keyword synopStatement report_timing
syn keyword synopStatement report_reference
syn keyword synopStatement report_transitive_fanout
syn keyword synopStatement report_net report_cell report_constraint report_clock report_port
syn keyword synopStatement reset_design

syn keyword synopStatement set_operating_conditions
syn keyword synopStatement set_max_capacitance set_max_fanout set_max_area
syn keyword synopStatement set_attribute
syn keyword synopStatement set_input_delay set_output_delay
syn keyword synopStatement set_critical_range set_output_delay
syn keyword synopStatement set_fix_multiple_port_nets
syn keyword synopStatement set_wire_load
syn keyword synopStatement set_scan_configuration set_signal_type check_test
syn keyword synopStatement set_disable_timing
syn keyword synopStatement set_dont_touch_network set_dont_touch
syn keyword synopStatement set_dont_use set_drive set_fix_hold set_load
syn keyword synopStatement set_max_delay set_min_delay
syn keyword synopStatement set_false_path
syn keyword synopStatement syn_flatten

syn keyword synopStatement synthetic_library

syn keyword synopStatement ungroup
syn keyword synopStatement update_timing

syn keyword synopStatement verilogOut_no_tri
syn keyword synopStatement verilogout_equation
syn keyword synopStatement hdlout_internal_busses
syn keyword synopStatement bus_inference_style
syn keyword synopStatement define_name_rules
syn keyword synopStatement default_name_rules

syn keyword synopStatement hdlin_latch_synch_set_reset
syn keyword synopStatement hdlin_use_cin

syn keyword synopStatement write_name_nets_same_as_ports

syn keyword synopStatement if else endif for foreach end switch case breaksw default endsw break
syn keyword synopStatement while set unset sleep
syn keyword synopStatement touch grep awk rm mv date print sh cat cp chmod mkdir ps wc

syn keyword synopBoolean true false

" floating numbers
syn match synopNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>"
syn match synopNumber "-\=\<\d\+\.\d\+\>"
syn match synopNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\="
syn match synopNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="
" integer numbers
syn match synopNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>"
syn match synopNumber "-\=\<\d\+\>"
syn match synopNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\="
syn match synopNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="

syn match synopCharacter "\'[&><=:+\-*\/().,;\'$#|~!%@?\^\[\]{}\\a-z0-9 ]\'"
syn match synopComment "/\*.*$"
syn match synopComment "\*/.*$"
syn match synopComment "\".*\""
syn match synopSpecial "[{}().,;/]"
syn match synopOperator "\!="
syn match synopOperator "=="
syn match synopOperator "{}"
syn match synopOperator "="
syn match synopOperator "+"
syn match synopOperator ">"
syn match synopOperator ">>"
syn match synopOperator "<<"
syn match synopOperator "|"
syn match synopOperator "\$"
syn match synopOperator "\$<"
syn match synopOperator "-\w\s"
syn match synopAttribute "\s-\w\+\>"

if exists("c_comment_strings")
  " A comment can contain cString, cCharacter and cNumber.
  " But a "*/" inside a cString in a cComment DOES end the comment!  So we
  " need to use a special type of cString: cCommentString, which also ends on
  " "*/", and sees a "*" at the start of the line as comment again.
  " Unfortunately this doesn't very well work for // type of comments :-(
  syntax match cCommentSkip   contained "^\s*\*\($\|\s\+\)"
  syntax region cCommentString   contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
  syntax region cComment2String  contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
  syntax region cComment   start="^/\*" end="\*/" contains=cTodo,cCommentString,cCharacter,cNumber,cFloat,cSpaceError
  syntax match  cComment   "//.*" contains=cTodo,cComment2String,cCharacter,cNumber,cSpaceError
else            
  syn region   cComment start="^/\*" end="\*/" contains=cTodo,cSpaceError
  syn match cComment "//.*" contains=cTodo,cSpaceError
endif           
syntax match   cCommentError  "\*/"

if !exists("did_synops_syntax_inits")
  let did_synops_syntax_inits = 1
  " The default methods for highlighting. Can be overridden later
  hi link synopStatement Statement
  hi link synopBoolean   String
  hi link synopComment   Comment
  hi link synopNumber    String
  hi link synopCharacter String
  hi link synopSpecial   Special
  hi link synopOperator  Type
  hi link synopAttribute Type
  hi link cCommentError cError
  hi link cCommentString cString
  hi link cComment2String cString
  hi link cCommentSkip  cComment
  hi link cString String
  hi link cComment   Comment

endif

let b:current_syntax = "synop"

" vim: ts=8

         ----    ----    ----    ----    ----    ----   ----

From: Claudio Fleiner <claudio@fleiner.com>

Enclosed below is a Vim file to use for editing/creating makefiles.

    - Claudio Fleiner


" Vim syntax file
" Language:	Makefile
" Maintainer:	Claudio Fleiner <claudio@fleiner.com>
" URL:		http://www.fleiner.com/vim/syntax/make.vim
" Last change:	1999 June 16

" Remove any old syntax stuff hanging around
syn clear

" This file makes use of the highlighting "Function", which is not defined
" in the normal syntax.vim file yet.

" some directives
syn match makePreCondit	"^\s*\(ifeq\>\|else\>\|endif\>\|define\>\|endef\>\|ifneq\>\|ifdef\>\|ifndef\>\)"
syn match makeInclude	"^\s*include"
syn match makeStatement	"^\s*vpath"
syn match makeOverride	"^\s*override"
hi link makeOverride makeStatement

" Microsoft Makefile specials
syn case ignore
syn match makeInclude	"^!\s*include"
syn match makePreCondit "!\s*\(cmdswitches\>\|error\>\|message\>\|include\>\|if\>\|ifdef\>\|ifndef\>\|else\>\|elseif\>\|else if\>\|else\s*ifdef\>\|else\s*ifndef\>\|endif\>\|undef\>\)"
syn case match

" make targets
syn match makeSpecTarget	"^\.SUFFIXES"
syn match makeSpecTarget	"^\.PHONY"
syn match makeSpecTarget	"^\.DEFAULT"
syn match makeSpecTarget	"^\.PRECIOUS"
syn match makeSpecTarget	"^\.IGNORE"
syn match makeSpecTarget	"^\.SILENT"
syn match makeSpecTarget	"^\.EXPORT_ALL_VARIABLES"
syn match makeSpecTarget	"^\.KEEP_STATE"
syn match makeImplicit	        "^\.\w\+\.\w\+\s*:[^=]"me=e-2
syn match makeImplicit	        "^\.\w\+\.\w\+\s*:$"me=e-1
syn match makeTarget		"^\w[A-Za-z0-9_./\t -]*:[^=]"me=e-2
syn match makeTarget		"^\w[A-Za-z0-9_./\t -]*:$"me=e-1

" Statements / Functions (GNU make)
syn match makeStatement contained "(subst"ms=s+1
syn match makeStatement contained "(addprefix"ms=s+1
syn match makeStatement contained "(addsuffix"ms=s+1
syn match makeStatement contained "(basename"ms=s+1
syn match makeStatement contained "(dir"ms=s+1
syn match makeStatement contained "(filter"ms=s+1
syn match makeStatement contained "(filter-out"ms=s+1
syn match makeStatement contained "(findstring"ms=s+1
syn match makeStatement contained "(firstword"ms=s+1
syn match makeStatement contained "(foreach"ms=s+1
syn match makeStatement contained "(join"ms=s+1
syn match makeStatement contained "(notdir"ms=s+1
syn match makeStatement contained "(origin"ms=s+1
syn match makeStatement contained "(patsubst"ms=s+1
syn match makeStatement contained "(shell"ms=s+1
syn match makeStatement contained "(sort"ms=s+1
syn match makeStatement contained "(strip"ms=s+1
syn match makeStatement contained "(suffix"ms=s+1
syn match makeStatement contained "(wildcard"ms=s+1
syn match makeStatement contained "(word"ms=s+1
syn match makeStatement contained "(words"ms=s+1

" some special characters
syn match makeSpecial	"^\s*[@-]\+"
syn match makeNextLine	"\\$"

" identifiers
syn match makeIdent	"\$([^)]*)" contains=makeStatement
syn match makeIdent	"\$\$\w*"
syn match makeIdent	"\$[^({]"
syn match makeIdent	"\${[^}]*}"
syn match makeIdent     "^\s*\a\w*\s*[:+?!]="me=e-2
syn match makeIdent	"^\s*\a\w*\s*="me=e-1
syn match makeIdent	"%"

" Errors
syn match makeError     "^ \+\t"
syn match makeError     "^ \{8\}[^ ]"me=e-1
syn region makeIgnore	start="\\$" end="^." end="^$" contains=ALLBUT,makeError

" Comment
syn match  makeComment	"#.*$"

" match escaped quotes and any other escaped character
" except for $, as a backslash in front of a $ does
" not make it a standard character, but instead it will
" still act as the beginning of a variable
" The escaped char is not highlightet currently
syn match makeEscapedChar 	"\\[^$]"


syn region  makeDString start=+"+  skip=+\\"+  end=+"+  contains=makeIdent
syn region  makeSString start=+'+  skip=+\\'+  end=+'+  contains=makeIdent
syn region  makeBString start=+`+  skip=+\\`+  end=+`+  contains=makeIdent,makeSString,makeDString,makeNextLine

if !exists("did_makefile_syntax_inits")
  let did_makefile_syntax_inits = 1
  hi link makeNextLine	makeSpecial
  hi link makeSpecTarget	Statement
  hi link makeImplicit	Function
  hi link makeTarget	Function
  hi link makeInclude	Include
  hi link makePreCondit	PreCondit
  hi link makeStatement	Statement
  hi link makeIdent	Identifier
  hi link makeSpecial	Special
  hi link makeComment	Comment
  hi link makeDString	String
  hi link makeSString	String
  hi link makeBString	Function
  hi link makeError     Error
endif

let b:current_syntax = "make"

" vim: ts=8



 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)