blob: c76b046d8caa7a74ac34418ad0e773a8b960cd22 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: VHDL
Bram Moolenaarbaca7f72013-09-22 14:42:24 +02003" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
4" Previous Maintainer: Czo <Olivier.Sirol@lip6.fr>
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
Bram Moolenaarf2571c62015-06-09 19:44:55 +02006" Last Changed: 2015 Apr 25 by Daniel Kho
Bram Moolenaarbaca7f72013-09-22 14:42:24 +02007" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaarbaca7f72013-09-22 14:42:24 +02009" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
Bram Moolenaar071d4272004-06-13 20:20:40 +000010
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
Bram Moolenaarb8ff1fb2012-02-04 21:59:01 +010019let s:cpo_save = &cpo
20set cpo&vim
21
Bram Moolenaar071d4272004-06-13 20:20:40 +000022" 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.
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020025"syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+"
26"syn match cDefine "^#endif"
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
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
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020034syn keyword vhdlStatement assume assume_guarantee
Bram Moolenaar071d4272004-06-13 20:20:40 +000035syn keyword vhdlStatement begin block body buffer bus
36syn keyword vhdlStatement case component configuration constant
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020037syn keyword vhdlStatement context cover
38syn keyword vhdlStatement default disconnect downto
Bram Moolenaar071d4272004-06-13 20:20:40 +000039syn keyword vhdlStatement elsif end entity exit
40syn keyword vhdlStatement file for function
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020041syn keyword vhdlStatement fairness force
Bram Moolenaar071d4272004-06-13 20:20:40 +000042syn 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
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020049syn keyword vhdlStatement parameter property protected
Bram Moolenaar071d4272004-06-13 20:20:40 +000050syn keyword vhdlStatement range record register reject report return
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020051syn keyword vhdlStatement release restrict restrict_guarantee
Bram Moolenaar071d4272004-06-13 20:20:40 +000052syn keyword vhdlStatement select severity signal shared
53syn keyword vhdlStatement subtype
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020054syn keyword vhdlStatement sequence strong
Bram Moolenaar071d4272004-06-13 20:20:40 +000055syn keyword vhdlStatement then to transport type
56syn keyword vhdlStatement unaffected units until use
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020057syn keyword vhdlStatement variable
58syn keyword vhdlStatement vmode vprop vunit
59syn keyword vhdlStatement wait when while with
Bram Moolenaar071d4272004-06-13 20:20:40 +000060syn 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
Bram Moolenaarc8734422012-06-01 22:38:45 +020068" Predefined VHDL types
Bram Moolenaar071d4272004-06-13 20:20:40 +000069syn keyword vhdlType bit bit_vector
70syn keyword vhdlType character boolean integer real time
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020071syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
Bram Moolenaar071d4272004-06-13 20:20:40 +000072syn keyword vhdlType string severity_level
Bram Moolenaarc8734422012-06-01 22:38:45 +020073" Predefined standard ieee VHDL types
Bram Moolenaar071d4272004-06-13 20:20:40 +000074syn 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
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020079"syn keyword vhdlType qsim_state qsim_state_vector
80"syn keyword vhdlType qsim_12state qsim_12state_vector
81"syn keyword vhdlType qsim_strength
Bram Moolenaar071d4272004-06-13 20:20:40 +000082" Predefined non standard VHDL types for Alliance VLSI CAD
Bram Moolenaarbaca7f72013-09-22 14:42:24 +020083"syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector
Bram Moolenaar071d4272004-06-13 20:20:40 +000084
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
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200134"syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135syn case ignore
136
137syn match vhdlVector "B\"[01_]\+\""
138syn match vhdlVector "O\"[0-7_]\+\""
139syn match vhdlVector "X\"[0-9a-f_]\+\""
140syn match vhdlCharacter "'.'"
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200141syn region vhdlString start=+"+ end=+"+
Bram Moolenaar071d4272004-06-13 20:20:40 +0000142
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
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200163syn keyword vhdlTodo contained TODO NOTE
164syn keyword vhdlFixme contained FIXME
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200165
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200166" 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 .*"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000177" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]"
178
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200179"Modify the following as needed. The trade-off is performance versus functionality.
180syn sync minlines=200
181
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182" 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
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200193 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
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200206" HiLink vhdlGlobal Error
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200207 HiLink vhdlAttribute Special
208 HiLink vhdlPreProc PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000209
210 delcommand HiLink
211endif
212
213let b:current_syntax = "vhdl"
214
Bram Moolenaarb8ff1fb2012-02-04 21:59:01 +0100215let &cpo = s:cpo_save
216unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217" vim: ts=8