Copyright © 2017 Accellera. All rights reserved. This is an unapproved Accellera Standards Draft, subject to change.

Get the full Language Reference Manual, free of charge, at http://www.accellera.org/images/downloads/drafts-review/PSS_Early_Adopter_Release.pdf

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
| coverspec_declaration
| import_method_decl
| import_class_decl
| import_method_qualifiers
| export_action
| typedef_declaration
| bins_declaration
| import_stmt
| extend_stmt
import_stmt
import package_import_pattern ;
package_import_pattern
type_identifier [ :: * ]
extend_stmt
extend action type_identifier { { action_body_item } } [ ; ]
| extend struct type_identifier { { struct_body_item } } [ ; ]
| extend enum type_identifier { [ enum_item { , enum_item } ] } [ ; ]
| extend component type_identifier { { component_body_item } } [ ; ]

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
| bins_declaration
| symbol_declaration
| coverspec_declaration
| exec_block_stmt
activity_declaration
activity { { [ identifier : ] activity_stmt } } [ ; ]
action_field_declaration
[ action_field_modifier ] action_data_declaration
action_field_modifier
rand
| io_direction
| lock
| share
| action
io_direction
input
| output

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_type identifier [ : struct_identifier ] { { struct_body_item } } [ ; ]
struct_type
struct
| struct_qualifier
struct_qualifier
buffer
| stream
| state
| resource
struct_body_item
constraint_declaration
| struct_field_declaration
| typedef_declaration
| bins_declaration
| coverspec_declaration
| exec_block_stmt
struct_field_declaration
[ struct_field_modifier ] data_declaration
struct_field_modifier
rand

B.4 Procedural interface (PI)

import_method_decl
import 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
import_method_qualifiers
import_method_phase_qualifiers
| import_method_target_template
import_method_phase_qualifiers
import import_function_qualifiers type_identifier ;
import_function_qualifiers
method_qualifiers [ language_identifier ]
| language_identifier
method_qualifiers
target
| solve
import_method_target_template
import language_identifier 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
| inline_type_object_declaration
| exec_block
| package_body_item
component_field_declaration
component_data_declaration
| component_pool_declaration
component_data_declaration
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
| *
inline_type_object_declaration
pool [ [ expression ] ] struct_qualifier struct identifier [ : struct_identifier ] { { struct_body_item } } [ ; ]

B.6 Activity statements

activity_stmt
activity_if_else_stmt
| activity_repeat_stmt
| activity_constraint_stmt
| activity_foreach_stmt
| activity_action_traversal_stmt
| activity_sequence_block_stmt
| activity_select_stmt
| activity_parallel_stmt
| activity_schedule_stmt
| activity_bind_stmt
activity_if_else_stmt
if ( expression ) activity_stmt [ else activity_stmt ]
activity_repeat_stmt
repeat while ( expression ) activity_sequence_block_stmt
| repeat ( [ identifier : ] expression ) activity_sequence_block_stmt
| repeat activity_sequence_block_stmt [ while ( expression ) ; ]
activity_sequence_block_stmt
[ sequence ] { { activity_labeled_stmt } }
activity_constraint_stmt
constraint { { constraint_body_item } }
| single_stmt_constraint
activity_foreach_stmt
foreach ( expression ) activity_sequence_block_stmt
activity_action_traversal_stmt
identifier [ inline_with_constraint ]
| do type_identifier [ inline_with_constraint ] ;
inline_with_constraint
with { { constraint_body_item } }
| constant_expression
activity_select_stmt
select { activity_labeled_stmt activity_labeled_stmt { activity_labeled_stmt } }
activity_labeled_stmt
[ identifier : ] activity_stmt
activity_parallel_stmt
parallel { { activity_labeled_stmt } } [ ; ]
activity_schedule_stmt
schedule { { activity_labeled_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

B.7 Overrides

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

B.8 Data declarations

data_declaration
data_type data_instantiation { , data_instantiation }
action_data_declaration
action_data_type data_instantiation { , data_instantiation } ;
data_instantiation
identifier [ ( coverspec_portmap_list ) ] [ array_dim ] [ = constant_expression ]
coverspec_portmap_list
[ coverspec_portmap { , coverspec_portmap }
| hierarchical_id { , hierarchical_id } ]
coverspec_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
| , open_range_value { , open_range_value }
| .. expression { , open_range_value } ] ] ]
integer_atom_type
int
| bit
open_range_value
expression [ .. expression ]
open_range_list
open_range_value { , open_range_value }
string_type
string
bool_type
bool
user_defined_datatype
type_identifier
action_type
type_identifier
struct_type
type_identifier
enum_type
type_identifier
enum_declaration
enum enum_identifier { [ enum_item { , enum_item } ] } [ ; ]
enum_item
identifier [ = constant_expression ]
typedef_type
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
| ;
implicand_constraint_item
-> constraint_set
constraint_set
constraint_body_item
| constraint_block
constraint_block
{ { constraint_body_item } }
foreach_constraint_item
foreach ( expression ) constraint_set
if_constraint_item
if ( expression ) constraint_set [ else constraint_set ]
unique_constraint_item
unique { hierarchical_id { , hierarchical_id } } ;
single_stmt_constraint
expression_constraint_item
| unique_constraint_item
scheduling_constraint
constraint ( parallel
| sequence ) { hierarchical_id , hierarchical_id { , hierarchical_id } } ;

