sverulesverule by (svericl)

sverulesverule is a SystemVerilog BNF navigator.

  • Click any rule reference to jump to its definition.
  • Use BNF Sections 👈 to navigate sections.
  • Use the Search bar above 👆 to search/filter production names.
  • Drag productions to the Scratchpad 👉.

1 Source text

1.1 Library source text

library_text ::=
      { library_description }
library_description ::=
      library_declaration | include_statement | config_declaration | ;
library_declaration ::=
      library library_identifier file_path_spec { , file_path_spec }
      [ -incdir file_path_spec { , file_path_spec } ] ;
include_statement ::=
      include file_path_spec ;

1.2 SystemVerilog source text

source_text ::=
      [ timeunits_declaration ] { description }
module_keyword ::=
      module | macromodule
checker_declaration ::=
      checker checker_identifier [ ( [ checker_port_list ] ) ] ;
      { { attribute_instance } checker_or_generate_item } endchecker [ : checker_identifier ]
class_declaration ::=
      [ virtual ] class [ lifetime ] class_identifier [ parameter_port_list ]
      [ extends class_type [ ( list_of_arguments ) ] ]
      [ implements interface_class_type { , interface_class_type } ] ; { class_item } endclass
      [ : class_identifier ]
interface_class_type ::=
      ps_class_identifier [ parameter_value_assignment ]
interface_class_declaration ::=
      interface class class_identifier [ parameter_port_list ]
      [ extends interface_class_type { , interface_class_type } ] ; { interface_class_item }
      endclass [ : class_identifier ]
interface_class_method ::=
      pure virtual method_prototype ;
package_declaration ::=
      { attribute_instance } package [ lifetime ] package_identifier ; [ timeunits_declaration ]
      { { attribute_instance } package_item } endpackage [ : package_identifier ]
timeunits_declaration ::=
      timeunit time_literal [ / time_literal ] ;
    | timeprecision time_literal ;
    | timeunit time_literal ; timeprecision time_literal ;
    | timeprecision time_literal ; timeunit time_literal ;

1.3 Module ports

list_of_ports ::=
      ( port { , port } )
list_of_port_declarations ::=
      (
      [ { attribute_instance } ansi_port_declaration
        { , { attribute_instance } ansi_port_declaration } ]
      )
port ::=
      [ port_expression ] | . port_identifier ( [ port_expression ] )
port_expression ::=
      port_reference | { port_reference { , port_reference } }
port_reference ::=
      port_identifier constant_select
port_direction ::=
      input | output | inout | ref
net_port_header ::=
      [ port_direction ] net_port_type
variable_port_header ::=
      [ port_direction ] variable_port_type
interface_port_header ::=
      interface_identifier [ . modport_identifier ] | interface [ . modport_identifier ]

1.4 Module items

elaboration_system_task ::=
      $fatal [ ( finish_number [ , list_of_arguments ] ) ] ;
    | $error [ ( [ list_of_arguments ] ) ] ;
    | $warning [ ( [ list_of_arguments ] ) ] ;
    | $info [ ( [ list_of_arguments ] ) ] ;
finish_number ::=
      0 | 1 | 2
module_item ::=
      port_declaration ; | non_port_module_item
module_or_generate_item_declaration ::=
      package_or_generate_item_declaration
    | genvar_declaration
    | clocking_declaration
    | default clocking clocking_identifier ;
    | default disable iff expression_or_dist ;
parameter_override ::=
      defparam list_of_defparam_assignments ;
bind_target_scope ::=
      module_identifier | interface_identifier
bind_target_instance ::=
      hierarchical_identifier constant_bit_select
bind_target_instance_list ::=
      bind_target_instance { , bind_target_instance }

1.5 Configuration

config_declaration ::=
      config config_identifier ; { local_parameter_declaration ; } design_statement
      { config_rule_statement } endconfig [ : config_identifier ]
design_statement ::=
      design { [ library_identifier . ] cell_identifier } ;
default_clause ::=
      default
inst_clause ::=
      instance inst_name
inst_name ::=
      topmodule_identifier { . instance_identifier }
cell_clause ::=
      cell [ library_identifier . ] cell_identifier
liblist_clause ::=
      liblist { library_identifier }

1.6 Interface items

extern_tf_declaration ::=
      extern method_prototype ; | extern forkjoin task_prototype ;
interface_item ::=
      port_declaration ; | non_port_interface_item

1.9 Class items

class_constructor_prototype ::=
      function new [ ( [ tf_port_list ] ) ] ;
class_constraint ::=
      constraint_prototype | constraint_declaration
class_item_qualifier ::=
      static | protected | local
property_qualifier ::=
      random_qualifier | class_item_qualifier
random_qualifier ::=
      rand | randc
method_qualifier ::=
      [ pure ] virtual | class_item_qualifier
method_prototype ::=
      task_prototype | function_prototype
class_constructor_declaration ::=
      function [ class_scope ] new [ ( [ tf_port_list ] ) ] ; { block_item_declaration }
      [ super . new [ ( list_of_arguments ) ] ; ] { function_statement_or_null } endfunction
      [ : new ]

1.10 Constraints

constraint_declaration ::=
      [ static ] constraint constraint_identifier constraint_block
constraint_block ::=
      { { constraint_block_item } }
constraint_block_item ::=
      solve solve_before_list before solve_before_list ; | constraint_expression
solve_before_list ::=
      constraint_primary { , constraint_primary }
uniqueness_constraint ::=
      unique { open_range_list }
constraint_set ::=
      constraint_expression | { { constraint_expression } }
dist_list ::=
      dist_item { , dist_item }
dist_item ::=
      value_range [ dist_weight ]
dist_weight ::=
      := expression | :/ expression
constraint_prototype ::=
      [ constraint_prototype_qualifier ] [ static ] constraint constraint_identifier ;
constraint_prototype_qualifier ::=
      extern | pure
extern_constraint_declaration ::=
      [ static ] constraint class_scope constraint_identifier constraint_block
identifier_list ::=
      identifier { , identifier }

2 Declarations

2.1 Declaration types

2.1.1 Module parameter declarations

local_parameter_declaration ::=
      localparam data_type_or_implicit list_of_param_assignments
    | localparam type list_of_type_assignments
