Posted on 2018-06-27 by Sigasi
Tagged as: Ebnf

Portable Test and Stimulus Standard Version 1.0

Copyright © 2017 - 2018 Accellera. All rights reserved.

Get the full Language Reference Manual, free of charge, at http://www.accellera.org/downloads/standards/portable-stimulus 

Sigasi has created this browsable version of the grammar, hoping that it would be useful to you, but without any warranty whatsoever.

More browsable grammars of Hardware Description and Verification languages.

Formal syntax

The PSS formal syntax is described using Backus-Naur Form (BNF). The syntax of the PSS source is derived from the starting symbol Model. If there is a conflict between a grammar element shown anywhere in this Standard and the material in this annex, the material shown in this annex shall take precedence.
Model
{ portable_stimulus_description }
portable_stimulus_description
package_body_item
| package_declaration
| component_declaration

B.1 Package declarations

package_declaration
package package_identifier { { package_body_item } } [ ; ]
package_body_item
abstract_action_declaration
| struct_declaration
| enum_declaration
| covergroup_declaration
| function_decl
| import_class_decl
| function_qualifiers
| export_action
| typedef_declaration
| import_stmt
| extend_stmt
| const_field_declaration
| static_const_field_declaration
| compile_assert_stmt
| package_body_compile_if
import_stmt
import package_import_pattern ;
package_import_pattern
type_identifier [ :: * ]
extend_stmt
extend action type_identifier { { action_body_item } } [ ; ]
| extend component type_identifier { { component_body_item } } [ ; ]
| extend struct_kind type_identifier { { struct_body_item } } [ ; ]
| extend enum type_identifier { [ enum_item { , enum_item } ] } [ ; ]
const_field_declaration
const const_data_declaration
const_data_declaration
scalar_data_type const_data_instantiation { , const_data_instantiation } ;
const_data_instantiation
identifier = constant_expression
static_const_field_declaration
static const const_data_declaration

B.2 Action declarations

action_declaration
action action_identifier [ action_super_spec ] { { action_body_item } } [ ; ]
abstract_action_declaration
abstract action action_identifier [ action_super_spec ] { { action_body_item } } [ ; ]
action_super_spec
: type_identifier
action_body_item
activity_declaration
| overrides_declaration
| constraint_declaration
| action_field_declaration
| symbol_declaration
| covergroup_declaration
| exec_block_stmt
| static_const_field_declaration
| action_scheduling_constraint
| attr_group
| compile_assert_stmt
| inline_covergroup
| action_body_compile_if
activity_declaration
activity { { [ identifier : ] activity_stmt } } [ ; ]
action_field_declaration
object_ref_field
| attr_field
| action_handle_declaration
| activity_data_field
object_ref_field
flow_ref_field
| resource_ref_field
flow_ref_field
( input | output ) flow_object_type identifier { , identifier } ;
resource_ref_field
( lock | share ) resource_object_type identifier { , identifier } ;
flow_object_type
type_identifier
resource_object_type
type_identifier
attr_field
[ access_modifier ] [ rand ] data_declaration
access_modifier
public
| protected
| private
attr_group
access_modifier :
action_handle_declaration
action_type identifier [ array_dim ] ;
activity_data_field
action data_declaration
action_scheduling_constraint
constraint ( parallel | sequence ) { hierarchical_id { , hierarchical_id } } ;
Exec blocks
exec_block_stmt
exec_block
| target_code_exec_block
| target_file_exec_block
exec_block
exec exec_kind_identifier { { exec_body_stmt } } [ ; ]
exec_kind_identifier
pre_solve
| post_solve
| body
| header
| declaration
| run_start
| run_end
| init
exec_body_stmt
expression [ assign_op expression ] ;
assign_op
=
| +=
| -=
| <<=
| >>=
| |=
| &=
target_code_exec_block
exec exec_kind_identifier language_identifier = string ;
target_file_exec_block
exec file filename_string = string ;

