Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
;; Comments
(one_line_comment) @comment
(block_comment) @comment


;; Strings
(string_literal) @string
(quoted_string) @string ; `include strings
(system_lib_string) @string


;; Keywords
(["begin" "end" "this"]) @keyword
(["input" "output" "inout" "ref"]) @keyword
(["alias" "and" "assert" "assign" "assume" "before" "bind" "binsof" "break"
  "case" "checker" "class" "class" "clocking" "config" "const" "constraint"
  "cover" "covergroup" "coverpoint" "cross" "default" "defparam" "disable"
  "do" "else" "endcase" "endchecker" "endclass" "endclocking" "endconfig"
  "endfunction" "endgenerate" "endgroup" "endinterface" "endmodule"
  "endpackage" "endprogram" "endproperty" "endsequence" "endtask" "enum"
  "extends" "extern" "final" "first_match" "for" "force" "foreach" "forever"
  "fork" "forkjoin" "function" "generate" "genvar" "if" "iff" "illegal_bins"
  "implements" "import" "initial" "inside" "interconnect" "interface"
  "intersect" "join" "join_any" "join_none" "local" "localparam" "matches"
  "modport" "new" "null" "option" "or" "package" "packed" "parameter"
  "program" "property" "pure" "randcase" "randomize" "release" "repeat"
  "return" "sequence" "showcancelled" "soft" "solve" "struct" "super" "tagged"
  "task" "timeprecision" "timeunit" "type" "typedef" "union" "unique"
  "virtual" "wait" "while" "with"
  (always_keyword)             ; always, always_comb, always_latch, always_ff
  (bins_keyword)               ; bins, illegal_bins, ignore_bins
  (case_keyword)               ; case, casez, casex
  (class_item_qualifier)       ; static, protected, local
  (edge_identifier)            ; posedge, negedge, edge
  (lifetime)                   ; static, automatic
  (module_keyword)             ; module, macromodule
  (random_qualifier)           ; rand, randc
  (unique_priority)]) @keyword ; unique, unique0, priority


;; Preprocessor directives and macro usage
(["`include" "`define" "`ifdef" "`ifndef" "`timescale" "`default_nettype"
  "`elsif" "`undef" (resetall_compiler_directive) (undefineall_compiler_directive)
  "`endif" "`else" "`unconnected_drive" (celldefine_compiler_directive)
  (endcelldefine_compiler_directive) (endkeywords_directive) "`line"
  "`begin_keywords" "`pragma" "`__FILE__" "`__LINE__"]) @string.special
(text_macro_usage
 (simple_identifier) @string.special)


;; Delimiters, operators
([";" ":" "," "::"
  "=" "?" "|=" "&=" "^="
  "|->" "|=>" "->"
  ":=" ":/" "-:" "+:"]) @punctuation.delimiter
(["(" ")"]) @punctuation.bracket
(["[" "]"]) @punctuation.bracket
(["{" "}" "'{"]) @punctuation.bracket

(["."] @operator)
(["+" "-" "*" "/" "%" "**"]) @operator
(["<" "<=" ">" ">="]) @operator
(["===" "!==" "==" "!="]) @operator
(["&&" "||" "!"]) @operator
(["~" "&" "~&" "|" "~|" "^" "~^"]) @operator
(["<<" ">>" "<<<" ">>>"]) @operator

(["@" "#" "##"]) @operator
(assignment_operator) @operator
(unary_operator) @operator
(inc_or_dec_operator) @operator
(stream_operator) @operator
(event_trigger) @operator
(["->" "->>"]) @operator


;; Declarations
;; Module/interface/program/package/class/checker
(module_nonansi_header
 name: (simple_identifier) @function)
(module_ansi_header
 name: (simple_identifier) @function)
(interface_nonansi_header
 name: (simple_identifier) @function)
(interface_ansi_header
 name: (simple_identifier) @function)
(program_nonansi_header
 name: (simple_identifier) @function)
(program_ansi_header
 name: (simple_identifier) @function)
(package_declaration
 name: (simple_identifier) @function)
(class_declaration
 name: (simple_identifier) @function)
(interface_class_declaration
 name: (simple_identifier) @function)
(checker_declaration
 name: (simple_identifier) @function)
(class_declaration
 (class_type
  (simple_identifier) @type)) ; Parent class
;; Function/task/methods
(function_body_declaration
 name: (simple_identifier) @function)
(task_body_declaration
 name: (simple_identifier) @function)
(function_prototype
 (data_type_or_void)
 name: (simple_identifier) @function)
(task_prototype
 name: (simple_identifier) @function)
(class_scope ; Definition of extern defined methods
 (class_type
  (simple_identifier)) @function)


;; Types
[(integer_vector_type) ; bit, logic, reg
  (integer_atom_type)   ; byte, shortint, int, longint, integer, time
  (non_integer_type)    ; shortreal, real, realtime
  (net_type)            ; supply0, supply1, tri, triand, trior, trireg, tri0, tri1, uwire, wire, wand, wor
  ["string" "event" "signed" "unsigned" "chandle"]] @type
(data_type_or_implicit
 (data_type
  (simple_identifier)) @type)
(data_type
 (class_type
  (simple_identifier) @type
  (parameter_value_assignment)))
(data_type
 (class_type
  (simple_identifier) @operator
  (simple_identifier) @type))
(net_port_header
 (net_port_type
  (simple_identifier) @type))
(variable_port_header
 (variable_port_type
  (data_type
   (simple_identifier) @type)))