parameter_declaration ::=
      parameter data_type_or_implicit list_of_param_assignments
    | parameter type list_of_type_assignments
specparam_declaration ::=
      specparam [ packed_dimension ] list_of_specparam_assignments ;

2.1.3 Type declarations

package_import_declaration ::=
      import package_import_item { , package_import_item } ;
package_import_item ::=
      package_identifier :: identifier | package_identifier :: *
package_export_declaration ::=
      export *::* ; | export package_import_item { , package_import_item } ;
genvar_declaration ::=
      genvar list_of_genvar_identifiers ;
type_declaration ::=
      typedef data_type type_identifier { variable_dimension } ;
    | typedef interface_instance_identifier constant_bit_select . type_identifier type_identifier ;
    | typedef [ enum | struct | union | class | interface class ] type_identifier ;
lifetime ::=
      static | automatic

2.2 Declaration data types

2.2.1 Net and variable types

casting_type ::=
      simple_type | constant_primary | signing | string | const
data_type_or_implicit ::=
      data_type | implicit_data_type
implicit_data_type ::=
      [ signing ] { packed_dimension }
enum_name_declaration ::=
      enum_identifier [ [ integral_number [ : integral_number ] ] ] [ = constant_expression ]
class_scope ::=
      class_type ::
integer_type ::=
      integer_vector_type | integer_atom_type
integer_atom_type ::=
      byte | shortint | int | longint | integer | time
integer_vector_type ::=
      bit | logic | reg
non_integer_type ::=
      shortreal | real | realtime
net_type ::=
      supply0 | supply1 | tri | triand | trior | trireg | tri0 | tri1 | uwire| wire | wand | wor
net_port_type ::=
      [ net_type ] data_type_or_implicit | net_type_identifier | interconnect implicit_data_type
variable_port_type ::=
      var_data_type
var_data_type ::=
      data_type | var data_type_or_implicit
signing ::=
      signed | unsigned
data_type_or_void ::=
      data_type | void
struct_union ::=
      struct | union [ tagged ]
type_reference ::=
      type ( expression ) | type ( data_type )

2.2.2 Strengths

drive_strength ::=
      ( strength0 , strength1 )
    | ( strength1 , strength0 )
    | ( strength0 , highz1 )
    | ( strength1 , highz0 )
    | ( highz0 , strength1 )
    | ( highz1 , strength0 )
strength0 ::=
      supply0 | strong0 | pull0 | weak0
strength1 ::=
      supply1 | strong1 | pull1 | weak1
charge_strength ::=
      ( small ) | ( medium ) | ( large )

2.2.3 Delays

delay2 ::=
      # delay_value | # ( mintypmax_expression [ , mintypmax_expression ] )
delay_value ::=
      unsigned_number | real_number | ps_identifier | time_literal | 1step

2.3 Declaration lists

list_of_defparam_assignments ::=
      defparam_assignment { , defparam_assignment }
list_of_genvar_identifiers ::=
      genvar_identifier { , genvar_identifier }
list_of_interface_identifiers ::=
      interface_identifier { unpacked_dimension } { , interface_identifier { unpacked_dimension } }
list_of_net_decl_assignments ::=
      net_decl_assignment { , net_decl_assignment }
list_of_param_assignments ::=
      param_assignment { , param_assignment }
list_of_port_identifiers ::=
      port_identifier { unpacked_dimension } { , port_identifier { unpacked_dimension } }
list_of_udp_port_identifiers ::=
      port_identifier { , port_identifier }
list_of_specparam_assignments ::=
      specparam_assignment { , specparam_assignment }
list_of_tf_variable_identifiers ::=
      port_identifier { variable_dimension } [ = expression ]
      { , port_identifier { variable_dimension } [ = expression ] }
list_of_type_assignments ::=
      type_assignment { , type_assignment }
list_of_variable_decl_assignments ::=
      variable_decl_assignment { , variable_decl_assignment }
list_of_variable_identifiers ::=
      variable_identifier { variable_dimension } { , variable_identifier { variable_dimension } }
list_of_variable_port_identifiers ::=
      port_identifier { variable_dimension } [ = constant_expression ]
      { , port_identifier { variable_dimension } [ = constant_expression ] }

2.4 Declaration assignments

net_decl_assignment ::=
      net_identifier { unpacked_dimension } [ = expression ]
type_assignment ::=
      type_identifier [ = data_type ]
error_limit_value ::=
      limit_value
reject_limit_value ::=
      limit_value
limit_value ::=
      constant_mintypmax_expression
class_new ::=
      [ class_scope ] new [ ( list_of_arguments ) ] | new expression
dynamic_array_new ::=
      new [ expression ] [ ( expression ) ]

2.5 Declaration ranges

unpacked_dimension ::=
      [ constant_range ] | [ constant_expression ]
packed_dimension ::=
      [ constant_range ] | unsized_dimension
associative_dimension ::=
      [ data_type ] | [ * ]
queue_dimension ::=
      [ $ [ : constant_expression ] ]
unsized_dimension ::=
      [ ]

2.6 Function declarations

function_data_type_or_implicit ::=
      data_type_or_void | implicit_data_type
function_declaration ::=
      function [ lifetime ] function_body_declaration
function_prototype ::=
      function data_type_or_void function_identifier [ ( [ tf_port_list ] ) ]
dpi_spec_string ::=
      "DPI-C" | "DPI"
dpi_function_import_property ::=
      context | pure
dpi_task_import_property ::=
      context
dpi_function_proto ::=
      function_prototype
dpi_task_proto ::=
      task_prototype

2.7 Task declarations

task_declaration ::=
      task [ lifetime ] task_body_declaration
tf_item_declaration ::=
      block_item_declaration | tf_port_declaration
tf_port_list ::=
      tf_port_item { , tf_port_item }
tf_port_direction ::=
      port_direction | const ref
task_prototype ::=
      task task_identifier [ ( [ tf_port_list ] ) ]

2.8 Block item declarations

overload_declaration ::=
      bind overload_operator function data_type function_identifier ( overload_proto_formals ) ;
overload_operator ::=
      + | ++ | - | -- | * | ** | / | % | == | != | < | <= | > | >= | =
overload_proto_formals ::=
      data_type { , data_type }

2.9 Interface declarations