B.3 Struct declarations

struct_declaration
struct_kind identifier [ : struct_identifier ] { { struct_body_item } } [ ; ]
struct_kind
struct
| object_kind
object_kind
buffer
| stream
| state
| resource
struct_body_item
constraint_declaration
| attr_field
| typedef_declaration
| covergroup_declaration
| exec_block_stmt
| static_const_field_declaration
| attr_group
| compile_assert_stmt
| inline_covergroup
| struct_body_compile_if

B.4 Procedural interface (PI)

function_decl
function method_prototype ;
method_prototype
method_return_type method_identifier method_parameter_list_prototype
method_return_type
void
| data_type
method_parameter_list_prototype
( [ method_parameter { , method_parameter } ] )
method_parameter
[ method_parameter_dir ] data_type identifier
method_parameter_dir
input
| output
| inout
function_qualifiers
import import_function_qualifiers function type_identifier ;
import_function_qualifiers
method_qualifiers [ language_identifier ]
| language_identifier
method_qualifiers
target
| solve
import_method_target_template
target language_identifier function method_prototype = string ;
method_parameter_list
( [ expression { , expression } ] )

B.4.1 Import class declaration

import_class_decl
import class import_class_identifier [ import_class_extends ] { { import_class_method_decl } } [ ; ]
import_class_extends
: type_identifier { , type_identifier }
import_class_method_decl
method_prototype ;

B.4.2 Export action

export_action
export [ method_qualifiers ] action_type_identifier method_parameter_list_prototype ;

B.5 Component declarations

component_declaration
component component_identifier [ : component_super_spec ] { { component_body_item } } [ ; ]
component_super_spec
: type_identifier
component_body_item
overrides_declaration
| component_field_declaration
| action_declaration
| object_bind_stmt
| exec_block
| package_body_item
| attr_group
| component_body_compile_if
component_field_declaration
component_data_declaration
| component_pool_declaration
component_data_declaration
[ static const ] data_declaration
component_pool_declaration
pool [ [ expression ] ] type_identifier identifier ;
object_bind_stmt
bind hierarchical_id object_bind_item_or_list ;
object_bind_item_or_list
component_path
| { component_path { , component_path } }
component_path
component_identifier { . component_path_elem }
| *
component_path_elem
component_action_identifier
| *

B.6 Activity statements

activity_stmt
[ identifier : ] labeled_activity_stmt
| activity_data_field
| activity_bind_stmt
| action_handle_declaration
| activity_constraint_stmt
| action_scheduling_constraint
labeled_activity_stmt
activity_if_else_stmt
| activity_repeat_stmt
| activity_foreach_stmt
| activity_action_traversal_stmt
| activity_sequence_block_stmt
| activity_select_stmt
| activity_match_stmt
| activity_parallel_stmt
| activity_schedule_stmt
| activity_super_stmt
| function_symbol_call
activity_if_else_stmt
if ( expression ) activity_stmt [ else activity_stmt ]
activity_repeat_stmt
while ( expression ) activity_stmt
| repeat ( [ identifier : ] expression ) activity_stmt
| repeat activity_stmt [ while ( expression ) ; ]
activity_sequence_block_stmt
[ sequence ] { { activity_stmt } }
activity_constraint_stmt
constraint { { constraint_body_item } }
| constraint single_stmt_constraint
activity_foreach_stmt
foreach ( [ iterator_identifier : ] expression [ [ index_identifier ] ] ) activity_stmt
activity_action_traversal_stmt
identifier [ inline_with_constraint ]
| do type_identifier [ inline_with_constraint ] ;
inline_with_constraint
with { { constraint_body_item } }
| with single_stmt_constraint
activity_select_stmt
select { select_branch select_branch { select_branch } }
select_branch
[ [ ( expression ) ] [ [ expression ] ] : ] activity_stmt
activity_match_stmt
match ( expression ) { match_choice { match_choice } }
match_choice
[ open_range_list ] : activity_stmt
| default : activity_stmt
activity_parallel_stmt
parallel { { activity_stmt } } [ ; ]
activity_schedule_stmt
schedule { { activity_stmt } } [ ; ]
activity_bind_stmt
bind hierarchical_id activity_bind_item_or_list ;
activity_bind_item_or_list
hierarchical_id
| { hierarchical_id { , hierarchical_id } }
symbol_declaration
symbol identifier [ ( symbol_paramlist ) ] { { activity_stmt } }
symbol_paramlist
[ symbol_param { , symbol_param } ]
symbol_param
data_type identifier
activity_super_stmt
super ;

