2 " Language: Altera AHDL
3 " Maintainer: John Cook <john.cook@kla-tencor.com>
4 " Last Change: 2001 Apr 25
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 "this language is oblivious to case.
18 syn keyword ahdlKeyword assert begin bidir bits buried case clique
19 syn keyword ahdlKeyword connected_pins constant defaults define design
20 syn keyword ahdlKeyword device else elsif end for function generate
21 syn keyword ahdlKeyword gnd help_id if in include input is machine
22 syn keyword ahdlKeyword node of options others output parameters
23 syn keyword ahdlKeyword returns states subdesign table then title to
24 syn keyword ahdlKeyword tri_state_node variable vcc when with
27 syn keyword ahdlIdentifier carry cascade dffe dff exp global
28 syn keyword ahdlIdentifier jkffe jkff latch lcell mcell memory opendrn
29 syn keyword ahdlIdentifier soft srffe srff tffe tff tri wire x
31 syn keyword ahdlMegafunction lpm_and lpm_bustri lpm_clshift lpm_constant
32 syn keyword ahdlMegafunction lpm_decode lpm_inv lpm_mux lpm_or lpm_xor
33 syn keyword ahdlMegafunction busmux mux
35 syn keyword ahdlMegafunction divide lpm_abs lpm_add_sub lpm_compare
36 syn keyword ahdlMegafunction lpm_counter lpm_mult
38 syn keyword ahdlMegafunction altdpram csfifo dcfifo scfifo csdpram lpm_ff
39 syn keyword ahdlMegafunction lpm_latch lpm_shiftreg lpm_ram_dq lpm_ram_io
40 syn keyword ahdlMegafunction lpm_rom lpm_dff lpm_tff clklock pll ntsc
42 syn keyword ahdlTodo contained TODO
45 syn region ahdlString start=+"+ skip=+\\"+ end=+"+
47 " valid integer number formats (decimal, binary, octal, hex)
48 syn match ahdlNumber '\<\d\+\>'
49 syn match ahdlNumber '\<b"\(0\|1\|x\)\+"'
50 syn match ahdlNumber '\<\(o\|q\)"\o\+"'
51 syn match ahdlNumber '\<\(h\|x\)"\x\+"'
54 syn match ahdlOperator "[!&#$+\-<>=?:\^]"
55 syn keyword ahdlOperator not and nand or nor xor xnor
56 syn keyword ahdlOperator mod div log2 used ceil floor
58 " one line and multi-line comments
59 " (define these after ahdlOperator so -- overrides -)
60 syn match ahdlComment "--.*" contains=ahdlNumber,ahdlTodo
61 syn region ahdlComment start="%" end="%" contains=ahdlNumber,ahdlTodo
63 " other special characters
64 syn match ahdlSpecialChar "[\[\]().,;]"
68 " Define the default highlighting.
69 " For version 5.7 and earlier: only when not done already
70 " For version 5.8 and later: only when an item doesn't have highlighting yet
71 if version >= 508 || !exists("did_ahdl_syn_inits")
73 let did_ahdl_syn_inits = 1
74 command -nargs=+ HiLink hi link <args>
76 command -nargs=+ HiLink hi def link <args>
79 " The default highlighting.
80 HiLink ahdlNumber ahdlString
81 HiLink ahdlMegafunction ahdlIdentifier
82 HiLink ahdlSpecialChar SpecialChar
83 HiLink ahdlKeyword Statement
84 HiLink ahdlString String
85 HiLink ahdlComment Comment
86 HiLink ahdlIdentifier Identifier
87 HiLink ahdlOperator Operator
93 let b:current_syntax = "ahdl"