modport_declaration ::=
      modport modport_item { , modport_item } ;
modport_clocking_declaration ::=
      clocking clocking_identifier
modport_simple_ports_declaration ::=
      port_direction modport_simple_port { , modport_simple_port }
modport_simple_port ::=
      port_identifier | . port_identifier ( [ expression ] )
modport_tf_ports_declaration ::=
      import_export modport_tf_port { , modport_tf_port }
modport_tf_port ::=
      method_prototype | tf_identifier
import_export ::=
      import | export

2.10 Assertion declarations

concurrent_assertion_item ::=
      [ block_identifier : ] concurrent_assertion_statement | checker_instantiation
assert_property_statement ::=
      assert property ( property_spec ) action_block
assume_property_statement ::=
      assume property ( property_spec ) action_block
cover_property_statement ::=
      cover property ( property_spec ) statement_or_null
expect_property_statement ::=
      expect ( property_spec ) action_block
cover_sequence_statement ::=
      cover sequence ( [ clocking_event ] [ disable iff ( expression_or_dist ) ] sequence_expr )
      statement_or_null
restrict_property_statement ::=
      restrict property ( property_spec ) ;
property_list_of_arguments ::=
      [ property_actual_arg ] { , [ property_actual_arg ] }
      { , . identifier ( [ property_actual_arg ] ) }
    | . identifier ( [ property_actual_arg ] ) { , . identifier ( [ property_actual_arg ] ) }
property_actual_arg ::=
      property_expr | sequence_actual_arg
assertion_item_declaration ::=
      property_declaration | sequence_declaration | let_declaration
property_declaration ::=
      property property_identifier [ ( [ property_port_list ] ) ] ;
      { assertion_variable_declaration } property_spec [ ; ] endproperty [ : property_identifier ]
property_port_list ::=
      property_port_item { , property_port_item }
property_lvar_port_direction ::=
      input
property_formal_type ::=
      sequence_formal_type | property
property_spec ::=
      [ clocking_event ] [ disable iff ( expression_or_dist ) ] property_expr
property_case_item ::=
      expression_or_dist { , expression_or_dist } : property_expr [ ; ]
    | default [ : ] property_expr [ ; ]
sequence_declaration ::=
      sequence sequence_identifier [ ( [ sequence_port_list ] ) ] ;
      { assertion_variable_declaration } sequence_expr [ ; ] endsequence [ : sequence_identifier ]
sequence_port_list ::=
      sequence_port_item { , sequence_port_item }
sequence_lvar_port_direction ::=
      input | inout | output
sequence_formal_type ::=
      data_type_or_implicit | sequence | untyped
cycle_delay_range ::=
      ## constant_primary | ## [ cycle_delay_const_range_expression ] | ##[*] | ##[+]
sequence_method_call ::=
      sequence_instance . method_identifier
sequence_list_of_arguments ::=
      [ sequence_actual_arg ] { , [ sequence_actual_arg ] }
      { , . identifier ( [ sequence_actual_arg ] ) }
    | . identifier ( [ sequence_actual_arg ] ) { , . identifier ( [ sequence_actual_arg ] ) }
sequence_actual_arg ::=
      event_expression | sequence_expr
sequence_abbrev ::=
      consecutive_repetition
consecutive_repetition ::=
      [* const_or_range_expression ] | [*] | [+]
non_consecutive_repetition ::=
      [= const_or_range_expression ]
goto_repetition ::=
      [-> const_or_range_expression ]
const_or_range_expression ::=
      constant_expression | cycle_delay_const_range_expression
cycle_delay_const_range_expression ::=
      constant_expression : constant_expression | constant_expression : $
expression_or_dist ::=
      expression [ dist { dist_list } ]
assertion_variable_declaration ::=
      var_data_type list_of_variable_decl_assignments ;
let_declaration ::=
      let let_identifier [ ( [ let_port_list ] ) ] = expression ;
let_identifier ::=
      identifier
let_port_list ::=
      let_port_item { , let_port_item }
let_formal_type ::=
      data_type_or_implicit | untyped
let_expression ::=
      [ package_scope ] let_identifier [ ( [ let_list_of_arguments ] ) ]
let_list_of_arguments ::=
      [ let_actual_arg ] { , [ let_actual_arg ] } { , . identifier ( [ let_actual_arg ] ) }
    | . identifier ( [ let_actual_arg ] ) { , . identifier ( [ let_actual_arg ] ) }
let_actual_arg ::=
      expression

2.11 Covergroup declarations

covergroup_declaration ::=
      covergroup covergroup_identifier [ ( [ tf_port_list ] ) ] [ coverage_event ] ;
      { coverage_spec_or_option } endgroup [ : covergroup_identifier ]
coverage_spec_or_option ::=
      { attribute_instance } coverage_spec | { attribute_instance } coverage_option ;
coverage_option ::=
      option . member_identifier = expression
    | type_option . member_identifier = constant_expression
coverage_spec ::=
      cover_point | cover_cross
coverage_event ::=
      clocking_event | with function sample ( [ tf_port_list ] ) | @@ ( block_event_expression )
cover_point ::=
      [ [ data_type_or_implicit ] cover_point_identifier : ] coverpoint expression
      [ iff ( expression ) ] bins_or_empty
bins_or_empty ::=
      { { attribute_instance } { bins_or_options ; } } | ;
bins_or_options ::=
      coverage_option
    | [ wildcard ] bins_keyword bin_identifier [ [ [ covergroup_expression ] ] ] = {
      covergroup_range_list } [ with ( with_covergroup_expression ) ] [ iff ( expression ) ]
    | [ wildcard ] bins_keyword bin_identifier [ [ [ covergroup_expression ] ] ] =
      cover_point_identifier [ with ( with_covergroup_expression ) ] [ iff ( expression ) ]
    | [ wildcard ] bins_keyword bin_identifier [ [ [ covergroup_expression ] ] ] =
      set_covergroup_expression [ iff ( expression ) ]
    | [ wildcard ] bins_keyword bin_identifier [ [ ] ] = trans_list [ iff ( expression ) ]
    | bins_keyword bin_identifier [ [ [ covergroup_expression ] ] ] = default
      [ iff ( expression ) ]
    | bins_keyword bin_identifier = default sequence [ iff ( expression ) ]