B.7 Overrides

overrides_declaration
override { { override_stmt } }
override_stmt
type_override
| instance_override
type_override
type type_identifier with type_identifier ;
instance_override
instance hierarchical_id with identifier ;

B.8 Data declarations

data_declaration
data_type data_instantiation { , data_instantiation } ;
data_instantiation
covergroup_instantiation
| plain_data_instantiation
covergroup_portmap_list
[ covergroup_portmap { , covergroup_portmap } | hierarchical_id { , hierarchical_id } ]
covergroup_portmap
. identifier ( hierarchical_id )
array_dim
[ constant_expression ]

B.9 Data types

data_type
scalar_data_type
| user_defined_datatype
action_data_type
scalar_data_type
| user_defined_datatype
| action_type
scalar_data_type
chandle_type
| integer_type
| string_type
| bool_type
chandle_type
chandle
integer_type
integer_atom_type [ [ expression [ : expression ] ] ] [ in [ domain_open_range_list ] ]
integer_atom_type
int
| bit
domain_open_range_list
domain_open_range_value { , domain_open_range_value }
domain_open_range_value
expression [ .. expression ]
| expression ..
| .. expression
| expression
string_type
string [ in [ DOUBLE_QUOTED_STRING { , DOUBLE_QUOTED_STRING } ] ]
bool_type
bool
user_defined_datatype
type_identifier
action_type
type_identifier
enum_declaration
enum enum_identifier { [ enum_item { , enum_item } ] } [ ; ]
enum_item
identifier [ = constant_expression ]
enum_type
enum_type_identifier [ in [ open_range_list ] ]
enum_type_identifier
type_identifier
typedef_declaration
typedef data_type identifier ;

B.10 Constraint

constraint_declaration
[ dynamic ] constraint identifier { { constraint_body_item } }
| constraint { { constraint_body_item } }
| constraint single_stmt_constraint
constraint_body_item
expression_constraint_item
| foreach_constraint_item
| if_constraint_item
| unique_constraint_item
expression_constraint_item
expression implicand_constraint_item
| expression ;
implicand_constraint_item
-> constraint_set
constraint_set
constraint_body_item
| constraint_block
constraint_block
{ { constraint_body_item } }
foreach_constraint_item
foreach ( [ iterator_identifier : ] expression [ [ index_identifier ] ] ) constraint_set
if_constraint_item
if ( expression ) constraint_set [ else constraint_set ]
unique_constraint_item
unique { open_range_list } ;
single_stmt_constraint
expression_constraint_item
| unique_constraint_item

B.11 Coverage specification

