3 " Maintainer: Mun Johl <Mun.Johl@emulex.com>
4 " Last Update: Fri Oct 13 11:44:32 PDT 2006
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 " Set the local value of the 'iskeyword' option
16 setlocal iskeyword=@,48-57,_,192-255
18 set iskeyword=@,48-57,_,192-255
21 " A bunch of useful Verilog keywords
23 syn keyword verilogStatement always and assign automatic buf
24 syn keyword verilogStatement bufif0 bufif1 cell cmos
25 syn keyword verilogStatement config deassign defparam design
26 syn keyword verilogStatement disable edge endconfig
27 syn keyword verilogStatement endfunction endgenerate endmodule
28 syn keyword verilogStatement endprimitive endspecify endtable endtask
29 syn keyword verilogStatement event force function
30 syn keyword verilogStatement generate genvar highz0 highz1 ifnone
31 syn keyword verilogStatement incdir include initial inout input
32 syn keyword verilogStatement instance integer large liblist
33 syn keyword verilogStatement library localparam macromodule medium
34 syn keyword verilogStatement module nand negedge nmos nor
35 syn keyword verilogStatement noshowcancelled not notif0 notif1 or
36 syn keyword verilogStatement output parameter pmos posedge primitive
37 syn keyword verilogStatement pull0 pull1 pulldown pullup
38 syn keyword verilogStatement pulsestyle_onevent pulsestyle_ondetect
39 syn keyword verilogStatement rcmos real realtime reg release
40 syn keyword verilogStatement rnmos rpmos rtran rtranif0 rtranif1
41 syn keyword verilogStatement scalared showcancelled signed small
42 syn keyword verilogStatement specify specparam strong0 strong1
43 syn keyword verilogStatement supply0 supply1 table task time tran
44 syn keyword verilogStatement tranif0 tranif1 tri tri0 tri1 triand
45 syn keyword verilogStatement trior trireg unsigned use vectored wait
46 syn keyword verilogStatement wand weak0 weak1 wire wor xnor xor
47 syn keyword verilogLabel begin end fork join
48 syn keyword verilogConditional if else case casex casez default endcase
49 syn keyword verilogRepeat forever repeat while for
51 syn keyword verilogTodo contained TODO
53 syn match verilogOperator "[&|~><!)(*#%@+/=?:;}{,.\^\-\[\]]"
55 syn region verilogComment start="/\*" end="\*/" contains=verilogTodo,@Spell
56 syn match verilogComment "//.*" contains=verilogTodo,@Spell
58 "syn match verilogGlobal "`[a-zA-Z0-9_]\+\>"
59 syn match verilogGlobal "`celldefine"
60 syn match verilogGlobal "`default_nettype"
61 syn match verilogGlobal "`define"
62 syn match verilogGlobal "`else"
63 syn match verilogGlobal "`elsif"
64 syn match verilogGlobal "`endcelldefine"
65 syn match verilogGlobal "`endif"
66 syn match verilogGlobal "`ifdef"
67 syn match verilogGlobal "`ifndef"
68 syn match verilogGlobal "`include"
69 syn match verilogGlobal "`line"
70 syn match verilogGlobal "`nounconnected_drive"
71 syn match verilogGlobal "`resetall"
72 syn match verilogGlobal "`timescale"
73 syn match verilogGlobal "`unconnected_drive"
74 syn match verilogGlobal "`undef"
75 syn match verilogGlobal "$[a-zA-Z0-9_]\+\>"
77 syn match verilogConstant "\<[A-Z][A-Z0-9_]\+\>"
79 syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[bB]\s*[0-1_xXzZ?]\+\>"
80 syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[oO]\s*[0-7_xXzZ?]\+\>"
81 syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[dD]\s*[0-9_xXzZ?]\+\>"
82 syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[hH]\s*[0-9a-fA-F_xXzZ?]\+\>"
83 syn match verilogNumber "\<[+-]\=[0-9_]\+\(\.[0-9_]*\|\)\(e[0-9_]*\|\)\>"
85 syn region verilogString start=+"+ skip=+\\"+ end=+"+ contains=verilogEscape,@Spell
86 syn match verilogEscape +\\[nt"\\]+ contained
87 syn match verilogEscape "\\\o\o\=\o\=" contained
90 syn match verilogDirective "//\s*synopsys\>.*$"
91 syn region verilogDirective start="/\*\s*synopsys\>" end="\*/"
92 syn region verilogDirective start="//\s*synopsys dc_script_begin\>" end="//\s*synopsys dc_script_end\>"
94 syn match verilogDirective "//\s*\$s\>.*$"
95 syn region verilogDirective start="/\*\s*\$s\>" end="\*/"
96 syn region verilogDirective start="//\s*\$s dc_script_begin\>" end="//\s*\$s dc_script_end\>"
98 "Modify the following as needed. The trade-off is performance versus
102 " Define the default highlighting.
103 " For version 5.7 and earlier: only when not done already
104 " For version 5.8 and later: only when an item doesn't have highlighting yet
105 if version >= 508 || !exists("did_verilog_syn_inits")
107 let did_verilog_syn_inits = 1
108 command -nargs=+ HiLink hi link <args>
110 command -nargs=+ HiLink hi def link <args>
113 " The default highlighting.
114 HiLink verilogCharacter Character
115 HiLink verilogConditional Conditional
116 HiLink verilogRepeat Repeat
117 HiLink verilogString String
118 HiLink verilogTodo Todo
119 HiLink verilogComment Comment
120 HiLink verilogConstant Constant
121 HiLink verilogLabel Label
122 HiLink verilogNumber Number
123 HiLink verilogOperator Special
124 HiLink verilogStatement Statement
125 HiLink verilogGlobal Define
126 HiLink verilogDirective SpecialComment
127 HiLink verilogEscape Special
132 let b:current_syntax = "verilog"