bins_keyword ::=
      bins | illegal_bins | ignore_bins
trans_list ::=
      ( trans_set ) { , ( trans_set ) }
trans_set ::=
      trans_range_list { => trans_range_list }
trans_range_list ::=
      trans_item
    | trans_item [* repeat_range ]
    | trans_item [-> repeat_range ]
    | trans_item [= repeat_range ]
trans_item ::=
      covergroup_range_list
cover_cross ::=
      [ cross_identifier : ] cross list_of_cross_items [ iff ( expression ) ] cross_body
list_of_cross_items ::=
      cross_item , cross_item { , cross_item }
cross_body ::=
      { { cross_body_item ; } } | ;
cross_body_item ::=
      function_declaraton | bins_selection_or_option ;
bins_selection_or_option ::=
      { attribute_instance } coverage_option | { attribute_instance } bins_selection
bins_selection ::=
      bins_keyword bin_identifier = select_expression [ iff ( expression ) ]
select_condition ::=
      binsof ( bins_expression ) [ intersect { covergroup_range_list } ]
covergroup_range_list ::=
      covergroup_value_range { , covergroup_value_range }
covergroup_value_range ::=
      covergroup_expression | [ covergroup_expression : covergroup_expression ]
with_covergroup_expression ::=
      covergroup_expression
set_covergroup_expression ::=
      covergroup_expression
integer_covergroup_expression ::=
      covergroup_expression
cross_set_expression ::=
      covergroup_expression
covergroup_expression ::=
      expression

3 Primitive instances

3.1 Primitive instantiation and instances

enable_gate_instance ::=
      [ name_of_instance ] ( output_terminal , input_terminal , enable_terminal )
mos_switch_instance ::=
      [ name_of_instance ] ( output_terminal , input_terminal , enable_terminal )
n_input_gate_instance ::=
      [ name_of_instance ] ( output_terminal , input_terminal { , input_terminal } )
n_output_gate_instance ::=
      [ name_of_instance ] ( output_terminal { , output_terminal } , input_terminal )
pass_switch_instance ::=
      [ name_of_instance ] ( inout_terminal , inout_terminal )
pass_enable_switch_instance ::=
      [ name_of_instance ] ( inout_terminal , inout_terminal , enable_terminal )
pull_gate_instance ::=
      [ name_of_instance ] ( output_terminal )

3.2 Primitive strengths

pulldown_strength ::=
      ( strength0 , strength1 ) | ( strength1 , strength0 ) | ( strength0 )
pullup_strength ::=
      ( strength0 , strength1 ) | ( strength1 , strength0 ) | ( strength1 )

3.3 Primitive terminals

enable_terminal ::=
      expression
inout_terminal ::=
      net_lvalue
input_terminal ::=
      expression
ncontrol_terminal ::=
      expression
output_terminal ::=
      net_lvalue
pcontrol_terminal ::=
      expression

3.4 Primitive gate and switch types

cmos_switchtype ::=
      cmos | rcmos
enable_gatetype ::=
      bufif0 | bufif1 | notif0 | notif1
mos_switchtype ::=
      nmos | pmos | rnmos | rpmos
n_input_gatetype ::=
      and | nand | or | nor | xor | xnor
n_output_gatetype ::=
      buf | not
pass_en_switchtype ::=
      tranif0 | tranif1 | rtranif1 | rtranif0
pass_switchtype ::=
      tran | rtran

4 Instantiations

4.1 Instantation

4.1.1 Module instantation

parameter_value_assignment ::=
      # ( [ list_of_parameter_assignments ] )
ordered_parameter_assignment ::=
      param_expression
named_parameter_assignment ::=
      . parameter_identifier ( [ param_expression ] )
hierarchical_instance ::=
      name_of_instance ( [ list_of_port_connections ] )
name_of_instance ::=
      instance_identifier { unpacked_dimension }
ordered_port_connection ::=
      { attribute_instance } [ expression ]
named_port_connection ::=
      { attribute_instance } . port_identifier [ ( [ expression ] ) ] | { attribute_instance } .*

4.1.2 Interface instantiation

4.1.3 Program instantiation

4.1.4 Checker instantiation

ordered_checker_port_connection ::=
      { attribute_instance } [ property_actual_arg ]
named_checker_port_connection ::=
      { attribute_instance } . formal_port_identifier [ ( [ property_actual_arg ] ) ]
    | { attribute_instance } .*

4.2 Generated instantiation

generate_region ::=
      generate { generate_item } endgenerate
loop_generate_construct ::=
      for ( genvar_initialization ; genvar_expression ; genvar_iteration ) generate_block
genvar_initialization ::=
      [ genvar ] genvar_identifier = constant_expression
conditional_generate_construct ::=
      if_generate_construct | case_generate_construct
if_generate_construct ::=
      if ( constant_expression ) generate_block [ else generate_block ]
case_generate_construct ::=
      case ( constant_expression ) case_generate_item { case_generate_item } endcase
case_generate_item ::=
      constant_expression { , constant_expression } : generate_block | default [ : ] generate_block

5 UDP declaration and instantiation

5.1 UDP declaration

udp_nonansi_declaration ::=
      { attribute_instance } primitive udp_identifier ( udp_port_list ) ;
udp_ansi_declaration ::=
      { attribute_instance } primitive udp_identifier ( udp_declaration_port_list ) ;

5.2 UDP ports

udp_declaration_port_list ::=
      udp_output_declaration , udp_input_declaration { , udp_input_declaration }
udp_port_declaration ::=
      udp_output_declaration ; | udp_input_declaration ; | udp_reg_declaration ;
udp_output_declaration ::=
      { attribute_instance } output port_identifier
    | { attribute_instance } output reg port_identifier [ = constant_expression ]
udp_input_declaration ::=
      { attribute_instance } input list_of_udp_port_identifiers
udp_reg_declaration ::=
      { attribute_instance } reg variable_identifier

5.3 UDP body

udp_body ::=
      combinational_body | sequential_body
combinational_body ::=
      table combinational_entry { combinational_entry } endtable
combinational_entry ::=
      level_input_list : output_symbol ;
sequential_body ::=
      [ udp_initial_statement ] table sequential_entry { sequential_entry } endtable