covergroup_declaration
coverspec covergroup_identifier ( covergroup_port { , covergroup_port } ) { { covergroup_body_item } } [ ; ]
covergroup_expression
expression
covergroup_port
data_type identifier
covergroup_body_item
covergroup_option
| covergroup_coverpoint
| covergroup_cross
covergroup_option
option . identifier = constant_expression ;
inline_covergroup
covergroup { { covergroup_body_item } } identifier ;
covergroup_instantiation
covergroup_identifier [ ( covergroup_portmap_list ) ] [ with { { covergroup_option } } ]
plain_data_instantiation
identifier [ array_dim ] [ = constant_expression ]
covergroup_coverpoint
[ [ data_type ] coverpoint_identifier : ] coverpoint expression [ iff ( expression ) ] bins_or_empty
bins_or_empty
{ { covergroup_coverpoint_body_item } } [ ; ]
| ;
covergroup_coverpoint_body_item
covergroup_option
| covergroup_coverpoint_binspec
covergroup_coverpoint_binspec
bins_keyword identifier [ [ constant_expression ] ] = coverpoint_bins
coverpoint_bins
[ covergroup_range_list ] [ with ( covergroup_expression ) ] ;
| coverpoint_identifier with ( covergroup_expression ) ;
| default ;
covergroup_range_list
covergroup_value_range { , covergroup_value_range }
covergroup_value_range
expression
| expression .. [ expression ]
| [ expression ] .. expression
bins_keyword
bins
| illegal_bins
| ignore_bins
covergroup_cross
covercross_identifier : cross coverpoint_identifier { , coverpoint_identifier } [ iff ( expression ) ] cross_item_or_null
cross_item_or_null
{ { covergroup_cross_body_item } } [ ; ]
| ;
covergroup_cross_body_item
covergroup_option
| covergroup_cross_binspec
covergroup_cross_binspec
bins_keyword identifier = covercross_identifier with ( covergroup_expression ) ;

B.12 Conditional-compile

package_body_compile_if
compile if ( constant_expression ) package_body_compile_if_item [ else package_body_compile_if_item ]
package_body_compile_if_item
package_body_item
| { { package_body_item } }
action_body_compile_if
compile if ( constant_expression ) action_body_compile_if_item [ else action_body_compile_if_item ]
action_body_compile_if_item
action_body_item
| { { action_body_item } }
component_body_compile_if
compile if ( constant_expression ) component_body_compile_if_item [ else component_body_compile_if_item ]
component_body_compile_if_item
component_body_item
| { { component_body_item } }
struct_body_compile_if
compile if ( constant_expression ) struct_body_compile_if_item [ else struct_body_compile_if_item ]
struct_body_compile_if_item
struct_body_item
| { { struct_body_item } }
compile_has_expr
compile has ( constant_expression )
compile_assert_stmt
compile assert ( constant_expression [ , string ] ) ;

B.13 Expression

constant_expression
expression
expression
condition_expr
condition_expr
logical_or_expr { ? logical_or_expr : logical_or_expr }
logical_or_expr
logical_and_expr { || logical_and_expr }
logical_and_expr
binary_or_expr { && binary_or_expr }
binary_or_expr
binary_xor_expr { | binary_xor_expr }
binary_xor_expr
binary_and_expr { ^ binary_and_expr }
binary_and_expr
logical_equality_expr { & logical_equality_expr }
logical_equality_expr
logical_inequality_expr { eq_neq_op logical_inequality_expr }
logical_inequality_expr
binary_shift_expr { logical_inequality_rhs }
logical_inequality_rhs
inequality_expr_term
| inside_expr_term
inequality_expr_term
logical_inequality_op binary_shift_expr
logical_inequality_op
<
| <=
| >
| >=
inside_expr_term
in [ open_range_list ]
open_range_list
open_range_value { , open_range_value }
open_range_value
expression [ .. expression ]
binary_shift_expr
binary_add_sub_expr { shift_op binary_add_sub_expr }
binary_add_sub_expr
binary_mul_div_mod_expr { add_sub_op binary_mul_div_mod_expr }
binary_mul_div_mod_expr
binary_exp_expr { mul_div_mod_op binary_exp_expr }
binary_exp_expr
unary_expr { ** unary_expr }
unary_expr
[ unary_op ] primary
unary_op
+
| -
| !
| ~
| &
| |
| ^
primary
number
| bool_literal
| paren_expr
| string
| variable_ref_path
| function_symbol_call
| static_ref_path
| super
| compile_has_expr
paren_expr
( expression )
variable_ref_path
variable_ref { . variable_ref }
variable_ref
identifier [ [ expression [ : expression ] ] ]
function_symbol_call
( identifier { ( :: | . ) identifier } ) method_parameter_list ;
static_ref_path
identifier :: identifier { :: identifier }
mul_div_mod_op
*
| /
| %
add_sub_op
+
| -
shift_op
<<
| >>
eq_neq_op
==
| !=

