blob: 4b7570a13d3b8c64a3d2659ecd812d53de3d8e28 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Verilog
Bram Moolenaard5ab34b2007-05-05 17:15:44 +00003" Maintainer: Mun Johl <Mun.Johl@emulex.com>
Bram Moolenaar5302d9e2011-09-14 17:55:08 +02004" Last Update: Wed Jul 20 16:04:19 PDT 2011
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02006" quit when a syntax file was already loaded
7if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00008 finish
9endif
10
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020011" Set the local value of the 'iskeyword' option.
12" NOTE: '?' was added so that verilogNumber would be processed correctly when
13" '?' is the last character of the number.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020014setlocal iskeyword=@,48-57,63,_,192-255
Bram Moolenaar071d4272004-06-13 20:20:40 +000015
16" A bunch of useful Verilog keywords
17
18syn keyword verilogStatement always and assign automatic buf
19syn keyword verilogStatement bufif0 bufif1 cell cmos
20syn keyword verilogStatement config deassign defparam design
21syn keyword verilogStatement disable edge endconfig
22syn keyword verilogStatement endfunction endgenerate endmodule
23syn keyword verilogStatement endprimitive endspecify endtable endtask
24syn keyword verilogStatement event force function
25syn keyword verilogStatement generate genvar highz0 highz1 ifnone
26syn keyword verilogStatement incdir include initial inout input
27syn keyword verilogStatement instance integer large liblist
28syn keyword verilogStatement library localparam macromodule medium
29syn keyword verilogStatement module nand negedge nmos nor
30syn keyword verilogStatement noshowcancelled not notif0 notif1 or
31syn keyword verilogStatement output parameter pmos posedge primitive
32syn keyword verilogStatement pull0 pull1 pulldown pullup
33syn keyword verilogStatement pulsestyle_onevent pulsestyle_ondetect
34syn keyword verilogStatement rcmos real realtime reg release
35syn keyword verilogStatement rnmos rpmos rtran rtranif0 rtranif1
36syn keyword verilogStatement scalared showcancelled signed small
37syn keyword verilogStatement specify specparam strong0 strong1
38syn keyword verilogStatement supply0 supply1 table task time tran
39syn keyword verilogStatement tranif0 tranif1 tri tri0 tri1 triand
40syn keyword verilogStatement trior trireg unsigned use vectored wait
41syn keyword verilogStatement wand weak0 weak1 wire wor xnor xor
42syn keyword verilogLabel begin end fork join
43syn keyword verilogConditional if else case casex casez default endcase
44syn keyword verilogRepeat forever repeat while for
45
Bram Moolenaar5302d9e2011-09-14 17:55:08 +020046syn keyword verilogTodo contained TODO FIXME
Bram Moolenaar071d4272004-06-13 20:20:40 +000047
48syn match verilogOperator "[&|~><!)(*#%@+/=?:;}{,.\^\-\[\]]"
49
Bram Moolenaar3982c542005-06-08 21:56:31 +000050syn region verilogComment start="/\*" end="\*/" contains=verilogTodo,@Spell
51syn match verilogComment "//.*" contains=verilogTodo,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
53"syn match verilogGlobal "`[a-zA-Z0-9_]\+\>"
54syn match verilogGlobal "`celldefine"
55syn match verilogGlobal "`default_nettype"
56syn match verilogGlobal "`define"
57syn match verilogGlobal "`else"
58syn match verilogGlobal "`elsif"
59syn match verilogGlobal "`endcelldefine"
60syn match verilogGlobal "`endif"
61syn match verilogGlobal "`ifdef"
62syn match verilogGlobal "`ifndef"
63syn match verilogGlobal "`include"
64syn match verilogGlobal "`line"
65syn match verilogGlobal "`nounconnected_drive"
66syn match verilogGlobal "`resetall"
67syn match verilogGlobal "`timescale"
68syn match verilogGlobal "`unconnected_drive"
69syn match verilogGlobal "`undef"
70syn match verilogGlobal "$[a-zA-Z0-9_]\+\>"
71
72syn match verilogConstant "\<[A-Z][A-Z0-9_]\+\>"
73
Bram Moolenaard5ab34b2007-05-05 17:15:44 +000074syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[bB]\s*[0-1_xXzZ?]\+\>"
75syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[oO]\s*[0-7_xXzZ?]\+\>"
76syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[dD]\s*[0-9_xXzZ?]\+\>"
77syn match verilogNumber "\(\<\d\+\|\)'[sS]\?[hH]\s*[0-9a-fA-F_xXzZ?]\+\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000078syn match verilogNumber "\<[+-]\=[0-9_]\+\(\.[0-9_]*\|\)\(e[0-9_]*\|\)\>"
79
Bram Moolenaar3982c542005-06-08 21:56:31 +000080syn region verilogString start=+"+ skip=+\\"+ end=+"+ contains=verilogEscape,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000081syn match verilogEscape +\\[nt"\\]+ contained
82syn match verilogEscape "\\\o\o\=\o\=" contained
83
84" Directives
85syn match verilogDirective "//\s*synopsys\>.*$"
86syn region verilogDirective start="/\*\s*synopsys\>" end="\*/"
87syn region verilogDirective start="//\s*synopsys dc_script_begin\>" end="//\s*synopsys dc_script_end\>"
88
89syn match verilogDirective "//\s*\$s\>.*$"
90syn region verilogDirective start="/\*\s*\$s\>" end="\*/"
91syn region verilogDirective start="//\s*\$s dc_script_begin\>" end="//\s*\$s dc_script_end\>"
92
93"Modify the following as needed. The trade-off is performance versus
94"functionality.
Bram Moolenaar3982c542005-06-08 21:56:31 +000095syn sync minlines=50
Bram Moolenaar071d4272004-06-13 20:20:40 +000096
97" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020098" Only when an item doesn't have highlighting yet
99command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200101" The default highlighting.
102HiLink verilogCharacter Character
103HiLink verilogConditional Conditional
104HiLink verilogRepeat Repeat
105HiLink verilogString String
106HiLink verilogTodo Todo
107HiLink verilogComment Comment
108HiLink verilogConstant Constant
109HiLink verilogLabel Label
110HiLink verilogNumber Number
111HiLink verilogOperator Special
112HiLink verilogStatement Statement
113HiLink verilogGlobal Define
114HiLink verilogDirective SpecialComment
115HiLink verilogEscape Special
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200117delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118
119let b:current_syntax = "verilog"
120
121" vim: ts=8