udp_initial_statement ::=
      initial output_port_identifier = init_val ;
init_val ::=
      1'b0 | 1'b1 | 1'bx | 1'bX | 1'B0 | 1'B1 | 1'Bx | 1'BX | 1 | 0
sequential_entry ::=
      seq_input_list : current_state : next_state ;
seq_input_list ::=
      level_input_list | edge_input_list
level_input_list ::=
      level_symbol { level_symbol }
edge_input_list ::=
      { level_symbol } edge_indicator { level_symbol }
edge_indicator ::=
      ( level_symbol level_symbol ) | edge_symbol
current_state ::=
      level_symbol
next_state ::=
      output_symbol | -
output_symbol ::=
      0 | 1 | x | X
level_symbol ::=
      0 | 1 | x | X | ? | b | B
edge_symbol ::=
      r | R | f | F | p | P | n | N | *

5.4 UDP instantiation

udp_instantiation ::=
      udp_identifier [ drive_strength ] [ delay2 ] udp_instance { , udp_instance } ;
udp_instance ::=
      [ name_of_instance ] ( output_terminal , input_terminal { , input_terminal } )

6 Behavioral assignments

6.1 Continuous assignment and net alias statements

continuous_assign ::=
      assign [ drive_strength ] [ delay3 ] list_of_net_assignments ;
    | assign [ delay_control ] list_of_variable_assignments ;
list_of_net_assignments ::=
      net_assignment { , net_assignment }
list_of_variable_assignments ::=
      variable_assignment { , variable_assignment }
net_alias ::=
      alias net_lvalue = net_lvalue { = net_lvalue } ;
net_assignment ::=
      net_lvalue = expression

6.2 Procedural blocks and assignments

initial_construct ::=
      initial statement_or_null
always_construct ::=
      always_keyword statement
always_keyword ::=
      always | always_comb | always_latch | always_ff
final_construct ::=
      final function_statement
operator_assignment ::=
      variable_lvalue assignment_operator expression
assignment_operator ::=
      = | += | -= | *= | /= | %= | &= | |= | ^= | <<= | >>= | <<<= | >>>=
nonblocking_assignment ::=
      variable_lvalue <= [ delay_or_event_control ] expression
procedural_continuous_assignment ::=
      assign variable_assignment
    | deassign variable_lvalue
    | force variable_assignment
    | force net_assignment
    | release variable_lvalue
    | release net_lvalue
variable_assignment ::=
      variable_lvalue = expression

6.3 Parallel and sequential blocks

action_block ::=
      statement_or_null | [ statement ] else statement_or_null
seq_block ::=
      begin [ : block_identifier ] { block_item_declaration } { statement_or_null } end
      [ : block_identifier ]
join_keyword ::=
      join | join_any | join_none

6.5 Timing control statements

procedural_timing_control_statement ::=
      procedural_timing_control statement_or_null
delay_or_event_control ::=
      delay_control | event_control | repeat ( expression ) event_control
delay_control ::=
      # delay_value | # ( mintypmax_expression )
procedural_timing_control ::=
      delay_control | event_control | cycle_delay
jump_statement ::=
      return [ expression ] ; | break ; | continue ;
wait_statement ::=
      wait ( expression ) statement_or_null
    | wait fork ;
    | wait_order ( hierarchical_identifier { , hierarchical_identifier } ) action_block
disable_statement ::=
      disable hierarchical_task_identifier ;
    | disable hierarchical_block_identifier ;
    | disable fork ;

6.6 Conditional statements

conditional_statement ::=
      [ unique_priority ] if ( cond_predicate ) statement_or_null
      { else if ( cond_predicate ) statement_or_null } [ else statement_or_null ]
unique_priority ::=
      unique | unique0 | priority
expression_or_cond_pattern ::=
      expression | cond_pattern
cond_pattern ::=
      expression matches pattern

6.7 Case statements

case_keyword ::=
      case | casez | casex
case_expression ::=
      expression
case_pattern_item ::=
      pattern [ &&& expression ] : statement_or_null | default [ : ] statement_or_null
case_inside_item ::=
      open_range_list : statement_or_null | default [ : ] statement_or_null
case_item_expression ::=
      expression
randcase_statement ::=
      randcase randcase_item { randcase_item } endcase
randcase_item ::=
      expression : statement_or_null
open_range_list ::=
      open_value_range { , open_value_range }
open_value_range ::=
      value_range

6.7.1 Patterns

structure_pattern_key ::=
      member_identifier | assignment_pattern_key
array_pattern_key ::=
      constant_expression | assignment_pattern_key
assignment_pattern_key ::=
      simple_type | default
assignment_pattern_expression ::=
      [ assignment_pattern_expression_type ] assignment_pattern
assignment_pattern_expression_type ::=
      ps_type_identifier | ps_parameter_identifier | integer_atom_type | type_reference
constant_assignment_pattern_expression ::=
      assignment_pattern_expression
assignment_pattern_net_lvalue ::=
      '{ net_lvalue { , net_lvalue } }
assignment_pattern_variable_lvalue ::=
      '{ variable_lvalue { , variable_lvalue } }

6.8 Looping statements

for_variable_declaration ::=
      [ var ] data_type variable_identifier = expression { , variable_identifier = expression }
for_step ::=
      for_step_assignment { , for_step_assignment }
loop_variables ::=
      [ index_variable_identifier ] { , [ index_variable_identifier ] }

6.9 Subroutine call statements

subroutine_call_statement ::=
      subroutine_call ; | void ' ( function_subroutine_call ) ;

6.10 Assertion statements

deferred_immediate_assertion_item ::=
      [ block_identifier : ] deferred_immediate_assertion_statement
simple_immediate_assert_statement ::=
      assert ( expression ) action_block
simple_immediate_assume_statement ::=
      assume ( expression ) action_block
simple_immediate_cover_statement ::=
      cover ( expression ) statement_or_null
deferred_immediate_assert_statement ::=
      assert #0 ( expression ) action_block | assert final ( expression ) action_block
deferred_immediate_assume_statement ::=
      assume #0 ( expression ) action_block | assume final ( expression ) action_block
deferred_immediate_cover_statement ::=
      cover #0 ( expression ) statement_or_null | cover final ( expression ) statement_or_null

