3 " Maintainer: Czo <Olivier.Sirol@lip6.fr>
4 " Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
5 " $Id: vhdl.vim,v 1.1.1.1 2001/06/07 21:35:13 corinna Exp $
7 " VHSIC Hardware Description Language
8 " Very High Scale Integrated Circuit
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
14 elseif exists("b:current_syntax")
18 " This is not VHDL. I use the C-Preprocessor cpp to generate different binaries
19 " from one VHDL source file. Unfortunately there is no preprocessor for VHDL
20 " available. If you don't like this, please remove the following lines.
21 syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+"
22 syn match cDefine "^#endif"
24 " case is not significant
28 syn keyword vhdlStatement access after alias all assert
29 syn keyword vhdlStatement architecture array attribute
30 syn keyword vhdlStatement begin block body buffer bus
31 syn keyword vhdlStatement case component configuration constant
32 syn keyword vhdlStatement disconnect downto
33 syn keyword vhdlStatement elsif end entity exit
34 syn keyword vhdlStatement file for function
35 syn keyword vhdlStatement generate generic group guarded
36 syn keyword vhdlStatement impure in inertial inout is
37 syn keyword vhdlStatement label library linkage literal loop
38 syn keyword vhdlStatement map
39 syn keyword vhdlStatement new next null
40 syn keyword vhdlStatement of on open others out
41 syn keyword vhdlStatement package port postponed procedure process pure
42 syn keyword vhdlStatement range record register reject report return
43 syn keyword vhdlStatement select severity signal shared
44 syn keyword vhdlStatement subtype
45 syn keyword vhdlStatement then to transport type
46 syn keyword vhdlStatement unaffected units until use
47 syn keyword vhdlStatement variable wait when while with
48 syn keyword vhdlStatement note warning error failure
50 " Special match for "if" and "else" since "else if" shouldn't be highlighted.
51 " The right keyword is "elsif"
52 syn match vhdlStatement "\<\(if\|else\)\>"
53 syn match vhdlNone "\<else\s\+if\>$"
54 syn match vhdlNone "\<else\s\+if\>\s"
56 " Predifined VHDL types
57 syn keyword vhdlType bit bit_vector
58 syn keyword vhdlType character boolean integer real time
59 syn keyword vhdlType string severity_level
60 " Predifined standard ieee VHDL types
61 syn keyword vhdlType positive natural signed unsigned
62 syn keyword vhdlType line text
63 syn keyword vhdlType std_logic std_logic_vector
64 syn keyword vhdlType std_ulogic std_ulogic_vector
65 " Predefined non standard VHDL types for Mentor Graphics Sys1076/QuickHDL
66 syn keyword vhdlType qsim_state qsim_state_vector
67 syn keyword vhdlType qsim_12state qsim_12state_vector
68 syn keyword vhdlType qsim_strength
69 " Predefined non standard VHDL types for Alliance VLSI CAD
70 syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector
73 syn match vhdlAttribute "\'high"
74 syn match vhdlAttribute "\'left"
75 syn match vhdlAttribute "\'length"
76 syn match vhdlAttribute "\'low"
77 syn match vhdlAttribute "\'range"
78 syn match vhdlAttribute "\'reverse_range"
79 syn match vhdlAttribute "\'right"
80 syn match vhdlAttribute "\'ascending"
82 syn match vhdlAttribute "\'behaviour"
83 syn match vhdlAttribute "\'structure"
84 syn match vhdlAttribute "\'simple_name"
85 syn match vhdlAttribute "\'instance_name"
86 syn match vhdlAttribute "\'path_name"
87 syn match vhdlAttribute "\'foreign"
89 syn match vhdlAttribute "\'active"
90 syn match vhdlAttribute "\'delayed"
91 syn match vhdlAttribute "\'event"
92 syn match vhdlAttribute "\'last_active"
93 syn match vhdlAttribute "\'last_event"
94 syn match vhdlAttribute "\'last_value"
95 syn match vhdlAttribute "\'quiet"
96 syn match vhdlAttribute "\'stable"
97 syn match vhdlAttribute "\'transaction"
98 syn match vhdlAttribute "\'driving"
99 syn match vhdlAttribute "\'driving_value"
101 syn match vhdlAttribute "\'base"
102 syn match vhdlAttribute "\'high"
103 syn match vhdlAttribute "\'left"
104 syn match vhdlAttribute "\'leftof"
105 syn match vhdlAttribute "\'low"
106 syn match vhdlAttribute "\'pos"
107 syn match vhdlAttribute "\'pred"
108 syn match vhdlAttribute "\'rightof"
109 syn match vhdlAttribute "\'succ"
110 syn match vhdlAttribute "\'val"
111 syn match vhdlAttribute "\'image"
112 syn match vhdlAttribute "\'value"
114 syn keyword vhdlBoolean true false
116 " for this vector values case is significant
118 " Values for standard VHDL types
119 syn match vhdlVector "\'[0L1HXWZU\-\?]\'"
120 " Values for non standard VHDL types qsim_12state for Mentor Graphics Sys1076/QuickHDL
121 syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI
124 syn match vhdlVector "B\"[01_]\+\""
125 syn match vhdlVector "O\"[0-7_]\+\""
126 syn match vhdlVector "X\"[0-9a-f_]\+\""
127 syn match vhdlCharacter "'.'"
128 syn region vhdlString start=+"+ end=+"+
131 syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>"
132 syn match vhdlNumber "-\=\<\d\+\.\d\+\>"
133 syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\="
134 syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="
136 syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>"
137 syn match vhdlNumber "-\=\<\d\+\>"
138 syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\="
139 syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\="
141 syn keyword vhdlOperator and nand or nor xor xnor
142 syn keyword vhdlOperator rol ror sla sll sra srl
143 syn keyword vhdlOperator mod rem abs not
144 syn match vhdlOperator "[&><=:+\-*\/|]"
145 syn match vhdlSpecial "[().,;]"
147 syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>"
148 syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>"
150 syn match vhdlComment "--.*$"
151 " syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]"
153 " Define the default highlighting.
154 " For version 5.7 and earlier: only when not done already
155 " For version 5.8 and later: only when an item doesn't have highlighting yet
156 if version >= 508 || !exists("did_vhdl_syntax_inits")
158 let did_vhdl_syntax_inits = 1
159 command -nargs=+ HiLink hi link <args>
161 command -nargs=+ HiLink hi def link <args>
164 HiLink cDefine PreProc
165 HiLink vhdlSpecial Special
166 HiLink vhdlStatement Statement
167 HiLink vhdlCharacter String
168 HiLink vhdlString String
169 HiLink vhdlVector String
170 HiLink vhdlBoolean String
171 HiLink vhdlComment Comment
172 HiLink vhdlNumber String
173 HiLink vhdlTime String
175 HiLink vhdlOperator Type
176 HiLink vhdlGlobal Error
177 HiLink vhdlAttribute Type
182 let b:current_syntax = "vhdl"