7
|
1 " Vim syntax file
|
|
2 " Language: Verilog
|
|
3 " Maintainer: Mun Johl <mun_johl@sierralogic.com>
|
316
|
4 " Last Update: Tue Jun 7 14:27:10 PDT 2005
|
7
|
5
|
|
6 " For version 5.x: Clear all syntax items
|
|
7 " For version 6.x: Quit when a syntax file was already loaded
|
|
8 if version < 600
|
|
9 syntax clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 " Set the local value of the 'iskeyword' option
|
|
15 if version >= 600
|
|
16 setlocal iskeyword=@,48-57,_,192-255
|
|
17 else
|
|
18 set iskeyword=@,48-57,_,192-255
|
|
19 endif
|
|
20
|
|
21 " A bunch of useful Verilog keywords
|
|
22
|
|
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
|
|
50
|
|
51 syn keyword verilogTodo contained TODO
|
|
52
|
|
53 syn match verilogOperator "[&|~><!)(*#%@+/=?:;}{,.\^\-\[\]]"
|
|
54
|
316
|
55 syn region verilogComment start="/\*" end="\*/" contains=verilogTodo,@Spell
|
|
56 syn match verilogComment "//.*" contains=verilogTodo,@Spell
|
7
|
57
|
|
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_]\+\>"
|
|
76
|
|
77 syn match verilogConstant "\<[A-Z][A-Z0-9_]\+\>"
|
|
78
|
|
79 syn match verilogNumber "\(\<\d\+\|\)'[bB]\s*[0-1_xXzZ?]\+\>"
|
|
80 syn match verilogNumber "\(\<\d\+\|\)'[oO]\s*[0-7_xXzZ?]\+\>"
|
|
81 syn match verilogNumber "\(\<\d\+\|\)'[dD]\s*[0-9_xXzZ?]\+\>"
|
|
82 syn match verilogNumber "\(\<\d\+\|\)'[hH]\s*[0-9a-fA-F_xXzZ?]\+\>"
|
|
83 syn match verilogNumber "\<[+-]\=[0-9_]\+\(\.[0-9_]*\|\)\(e[0-9_]*\|\)\>"
|
|
84
|
316
|
85 syn region verilogString start=+"+ skip=+\\"+ end=+"+ contains=verilogEscape,@Spell
|
7
|
86 syn match verilogEscape +\\[nt"\\]+ contained
|
|
87 syn match verilogEscape "\\\o\o\=\o\=" contained
|
|
88
|
|
89 " Directives
|
|
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\>"
|
|
93
|
|
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\>"
|
|
97
|
|
98 "Modify the following as needed. The trade-off is performance versus
|
|
99 "functionality.
|
316
|
100 syn sync minlines=50
|
7
|
101
|
|
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")
|
|
106 if version < 508
|
|
107 let did_verilog_syn_inits = 1
|
|
108 command -nargs=+ HiLink hi link <args>
|
|
109 else
|
|
110 command -nargs=+ HiLink hi def link <args>
|
|
111 endif
|
|
112
|
|
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
|
|
128
|
|
129 delcommand HiLink
|
|
130 endif
|
|
131
|
|
132 let b:current_syntax = "verilog"
|
|
133
|
|
134 " vim: ts=8
|