6.11 Clocking block

clocking_declaration ::=
      [ default ] clocking [ clocking_identifier ] clocking_event ; { clocking_item } endclocking
      [ : clocking_identifier ]
    | global clocking [ clocking_identifier ] clocking_event ; endclocking [ : clocking_identifier ]
clocking_event ::=
      @ identifier | @ ( event_expression )
default_skew ::=
      input clocking_skew | output clocking_skew | input clocking_skew output clocking_skew
clocking_direction ::=
      input [ clocking_skew ]
    | output [ clocking_skew ]
    | input [ clocking_skew ] output [ clocking_skew ]
    | inout
list_of_clocking_decl_assign ::=
      clocking_decl_assign { , clocking_decl_assign }
clocking_decl_assign ::=
      signal_identifier [ = expression ]
clocking_skew ::=
      edge_identifier [ delay_control ] | delay_control
clocking_drive ::=
      clockvar_expression <= [ cycle_delay ] expression
cycle_delay ::=
      ## integral_number | ## identifier | ## ( expression )
clockvar ::=
      hierarchical_identifier
clockvar_expression ::=
      clockvar select

6.12 Rand sequence

randsequence_statement ::=
      randsequence ( [ production_identifier ] ) production { production } endsequence
production ::=
      [ data_type_or_void ] production_identifier [ ( tf_port_list ) ] : rs_rule { | rs_rule } ;
rs_production_list ::=
      rs_prod { rs_prod }
    | rand join [ ( expression ) ] production_item production_item { production_item }
weight_specification ::=
      integral_number | ps_identifier ( expression )
rs_code_block ::=
      { { data_declaration } { statement_or_null } }
production_item ::=
      production_identifier [ ( list_of_arguments ) ]
rs_if_else ::=
      if ( expression ) production_item [ else production_item ]
rs_repeat ::=
      repeat ( expression ) production_item
rs_case ::=
      case ( case_expression ) rs_case_item { rs_case_item } endcase
rs_case_item ::=
      case_item_expression { , case_item_expression } : production_item ;
    | default [ : ] production_item ;

7 Specify section

7.1 Specify block declaration

specify_block ::=
      specify { specify_item } endspecify
pulsestyle_declaration ::=
      pulsestyle_onevent list_of_path_outputs ; | pulsestyle_ondetect list_of_path_outputs ;
showcancelled_declaration ::=
      showcancelled list_of_path_outputs ; | noshowcancelled list_of_path_outputs ;

7.3 Specify block terminals

specify_input_terminal_descriptor ::=
      input_identifier [ [ constant_range_expression ] ]
specify_output_terminal_descriptor ::=
      output_identifier [ [ constant_range_expression ] ]

7.4 Specify path delays

t_path_delay_expression ::=
      path_delay_expression
trise_path_delay_expression ::=
      path_delay_expression
tfall_path_delay_expression ::=
      path_delay_expression
tz_path_delay_expression ::=
      path_delay_expression
t01_path_delay_expression ::=
      path_delay_expression
t10_path_delay_expression ::=
      path_delay_expression
t0z_path_delay_expression ::=
      path_delay_expression
tz1_path_delay_expression ::=
      path_delay_expression
t1z_path_delay_expression ::=
      path_delay_expression
tz0_path_delay_expression ::=
      path_delay_expression
t0x_path_delay_expression ::=
      path_delay_expression
tx1_path_delay_expression ::=
      path_delay_expression
t1x_path_delay_expression ::=
      path_delay_expression
tx0_path_delay_expression ::=
      path_delay_expression
txz_path_delay_expression ::=
      path_delay_expression
tzx_path_delay_expression ::=
      path_delay_expression
path_delay_expression ::=
      constant_mintypmax_expression
full_edge_sensitive_path_description ::=
      ( [ edge_identifier ] list_of_path_inputs [ polarity_operator ] *> ( list_of_path_outputs
      [ polarity_operator ] : data_source_expression ) )
data_source_expression ::=
      expression
edge_identifier ::=
      posedge | negedge | edge
polarity_operator ::=
      + | -

7.5 System timing checks

7.5.1 System timing check commands

setup_timing_check ::=
      $setup ( data_event , reference_event , timing_check_limit [ , [ notifier ] ] ) ;
hold_timing_check ::=
      $hold ( reference_event , data_event , timing_check_limit [ , [ notifier ] ] ) ;
setuphold_timing_check ::=
      $setuphold ( reference_event , data_event , timing_check_limit , timing_check_limit
      [ , [ notifier ]
        [ , [ timestamp_condition ]
          [ , [ timecheck_condition ] [ , [ delayed_reference ] [ , [ delayed_data ] ] ] ] ] ]
      ) ;
recovery_timing_check ::=
      $recovery ( reference_event , data_event , timing_check_limit [ , [ notifier ] ] ) ;
removal_timing_check ::=
      $removal ( reference_event , data_event , timing_check_limit [ , [ notifier ] ] ) ;
recrem_timing_check ::=
      $recrem ( reference_event , data_event , timing_check_limit , timing_check_limit
      [ , [ notifier ]
        [ , [ timestamp_condition ]
          [ , [ timecheck_condition ] [ , [ delayed_reference ] [ , [ delayed_data ] ] ] ] ] ]
      ) ;
skew_timing_check ::=
      $skew ( reference_event , data_event , timing_check_limit [ , [ notifier ] ] ) ;
timeskew_timing_check ::=
      $timeskew ( reference_event , data_event , timing_check_limit
      [ , [ notifier ] [ , [ event_based_flag ] [ , [ remain_active_flag ] ] ] ] ) ;
fullskew_timing_check ::=
      $fullskew ( reference_event , data_event , timing_check_limit , timing_check_limit
      [ , [ notifier ] [ , [ event_based_flag ] [ , [ remain_active_flag ] ] ] ] ) ;
period_timing_check ::=
      $period ( controlled_reference_event , timing_check_limit [ , [ notifier ] ] ) ;
width_timing_check ::=
      $width ( controlled_reference_event , timing_check_limit , threshold [ , [ notifier ] ] ) ;
nochange_timing_check ::=
      $nochange ( reference_event , data_event , start_edge_offset , end_edge_offset
      [ , [ notifier ] ] ) ;

