xref: /vim-8.2.3635/runtime/syntax/vhdl.vim (revision fc39ecf8)
1" Vim syntax file
2" Language:	VHDL
3" Maintainer:	Daniel Kho <[email protected]>
4" Previous Maintainer:	Czo <[email protected]>
5" Credits:	Stephan Hegel <[email protected]>
6" Last Changed:	2015 Apr 25 by Daniel Kho
7" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $
8
9" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
10
11" For version 5.x: Clear all syntax items
12" For version 6.x: Quit when a syntax file was already loaded
13if version < 600
14  syntax clear
15elseif exists("b:current_syntax")
16  finish
17endif
18
19let s:cpo_save = &cpo
20set cpo&vim
21
22" This is not VHDL. I use the C-Preprocessor cpp to generate different binaries
23" from one VHDL source file. Unfortunately there is no preprocessor for VHDL
24" available. If you don't like this, please remove the following lines.
25"syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+"
26"syn match cDefine "^#endif"
27
28" case is not significant
29syn case ignore
30
31" VHDL keywords
32syn keyword vhdlStatement access after alias all assert
33syn keyword vhdlStatement architecture array attribute
34syn keyword vhdlStatement assume assume_guarantee
35syn keyword vhdlStatement begin block body buffer bus
36syn keyword vhdlStatement case component configuration constant
37syn keyword vhdlStatement context cover
38syn keyword vhdlStatement default disconnect downto
39syn keyword vhdlStatement elsif end entity exit
40syn keyword vhdlStatement file for function
41syn keyword vhdlStatement fairness force
42syn keyword vhdlStatement generate generic group guarded
43syn keyword vhdlStatement impure in inertial inout is
44syn keyword vhdlStatement label library linkage literal loop
45syn keyword vhdlStatement map
46syn keyword vhdlStatement new next null
47syn keyword vhdlStatement of on open others out
48syn keyword vhdlStatement package port postponed procedure process pure
49syn keyword vhdlStatement parameter property protected
50syn keyword vhdlStatement range record register reject report return
51syn keyword vhdlStatement release restrict restrict_guarantee
52syn keyword vhdlStatement select severity signal shared
53syn keyword vhdlStatement subtype
54syn keyword vhdlStatement sequence strong
55syn keyword vhdlStatement then to transport type
56syn keyword vhdlStatement unaffected units until use
57syn keyword vhdlStatement variable
58syn keyword vhdlStatement vmode vprop vunit
59syn keyword vhdlStatement wait when while with
60syn keyword vhdlStatement note warning error failure
61
62" Special match for "if" and "else" since "else if" shouldn't be highlighted.
63" The right keyword is "elsif"
64syn match   vhdlStatement "\<\(if\|else\)\>"
65syn match   vhdlNone      "\<else\s\+if\>$"
66syn match   vhdlNone      "\<else\s\+if\>\s"
67
68" Predefined VHDL types
69syn keyword vhdlType bit bit_vector
70syn keyword vhdlType character boolean integer real time
71syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
72syn keyword vhdlType string severity_level
73" Predefined standard ieee VHDL types
74syn keyword vhdlType positive natural signed unsigned
75syn keyword vhdlType line text
76syn keyword vhdlType std_logic std_logic_vector
77syn keyword vhdlType std_ulogic std_ulogic_vector
78" Predefined non standard VHDL types for Mentor Graphics Sys1076/QuickHDL
79"syn keyword vhdlType qsim_state qsim_state_vector
80"syn keyword vhdlType qsim_12state qsim_12state_vector
81"syn keyword vhdlType qsim_strength
82" Predefined non standard VHDL types for Alliance VLSI CAD
83"syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector
84
85" array attributes
86syn match vhdlAttribute "\'high"
87syn match vhdlAttribute "\'left"
88syn match vhdlAttribute "\'length"
89syn match vhdlAttribute "\'low"
90syn match vhdlAttribute "\'range"
91syn match vhdlAttribute "\'reverse_range"
92syn match vhdlAttribute "\'right"
93syn match vhdlAttribute "\'ascending"
94" block attributes
95syn match vhdlAttribute "\'behaviour"
96syn match vhdlAttribute "\'structure"
97syn match vhdlAttribute "\'simple_name"
98syn match vhdlAttribute "\'instance_name"
99syn match vhdlAttribute "\'path_name"
100syn match vhdlAttribute "\'foreign"
101" signal attribute
102syn match vhdlAttribute "\'active"
103syn match vhdlAttribute "\'delayed"
104syn match vhdlAttribute "\'event"
105syn match vhdlAttribute "\'last_active"
106syn match vhdlAttribute "\'last_event"
107syn match vhdlAttribute "\'last_value"
108syn match vhdlAttribute "\'quiet"
109syn match vhdlAttribute "\'stable"
110syn match vhdlAttribute "\'transaction"
111syn match vhdlAttribute "\'driving"
112syn match vhdlAttribute "\'driving_value"
113" type attributes
114syn match vhdlAttribute "\'base"
115syn match vhdlAttribute "\'high"
116syn match vhdlAttribute "\'left"
117syn match vhdlAttribute "\'leftof"
118syn match vhdlAttribute "\'low"
119syn match vhdlAttribute "\'pos"
120syn match vhdlAttribute "\'pred"
121syn match vhdlAttribute "\'rightof"
122syn match vhdlAttribute "\'succ"
123syn match vhdlAttribute "\'val"
124syn match vhdlAttribute "\'image"
125syn match vhdlAttribute "\'value"
126
127syn keyword vhdlBoolean true false
128
129" for this vector values case is significant
130syn case match
131" Values for standard VHDL types
132syn match vhdlVector "\'[0L1HXWZU\-\?]\'"
133" Values for non standard VHDL types qsim_12state for Mentor Graphics Sys1076/QuickHDL
134"syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI
135syn case ignore
136
137syn match  vhdlVector "B\"[01_]\+\""
138syn match  vhdlVector "O\"[0-7_]\+\""
139syn match  vhdlVector "X\"[0-9a-f_]\+\""
140syn match  vhdlCharacter "'.'"
141syn region vhdlString start=+"+  end=+"+
142
143" floating numbers
144syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>"
145syn match vhdlNumber "-\=\<\d\+\.\d\+\>"
146syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\="
147syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="
148" integer numbers
149syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>"
150syn match vhdlNumber "-\=\<\d\+\>"
151syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\="
152syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="
153" operators
154syn keyword vhdlOperator and nand or nor xor xnor
155syn keyword vhdlOperator rol ror sla sll sra srl
156syn keyword vhdlOperator mod rem abs not
157syn match   vhdlOperator "[&><=:+\-*\/|]"
158syn match   vhdlSpecial  "[().,;]"
159" time
160syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>"
161syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>"
162
163syn keyword vhdlTodo	contained TODO NOTE
164syn keyword vhdlFixme	contained FIXME
165
166" Regex for space is '\s'
167"   Any number of spaces: \s*
168"   At least one space:	  \s+
169syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
170syn match vhdlComment "--.*" contains=vhdlTodo,vhdlFixme,@Spell
171syn match vhdlPreProc "/\* synthesis .* \*/"
172syn match vhdlPreProc "/\* pragma .* \*/"
173syn match vhdlPreProc "/\* synopsys .* \*/"
174syn match vhdlPreProc "--\s*synthesis .*"
175syn match vhdlPreProc "--\s*pragma .*"
176syn match vhdlPreProc "--\s*synopsys .*"
177" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]"
178
179"Modify the following as needed.  The trade-off is performance versus functionality.
180syn sync minlines=200
181
182" Define the default highlighting.
183" For version 5.7 and earlier: only when not done already
184" For version 5.8 and later: only when an item doesn't have highlighting yet
185if version >= 508 || !exists("did_vhdl_syntax_inits")
186  if version < 508
187    let did_vhdl_syntax_inits = 1
188    command -nargs=+ HiLink hi link <args>
189  else
190    command -nargs=+ HiLink hi def link <args>
191  endif
192
193  HiLink vhdlSpecial	Special
194  HiLink vhdlStatement	Statement
195  HiLink vhdlCharacter	Character
196  HiLink vhdlString	String
197  HiLink vhdlVector	Number
198  HiLink vhdlBoolean  	Number
199  HiLink vhdlTodo	Todo
200  HiLink vhdlFixme	Fixme
201  HiLink vhdlComment	Comment
202  HiLink vhdlNumber	Number
203  HiLink vhdlTime	Number
204  HiLink vhdlType	Type
205  HiLink vhdlOperator	Operator
206"  HiLink vhdlGlobal    Error
207  HiLink vhdlAttribute	Special
208  HiLink vhdlPreProc	PreProc
209
210  delcommand HiLink
211endif
212
213let b:current_syntax = "vhdl"
214
215let &cpo = s:cpo_save
216unlet s:cpo_save
217" vim: ts=8
218