(["void'" (data_type_or_void)]) @type ; void cast of task called as a function
(interface_port_header ; Interfaces with modports
 interface_name: (simple_identifier) @type
 modport_name: (simple_identifier) @type)
(type_assignment
 name: (simple_identifier) @type)
(net_declaration ; User type variable declaration
 (simple_identifier) @type)
(enum_base_type ; Enum base type with user type
 (simple_identifier) @type)


;; Instances
;; Module names
(module_instantiation
 instance_type: (simple_identifier) @namespace)
(interface_instantiation
 instance_type: (simple_identifier) @namespace)
(program_instantiation
 instance_type: (simple_identifier) @namespace)
(checker_instantiation
 instance_type: (simple_identifier) @namespace)
(udp_instantiation
 instance_type: (simple_identifier) @namespace)
(gate_instantiation
 [(cmos_switchtype)
  (mos_switchtype)
  (enable_gatetype)
  (n_input_gatetype)
  (n_output_gatetype)
  (pass_en_switchtype)
  (pass_switchtype)
  "pulldown" "pullup"]
 @namespace)
;; Instance names
(name_of_instance
 instance_name: (simple_identifier) @constant)
;; Instance parameters
(module_instantiation
 (parameter_value_assignment
  (list_of_parameter_value_assignments
   (named_parameter_assignment
    (simple_identifier) @constant))))
(module_instantiation
 (parameter_value_assignment
  (list_of_parameter_value_assignments
   (ordered_parameter_assignment
    (param_expression
     (data_type
      (simple_identifier) @constant))))))
;; Port names
(named_port_connection
 port_name: (simple_identifier) @constant)
(named_parameter_assignment
 (simple_identifier) @constant)
(named_checker_port_connection
 port_name: (simple_identifier) @constant)
;; Bind statements
(bind_directive
 (bind_target_scope
  (simple_identifier) @constant))


;; Numbers
(hex_number
 size: (unsigned_number) @constant.numeric
 base: (hex_base) @punctuation.delimiter)
(decimal_number
 size: (unsigned_number) @constant.numeric
 base: (decimal_base) @punctuation.delimiter)
(octal_number
 size: (unsigned_number) @constant.numeric
 base: (octal_base) @punctuation.delimiter)
(binary_number
 size: (unsigned_number) @constant.numeric
 base: (binary_base) @punctuation.delimiter)
;; Same as before but without the width (width extension)
(hex_number
 base: (hex_base) @punctuation.delimiter)
(decimal_number
 base: (decimal_base) @punctuation.delimiter)
(octal_number
 base: (octal_base) @punctuation.delimiter)
(binary_number
 base: (binary_base) @punctuation.delimiter)


;; Arrays
(unpacked_dimension
 [(constant_expression) (constant_range)] @constant.numeric)
(packed_dimension
 (constant_range) @constant.numeric)
(select
 (constant_range) @constant.numeric)
(constant_select
 (constant_range
  (constant_expression) @constant.numeric))
(constant_bit_select
 (constant_expression) @constant.numeric)
(bit_select
 (expression) @constant.numeric)
(indexed_range
 (expression) @constant.numeric
 (constant_expression) @constant.numeric)
(constant_indexed_range
 (constant_expression) @constant.numeric)
(value_range ; inside {[min_range:max_range]}, place here to apply override
 (expression) @constant)
(dynamic_array_new
 (expression) @constant)


;; Misc
;; Timeunit
((time_unit) @constant.builtin)
;; Enum labels
(enum_name_declaration
 (simple_identifier) @constant.builtin)
;; Case item label (not radix)
(case_item_expression
 (expression
  (primary
   (hierarchical_identifier
    (simple_identifier) @constant.builtin))))
;; Hierarchical references, interface signals, class members, package scope
(hierarchical_identifier
 (simple_identifier) @punctuation.delimiter
 "."
 (simple_identifier))
(method_call
 (primary) @punctuation.delimiter
 (["." "::"])
 (method_call_body))
(package_scope
 (simple_identifier) @punctuation.delimiter)
(method_call
 (primary
  (select
   (simple_identifier) @punctuation.delimiter))
 (method_call_body))
;; Attributes
(["(*" "*)"] @constant)
(attribute_instance
 (attr_spec (simple_identifier) @attribute))
;; Typedefs
(type_declaration
 (class_type (simple_identifier) @type)
 type_name: (simple_identifier) @constant)
(type_declaration
 type_name: (simple_identifier) @constant)
("typedef" "class" (simple_identifier) @constant)
;; Coverpoint & cross labels
(cover_point
 name: (simple_identifier) @constant)
(cover_cross
 name: (simple_identifier) @constant)
;; Loop variables (foreach[i])
(loop_variables
 (simple_identifier) @constant)
;; Bins values
(bins_or_options
 (expression
  (primary
   (concatenation
    (expression) @constant))))
;; Bins ranges
(covergroup_value_range
 (expression) @constant)
;; Queue dimension
(("$") @punctuation.special)
;; Parameterized classes (e.g: uvm_config_db #(axi_stream_agent_config))
(class_type
 (parameter_value_assignment
  (list_of_parameter_value_assignments) @punctuation.delimiter))


;; System-tf
([(system_tf_identifier)               ; System task/function
  "$fatal" "$error" "$warning" "$info" ; (severity_system_task)
  "$stop" "$finish" "$exit"])          ; (simulation_control_task)
@function.builtin