7.5.2 System timing check command arguments

timecheck_condition ::=
      mintypmax_expression
controlled_reference_event ::=
      controlled_timing_check_event
data_event ::=
      timing_check_event
end_edge_offset ::=
      mintypmax_expression
event_based_flag ::=
      constant_expression
notifier ::=
      variable_identifier
reference_event ::=
      timing_check_event
remain_active_flag ::=
      constant_mintypmax_expression
timestamp_condition ::=
      mintypmax_expression
start_edge_offset ::=
      mintypmax_expression
threshold ::=
      constant_expression
timing_check_limit ::=
      expression

7.5.3 System timing check event definitions

controlled_timing_check_event ::=
      timing_check_event_control specify_terminal_descriptor [ &&& timing_check_condition ]
timing_check_event_control ::=
      posedge | negedge | edge | edge_control_specifier
edge_control_specifier ::=
      edge [ edge_descriptor { , edge_descriptor } ]
edge_descriptor ::=
      01 | 10 | z_or_x zero_or_one | zero_or_one z_or_x
zero_or_one ::=
      0 | 1
z_or_x ::=
      x | X | z | Z
timing_check_condition ::=
      scalar_timing_check_condition | ( scalar_timing_check_condition )
scalar_constant ::=
      1'b0 | 1'b1 | 1'B0 | 1'B1 | 'b0 | 'b1 | 'B0 | 'B1 | 1 | 0

8 Expressions

8.1 Concatenations

concatenation ::=
      { expression { , expression } }
constant_concatenation ::=
      { constant_expression { , constant_expression } }
constant_multiple_concatenation ::=
      { constant_expression constant_concatenation }
module_path_concatenation ::=
      { module_path_expression { , module_path_expression } }
module_path_multiple_concatenation ::=
      { constant_expression module_path_concatenation }
multiple_concatenation ::=
      { expression concatenation }
streaming_concatenation ::=
      { stream_operator [ slice_size ] stream_concatenation }
stream_operator ::=
      >> | <<
slice_size ::=
      simple_type | constant_expression
stream_concatenation ::=
      { stream_expression { , stream_expression } }
stream_expression ::=
      expression [ with [ array_range_expression ] ]
array_range_expression ::=
      expression | expression : expression | expression +: expression | expression -: expression
empty_queue ::=
      { }

8.2 Subroutine calls

constant_function_call ::=
      function_subroutine_call
subroutine_call ::=
      tf_call | system_tf_call | method_call | [ std:: ] randomize_call
function_subroutine_call ::=
      subroutine_call
list_of_arguments ::=
      [ expression ] { , [ expression ] } { , . identifier ( [ expression ] ) }
    | . identifier ( [ expression ] ) { , . identifier ( [ expression ] ) }
method_call ::=
      method_call_root . method_call_body
built_in_method_call ::=
      array_manipulation_call | randomize_call
array_manipulation_call ::=
      array_method_name { attribute_instance } [ ( list_of_arguments ) ] [ with ( expression ) ]
randomize_call ::=
      randomize { attribute_instance } [ ( [ variable_identifier_list | null ] ) ]
      [ with [ ( [ identifier_list ] ) ] constraint_block ]
method_call_root ::=
      primary | implicit_class_handle
array_method_name ::=
      method_identifier | unique | and | or | xor

8.3 Expressions

conditional_expression ::=
      cond_predicate ? { attribute_instance } expression : expression
constant_param_expression ::=
      constant_mintypmax_expression | data_type | $
param_expression ::=
      mintypmax_expression | data_type | $
constant_range_expression ::=
      constant_expression | constant_part_select_range
constant_part_select_range ::=
      constant_range | constant_indexed_range
constant_range ::=
      constant_expression : constant_expression
tagged_union_expression ::=
      tagged member_identifier [ expression ]
inside_expression ::=
      expression inside { open_range_list }
value_range ::=
      expression | [ expression : expression ]
mintypmax_expression ::=
      expression | expression : expression : expression
module_path_conditional_expression ::=
      module_path_expression ? { attribute_instance } module_path_expression :
      module_path_expression
part_select_range ::=
      constant_range | indexed_range
genvar_expression ::=
      constant_expression

8.4 Primaries

class_qualifier ::=
      [ local:: ] [ implicit_class_handle . | class_scope ]
range_expression ::=
      expression | part_select_range
time_unit ::=
      s | ms | us | ns | ps | fs
implicit_class_handle ::=
      this | super | this . super
bit_select ::=
      { [ expression ] }
nonrange_select ::=
      [ { . member_identifier bit_select } . member_identifier ] bit_select
constant_bit_select ::=
      { [ constant_expression ] }
constant_cast ::=
      casting_type ' ( constant_expression )
constant_let_expression ::=
      let_expression
cast ::=
      casting_type ' ( expression )

8.6 Operators

unary_operator ::=
      + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
binary_operator ::=
      +
    | -
    | *
    | /
    | %
    | ==
    | !=
    | ===
    | !==
    | ==?
    | !=?
    | &&
    | ||
    | **
    | <
    | <=
    | >
    | >=
    | &
    | |
    | ^
    | ^~
    | ~^
    | >>
    | <<
    | >>>
    | <<<
    | ->
    | <->
inc_or_dec_operator ::=
      ++ | --
unary_module_path_operator ::=
      ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
binary_module_path_operator ::=
      == | != | && | || | & | | | ^ | ^~ | ~^

8.7 Numbers

number ::=
      integral_number | real_number
integral_number ::=
      decimal_number | octal_number | binary_number | hex_number
decimal_number ::=
      unsigned_number
    | [ size ] decimal_base unsigned_number
    | [ size ] decimal_base x_digit { _ }
    | [ size ] decimal_base z_digit { _ }
binary_number ::=
      [ size ] binary_base binary_value
octal_number ::=
      [ size ] octal_base octal_value
hex_number ::=
      [ size ] hex_base hex_value
sign ::=
      + | -
non_zero_unsigned_number ::=
      non_zero_decimal_digit { _ | decimal_digit }
fixed_point_number ::=
      unsigned_number . unsigned_number
exp ::=
      e | E
unsigned_number ::=
      decimal_digit { _ | decimal_digit }
binary_value ::=
      binary_digit { _ | binary_digit }
