blob: db51fa5034e82326d0533dfe0f9d74b4c61a55c1 [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 Moolenaarbaca7f72013-09-22 14:42:24 +02006" Last Changed: 2012 Feb 03 by Thilo Six
7" $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 Moolenaarbaca7f72013-09-22 14:42:24 +0200163syn keyword vhdlTodo contained TODO FIXME
164
165syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,@Spell
166syn match vhdlComment "--.*" contains=vhdlTodo,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000167" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]"
168
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200169"Modify the following as needed. The trade-off is performance versus functionality.
170syn sync minlines=200
171
Bram Moolenaar071d4272004-06-13 20:20:40 +0000172" Define the default highlighting.
173" For version 5.7 and earlier: only when not done already
174" For version 5.8 and later: only when an item doesn't have highlighting yet
175if version >= 508 || !exists("did_vhdl_syntax_inits")
176 if version < 508
177 let did_vhdl_syntax_inits = 1
178 command -nargs=+ HiLink hi link <args>
179 else
180 command -nargs=+ HiLink hi def link <args>
181 endif
182
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200183" HiLink cDefine PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184 HiLink vhdlSpecial Special
185 HiLink vhdlStatement Statement
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200186 HiLink vhdlCharacter Character
Bram Moolenaar071d4272004-06-13 20:20:40 +0000187 HiLink vhdlString String
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200188 HiLink vhdlVector Number
189 HiLink vhdlBoolean Number
190 HiLink vhdlTodo Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000191 HiLink vhdlComment Comment
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200192 HiLink vhdlNumber Number
193 HiLink vhdlTime Number
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194 HiLink vhdlType Type
Bram Moolenaarbaca7f72013-09-22 14:42:24 +0200195 HiLink vhdlOperator Special
196" HiLink vhdlGlobal Error
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197 HiLink vhdlAttribute Type
198
199 delcommand HiLink
200endif
201
202let b:current_syntax = "vhdl"
203
Bram Moolenaarb8ff1fb2012-02-04 21:59:01 +0100204let &cpo = s:cpo_save
205unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206" vim: ts=8