B.11 Coverspec

coverspec_declaration
coverspec identifier ( coverspec_port { , coverspec_port } ) { { coverspec_body_item } } [ ; ]
coverspec_port
data_type identifier
coverspec_body_item
coverspec_option
| coverspec_coverpoint
| coverspec_cross
| constraint_declaration
coverspec_option
option . identifier = constant_expression ;
coverspec_coverpoint
coverpoint_identifier : coverpoint coverpoint_target_identifier { { coverspec_coverpoint_body_item } } [ ; ]
| ;
coverspec_coverpoint_body_item
coverspec_option
| coverspec_coverpoint_binspec
| ignore_constraint
| illegal_constraint
coverspec_coverpoint_binspec
bins identifier bin_specification
| hierarchical_id ;
ignore_constraint
ignore expression
illegal_constraint
illegal expression ;
coverspec_cross
ID : cross coverpoint_identifier { , coverpoint_identifier } { { coverspec_cross_body_item } }
| ;
coverspec_cross_body_item
coverspec_option
| ignore_constraint
| illegal_constraint

Bins

bins_declaration
bins identifier [ variable_identifier ] bin_specification ;
bin_specification
bin_specifier { bin_specifier } [ bin_wildcard ]
bin_specifier
explicit_bin_value
| explicit_bin_range
| bin_range_divide
| bin_range_size
explicit_bin_value
[ constant ]
explicit_bin_range
[ constant .. constant ]
bin_range_divide
explicit_bin_range / constant
bin_range_size
explicit_bin_range : constant
bin_wildcard
[ * ]

B.12 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 { <
| <=
| >
| >= binary_shift_expr
| inside [ open_range_list ] }
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
| method_function_call
paren_expr
( expression )
variable_ref
hierarchical_id [ [ expression [ : expression ] ] ]
method_function_call
method_call
| function_call
method_call
hierarchical_id method_parameter_list
function_call
ID [ :: ID [ :: ID ] ] method_parameter_list
mul_div_mod_op
*
| /
| %
add_sub_op
+
| -
shift_op
<<
| >>
eq_neq_op
==
| !=

B.13 Identifiers and literals

constant
number
| identifier
identifier
ID
| ESCAPED_ID
hierarchical_id
identifier { . identifier }
action_type_identifier
type_identifier
type_identifier
ID { :: ID }
hierarchical_type_identifier
ID :: ID { :: ID }
package_identifier
hierarchical_id
coverpoint_target_identifier
hierarchical_id
action_identifier
identifier
struct_identifier
identifier
component_identifier
identifier
component_action_identifier
identifier
coverpoint_identifier
identifier
enum_identifier
identifier
import_class_identifier
identifier
language_identifier
identifier
method_identifier
identifier
pool_identifier
identifier
variable_identifier
identifier
bin_identifier
identifier
exec_kind_identifier
identifier
filename_string
DOUBLE_QUOTED_STRING
bool_literal
true
| false

B.14 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.15 Comments

SL_COMMENT
// {any_ASCII_character_except_newline}\n
ML_COMMENT
/* { any_ASCII_character } */
string
DOUBLE_QUOTED_STRING
| TRIPLE_DOUBLE_QUOTED_STRING
DOUBLE_QUOTED_STRING
" { |!|" } "
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