octal_value ::=
      octal_digit { _ | octal_digit }
hex_value ::=
      hex_digit { _ | hex_digit }
decimal_base ::=
      ' [ s | S ] d | ' [ s | S ] D
binary_base ::=
      ' [ s | S ] b | ' [ s | S ] B
octal_base ::=
      ' [ s | S ] o | ' [ s | S ] O
hex_base ::=
      ' [ s | S ] h | ' [ s | S ] H
non_zero_decimal_digit ::=
      1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
decimal_digit ::=
      0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
binary_digit ::=
      x_digit | z_digit | 0 | 1
octal_digit ::=
      x_digit | z_digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
hex_digit ::=
      x_digit
    | z_digit
    | 0
    | 1
    | 2
    | 3
    | 4
    | 5
    | 6
    | 7
    | 8
    | 9
    | a
    | b
    | c
    | d
    | e
    | f
    | A
    | B
    | C
    | D
    | E
    | F
x_digit ::=
      x | X
z_digit ::=
      z | Z | ?
unbased_unsized_literal ::=
      '0 | '1 | 'z_or_x

8.8 Strings

string_literal ::=
      " { Any_ASCII_Characters } "

9 General

9.1 Attributes

attribute_instance ::=
      (* attr_spec { , attr_spec } *)
attr_spec ::=
      attr_name [ = constant_expression ]
attr_name ::=
      identifier

9.2 Comments

comment ::=
      one_line_comment | block_comment
one_line_comment ::=
      // comment_text new_line_char
block_comment ::=
      /* comment_text */
comment_text ::=
      { Any_ASCII_character }

9.3 Identifiers

array_identifier ::=
      identifier
block_identifier ::=
      identifier
bin_identifier ::=
      identifier
c_identifier ::=
      [ a-zA-Z_ ] { [ a-zA-Z0-9_ ] }
cell_identifier ::=
      identifier
checker_identifier ::=
      identifier
class_identifier ::=
      identifier
class_variable_identifier ::=
      variable_identifier
clocking_identifier ::=
      identifier
config_identifier ::=
      identifier
const_identifier ::=
      identifier
constraint_identifier ::=
      identifier
covergroup_identifier ::=
      identifier
covergroup_variable_identifier ::=
      variable_identifier
cover_point_identifier ::=
      identifier
cross_identifier ::=
      identifier
dynamic_array_variable_identifier ::=
      variable_identifier
enum_identifier ::=
      identifier
formal_identifier ::=
      identifier
formal_port_identifier ::=
      identifier
function_identifier ::=
      identifier
generate_block_identifier ::=
      identifier
genvar_identifier ::=
      identifier
hierarchical_array_identifier ::=
      hierarchical_identifier
hierarchical_block_identifier ::=
      hierarchical_identifier
hierarchical_event_identifier ::=
      hierarchical_identifier
hierarchical_identifier ::=
      [ $root . ] { identifier constant_bit_select . } identifier
hierarchical_net_identifier ::=
      hierarchical_identifier
hierarchical_parameter_identifier ::=
      hierarchical_identifier
hierarchical_property_identifier ::=
      hierarchical_identifier
hierarchical_sequence_identifier ::=
      hierarchical_identifier
hierarchical_task_identifier ::=
      hierarchical_identifier
hierarchical_tf_identifier ::=
      hierarchical_identifier
hierarchical_variable_identifier ::=
      hierarchical_identifier
identifier ::=
      simple_identifier | escaped_identifier
index_variable_identifier ::=
      identifier
interface_identifier ::=
      identifier
interface_instance_identifier ::=
      identifier
inout_port_identifier ::=
      identifier
input_port_identifier ::=
      identifier
instance_identifier ::=
      identifier
library_identifier ::=
      identifier
member_identifier ::=
      identifier
method_identifier ::=
      identifier
modport_identifier ::=
      identifier
module_identifier ::=
      identifier
net_identifier ::=
      identifier
net_type_identifier ::=
      identifier
output_port_identifier ::=
      identifier
package_identifier ::=
      identifier
package_scope ::=
      package_identifier :: | $unit ::
parameter_identifier ::=
      identifier
port_identifier ::=
      identifier
production_identifier ::=
      identifier
program_identifier ::=
      identifier
property_identifier ::=
      identifier
ps_class_identifier ::=
      [ package_scope ] class_identifier
ps_covergroup_identifier ::=
      [ package_scope ] covergroup_identifier
ps_checker_identifier ::=
      [ package_scope ] checker_identifier
ps_identifier ::=
      [ package_scope ] identifier
ps_or_hierarchical_array_identifier ::=
      [ implicit_class_handle . | class_scope | package_scope ] hierarchical_array_identifier
ps_or_hierarchical_net_identifier ::=
      [ package_scope ] net_identifier | hierarchical_net_identifier
ps_or_hierarchical_property_identifier ::=
      [ package_scope ] property_identifier | hierarchical_property_identifier
ps_or_hierarchical_sequence_identifier ::=
      [ package_scope ] sequence_identifier | hierarchical_sequence_identifier
ps_or_hierarchical_tf_identifier ::=
      [ package_scope ] tf_identifier | hierarchical_tf_identifier
ps_type_identifier ::=
      [ local:: | package_scope ] type_identifier
sequence_identifier ::=
      identifier
signal_identifier ::=
      identifier
simple_identifier ::=
      [ a-zA-Z_ ] { [ a-zA-Z0-9_$ ] }
specparam_identifier ::=
      identifier
system_tf_identifier ::=
      $ [ a-zA-Z0-9_$ ] { [ a-zA-Z0-9_$ ] }
task_identifier ::=
      identifier
tf_identifier ::=
      identifier
terminal_identifier ::=
      identifier
topmodule_identifier ::=
      identifier
type_identifier ::=
      identifier
udp_identifier ::=
      identifier
variable_identifier ::=
      identifier
Note: This prototype contains sections 1–2 (Source text & Declarations) to demonstrate the design. To populate the full grammar, replace the BNF_DATA object in the script with all sections from the original index.html. Each section entry follows the same { title, subsections: [{ id, heading, rules: [{ id, body }] }] } structure.
⋮⋮
Scratchpad 0
Drag any rule here
to pin it for reference