SV
assign文
continuous_assign ::=
assign [ drive_strength ] [ delay3 ] list_of_net_assignments ;
| assign [ delay_control ] list_of_variable_assignments ;
書けるところ
checker_or_generate_item
non_port_program_item
module_common_item
// assign [遅延] 左辺 = 右辺 ; の形式
assign net_id = expression ;
assign net_id [3] = expression ;
assign package_scopre net_id = expression ;
assign { netA, netB } = expression ;
assign '{ netA } = expression ;
assign drive_strength netA = expression ;
assign # 1 netA = expression ; //delay3 # ( 1,2,3 ) まで書ける
構文定義
continuous_assign ::=
assign [ drive_strength ] [ delay3 ] list_of_net_assignments ;
list_of_net_assignments := net_assignment { , net_assignment }
net_assignment ::= net_lvalue = expression
// net の左辺値 基本形(名前と選択補助) or 連結 or
net_lvalue ::=
ps_or_hierachical_net_identifier constant_select // net は定数選択(変数は動的)
| { net_lvalue { , net_lavlue } }
| [ assignment_pattern_expression_type ] assignment_pattern_net_lvalue
// 基本形の中のnet名の形式 pacakge スコープつき or 階層表現
ps_or_hierarchical_net_identifier ::=
[ package_scope ] net_identifier // net_identifer は identifier と同じ
| hierarchical_net_identifier // hierarchical_identifier と同じ
// assign [遅延] 左辺 = 右辺 ; の形式
assign sigA = expression;
assign sigA = expression, sigB = expression ; // 複数書ける
assign A [1 +: 4] = B // +: の右は定数
assign A [6 -: 2] = B
assign A [1] [2:0] = B
assign { sigA, sigB } = expression ;
assign '{ sigA } = expression ;
assgin # 2 sigA = expression ; // delay つき
assign # ( exp:exp:exp ) sigA = expression ; // min,typ,max delay
assign this.A = B ;
構文定義
continuous_assign ::=
| assign [ delay_control ] list_of_variable_assignments ;
list_of_variable_assignments ::=variable_assignment { , variable_assignment }
variable_assignment ::= variable_lvalue = expression
// 変数の左辺値 基本形(名前と選択補助) or 連結 or or ストリーム連結(これは net にはない)
variable_lvalue ::=
[ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select // net は定数選択(変数は動的)
| { variable_lvalue { , variable_lvalue } }
| [ assignment_pattern_expression_type ] assignment_pattern_variable_lvalue
| streaming_concatenation
// 基本形の名前に this. などがつけられる。
hierarchical_variable_identifier ::= hierarchical_identifier
implicit_class_handle ::= this | super | this.super
// 名前の後ろの補助に指定できるパターンが net より多い。
select ::=
[ { . member_identidifer bit_select } . member_identifier ] bit_select [ [ part_select_range ] ]
bit_select ::= { [ expression ] }
part_select_range ::= constant_range | indexed_range
indexed_range ::=
expression +: constant_expression
| expression -: constant_expression
// ` { } への代入
assignment_pattern_expression_type ::=
ps_type_identifier
| ps_parameter_identifier
| integer_atom_type
| type_reference
assignment_pattern_variable_lvalue ::= ` { variable_lvalue { , variable_lvalue } }
// stream への連結
streaming_concatenation ::= { stream_operator [ slice_size ] stream_concatenation }
steram_oerator ::= >> | <<
slice_size ::= simple_type | constant_expression
stream_concatination ::= { stream_expression { , stream_expression } }
stream_expression ::= expession [ with [ array_range_expression ] ]
idB
idA [2]. idB
$root . idA
hierarchical_identifer ::= [ $root. ] { identifier constant_bit_select . } identifier
constant_bit_select ::= { [ constant_expression ] }
package_scope ::= package_identifier :: | $unit ::
identifier ::= simple_identifier | escaped_identifier
simple_identifier ::= [a-zA-Z] { [a-zA-Z0-9_$] }
escaped_identifier ::= \{空白以外のAXCII文字} white_space
initial statement_or_null
initial sigA = #1 exp ;
initial begin // seq block
//
end
initial blkA : begin // ラベルをつけられる
//
end
initial blkA : begin : seqA
//
end seqA // initial と seq 両方にラベルをつけた場合
構文定義
module_common_item,
non_port_program_item
checker_or_generate_item
initial_construct ::= initial statement_or_null
statement_or_null ::= statement | { attribure_instance } ;
構文的には initial と同じ
always, always_comb, always_latch, always_ff がある
構文的には initial と同じ
statement
attribute_insntace ; // 空でもいい
statement = [ block_id : ] { attribute_instances } statement_item
blocking_assignment ;
nonblocking_assignment ;
procedual_continuous_assignment ;
assign, deassign
force, release
case_statement / conditional_statement
inc_or_dec_expression ;
subroutine_call
disable_statement, event_trigger
loop, jump, par_block, procedural_timing_control,seq_block, wait, procedural_assertion
clocking_drive, randsequence, randcase, expect_property
構文的には以下の4通り
sigA = delay_or_event_control expression
blocking の場合、delay,event, repeat のどれかの指定が必要
sigA = # 1 expression ; // delay
sigA = @ evtA expression ;
sigA = @ ( evtA_expression ) expression ;
sigA = @* expression;
sigA = @ ( * ) expression ;
sigA = @ ps_or_hierarchical_sequence_id expression ;
sigA = repeat ( exp ) @ evtA expression ;
// repeat (exp) の後は上と同じだけの種類の書き方ができる
nonrange_varaible_lvalue = dynamic_array_new
sigA = new [ exp ] ;
sigA = new [ exp1 ] ( exp2 ) ;
// ここで sigA は nonrange_variable_lvalue
class new の構文
sigA = new ;
sigA = new ( argA, argB ) ;
sigA = class_scope new ;
sigA = new exp;
// ここで sigA は hierarchial_variable_id select
// sigA の前にimplicit_class_handl . か class_scope か package_scope を付けられる
operator_assignment
sigA op expression // op は代入演算子 +=, &= など含む
sigA += expression ;
nonblocking の場合、delay,event, repeat は省略可
sigA <= expression;
sigA <= #1 expression;
sigA <= @ evtA expression;
assign,deassign
assign sigA = expression ; // 構文的には continuous と同じものが書ける
deassign sigA ;
force sigA = expression ;
release sigA ;
// net もある
statement_item の一つ。再帰してるな
begin
block_item_decl // 宣言ができる
statement
end
begin : seqA
//
end : seqA // ラベルを付けられる
statement_item の一つ。再帰してるな
fork
block_item_decl // 宣言ができる
statement
join // join/join_any/join_none
fork : fkA
//
join : fkA // ラベルを付けられる
return ;
return ( expression ) ; // 式を返す
wait ( expression ) statement_or_null
wait fork ;
wait_order ( hierarchical_id, ... ) action_block
-> hierarchical_event_id ;
->> [ delay_or_event_control ] hierarchical_event_id ;
disable_hierarchical_task_id ;
disable_hierarchical_block_id ;
disable_fork ;
if ( cond_predict ) statement_or_null
if ( exp ) statement;
if ( exp ) state1 ; else state2 ;
if ( exp ) state1 ; else if ( exp2 ) state2 ;
unique if ( exp ) statement ; // unique,unique0, priority を指定可能
if ( exp matches pattern ) statement ;
if ( exp matches pattern &&& exp2 ) statement ;
case, matches_case_pattern_item, inside case_inside_item がある
case_item いわゆる普通の case
case ( exp1 )
exp2 : statement ;
exp3, exp4 : statement2 ;
default : statement3 ; // default のとき : はなくてもいいらしい
endcase
case の他 casez, casex がある
case の前に unique などを指定できる
matches を使う場合 pattern と比較
case ( exp ) matches
. sigA : statement ; // . が要る
. * : statement ;
tagged member_id : statement ;
' { .sigA, .sigB } : statement ;
' { member_id : .sigA, member_id : .sigB } : statement ;
pattern &&& exp : statement ;
default : statement
endcase
以下同様
inside を使う場合 case_item は open_range_list
case ( exp ) inside
value_range : statement
value_range, value_range : statement
default : statement
endcase
以下同様
ちょっと意味が違うが randcase
randcase
exp : statement;
//
endcase
repeat ( exp ) statement ;
for ( ; ; ) statement;
// for initialization
for ( i = 0 ; ; )
for ( i = 0, j = 0 ; ; ) // 複数できる
for ( int i=exp ; ; )
for ( int i=exp, j=exp2 ; ; ) // 複数宣言できる
// for step
for ( ; ; operator_assignment )
for ( ; ; inc_or_dec_exp )
for ( ; ; function_subroutine_call )
for ( ; ; a++, b++ ) // 複数書ける
do statement while ( exp ) ;
foreach ( ps_or_hierarchical_array_id ) statement
foreach ( array [ k ] ) statement
// k is loop_variable. can be declared more
foreach ( array [k],[j] ) statement
subroutine call ;
void ' ( function_call ) ;
これは expression に書く