SV
代入演算子
=
+=, -=, *=, /= // real,
%= // 余りを代入?
&=, |=, ^= // bit ごとに論理演算して代入
<<=, >>= // シフトして代入
<<<=, >>>=
三項演算子 ( conditional expression)
cond ? exp1 : exp2
単項演算子
+, -
! // 論理否定
~ // ビット反転
&, ~&, |, ~|, ^, ~^,^~ // 縮退演算 ^ の縮退は 1 が奇数個の時 1
二項演算子
+, -, *, /, %, ** // a**b は a の b乗
==, !=, ===, !==, ==?, !=? // 等号演算子 最後のはワイルドカードを扱える
// ===, !== は x,z 含めて比較
// ==?, !=? は右オペランドの x,z を wildcard として扱う
&&, ||, ->, <-> // 論理演算子
<, <=, >, >= // 大小比較演算子
&, |, ^, ^~, ~^ // ビット単位の論理演算子
// ^ は排他的論理和
>>, <<, >>>, <<< // シフト演算子
増減演算子
++, --
inside
dist
連結、拡張
{ }, { { } }
ストリーム演算子
>>, <<
連結演算の結果は packed vector 扱い。左辺にも書ける
logic a, b, c;
{ a, b, c } = 3'b111;
{ a, b, c } = { 1'b1, 1'b1, 1'b1 } ; // 上と同じ
'{ a, b, c } // これは配列または struct になる。packed vector ではない。
replication ( 拡張 )
{ 3{a} } // { a, a, a } と同じ
{ 3{a, b} } // { a, b, a, b, a, b } と同じ
int k = 4;
{ k{a} } // { a, a, a, a }
文字列 (string ) の連結もできる
string hello = "hello";
string s;
s = { hello, " ", "world };
s = { 3 { "foo " } } // s="foo foo foo "
Set membership operator と呼ばれる。ある値がリストに含まれていたら 1 を返す
int a, b, c;
if ( a inside {b, c} ) // リストは { } 内に , で区切って記述
int array [$] = ' {3,4,5};
if ( a inside { 1, 2, array } ) // { } 内は配列も書ける
while ( a inside {3'b1?1} ) // wildcard を使うときは x,z も対象
// 3'b101, 3'b111,3'b1x1,3'b1z1 に適合
bit ba = a inside { [16:23], [32:47] } ; // リストに要素にレンジも書ける
// [low:high] の形式。左の方が小さくなければならない。左が大きいとマッチしない
左側の値とリスト内の要素の比較は == のルールと同じ。x, z を含む場合は ==? と同じ
++ a // 演算子が先に来る
a ++ // 演算子が後に来る
attribute_instances は間に書ける
exp ? exp : exp
logic [31:0] a; // down
a [ 0 +: 8] // a [7:0] と同じ
a [ 15 -: 8 ] // a [15:8] と同じ
logic [0 : 31] b; // up
b [0 +: 8 ] // b [0:7]
b [15 -: 8] // b [8:15]
logic [63:0] d; integer s;
d [ 8 * sel +: 8 ]
logic [7:0] mem [0 : 1023 ];
tf は task function のことか?
構文的には function_subroutine_call は subroutine_call に同じ
tf_call
system_tf_call
method_call
[std :: ] randomize_call
tf_id
tf_id ( )
tf_id ( exp ) // 引数リスト
tf_id ( exp, exp )
tf_id ( exp, .id ( ) )
tf_id ( exp, .id ( exp ) )
tf_id ( .id ( exp ), .id (exp ) )
tf_id attribute_instances ( )
// system_tf は attribute_instances を指定できない。その他はいっしょ
method_call_root は prmiary または implicit_class_handle
array_method_name は method_id, unique, and, or, xor
method_root . method_id
method_root . method_id ( ) // 引数リスト あとは tf_call に同じ
method_root . array_method_name // これは built_in
method_root . array_method_name ( exp ) // 引数
method_root . array_method_name with ( exp )
method_root . array_method_name ( exp ) with ( exp2 )
method_root . randomize ; // これも built_in
method_root . randomize ( sigA, sigB );
method_root . randomize ( null );
method_root . randomize with constraint_block ;
method_root . randomize with ( idA, idB ) constraint_block ;
randomize を root をつけずに呼ぶ場合
randomize ;
randomize ( sigA, sigB ); // rootをつけるのと同じ
std::randomize ; // 以下同じ
constant_primary
単項演算子のついたやつ
定数同士の演算 constant op constant
同上の三項演算子 const ? const : const
5:2
5 +: 2
5 -: 2
expression inside { open_range_list }
value_range
expression
[ expression : expression ]
ps_parameter_id constant_select
他にもいっぱいある
null もここに含まれる
primary_literal
数値、時間、nbased_unsized_literal、文字列
時間は数値に単位をつけたもの。単位は s, ms, us, ns, ps, fs
hierarchical_id select
class_qualifier を前につけられる local :: implicit_class_handle . または class_scope
implicit_class_handle とは this, super, this.super のどれか
empty_unpacked_array_concatenation
concatenation [ [range] ], multiple_concatenation
function_subroutine_call
let_expression
( mintypmax_exp )
cast
assignment_pattern_expression
streaming_concatenation
sequence_method_call
this, $, null
bit_select
bit_select [ part_select_range ]
. member_id bit_select . member_id bit_select