B.14 Identifiers and literals

constant
number
| identifier
identifier
ID
| ESCAPED_ID
hierarchical_id
identifier { . identifier }
action_type_identifier
type_identifier
type_identifier
[ :: ] ID { :: ID }
package_identifier
hierarchical_id
coverpoint_target_identifier
hierarchical_id
action_identifier
identifier
struct_identifier
identifier
component_identifier
identifier
component_action_identifier
identifier
covercross_identifier
identifier
coverpoint_identifier
identifier
covergroup_identifier
identifier
enum_identifier
identifier
import_class_identifier
identifier
language_identifier
identifier
method_identifier
identifier
symbol_identifier
identifier
variable_identifier
identifier
iterator_identifier
identifier
index_identifier
identifier
buffer_type_identifier
type_identifier
resource_type_identifier
type_identifier
state_type_identifier
type_identifier
stream_type_identifier
type_identifier
filename_string
DOUBLE_QUOTED_STRING
bool_literal
true
| false

B.15 Numbers

number
based_hex_number
| based_dec_number
| based_bin_number
| based_oct_number
| dec_number
| oct_number
| hex_number
based_hex_number
[ DEC_LITERAL ] BASED_HEX_LITERAL
DEC_LITERAL
[ 1-9 ] { [ 0-9 ] | _ }
BASED_HEX_LITERAL
' [ s|S ] h|H [ 0-9 ]
| [ a-f ]
| [ A-F ] { [ 0-9 ] | [ a-f ] | [ A-F ] | _ }
based_dec_number
[ DEC_LITERAL ] BASED_DEC_LITERAL
BASED_DEC_LITERAL
[ s|S ] d|D [ 0-9 ] { [ 0-9 ] | _ }
based_bin_number
[ DEC_LITERAL ] BASED_BIN_LITERAL
BASED_BIN_LITERAL
' [ s|S ] b|B [ 0-1 ] { [ 0-1 ] | _ }
based_oct_number
[ DEC_LITERAL ] BASED_OCT_LITERAL
BASED_OCT_LITERAL
' [ s|S ] o|O [ 0-7 ] { [ 0-7 ] | _ }
dec_number
DEC_LITERAL
oct_number
OCT_LITERAL
OCT_LITERAL
0 [ 0-7 ]
hex_number
HEX_LITERAL
HEX_LITERAL
0x [ 0-9 ]
| [ a-f ]
| [ A-F ] { [ 0-9 ] | [ a-f ] | [ A-F ] | _ }

B.16 Comments

SL_COMMENT
// {any_ASCII_character_except_newline}\n
ML_COMMENT
/* { any_ASCII_character } */
string
DOUBLE_QUOTED_STRING
| TRIPLE_DOUBLE_QUOTED_STRING
unescaped_character
Any_Printable_ASCII_Character
escaped_character
\ ( ' | " | ? | ' | a | b | f | n | r | t | v | [ 0-7 ] [ 0-7 ] [ 0-7 ] )
DOUBLE_QUOTED_STRING
" { unescaped_character | escaped_character } "
TRIPLE_DOUBLE_QUOTED_STRING
""" { any_ASCII_character } """
ID
[ a-z ]
| [ A-Z ]
| _ { [ a-z ] | [ A-Z ] | _ | [ 0-9 ] }
ESCAPED_ID
\ { any_ASCII_character_except_whitespace } whitespace

See also