System Verilog断言属性中的符号'->'和'|->'有什么区别
What is the difference between the symbol '->' and '|->' in System Verilog Assertion Properties
我遇到了一个例子 属性 可以在这里使用:
property p_a;
@(posedge clk) $rose(a) -> $rose(b);
endproperty
以上没有语法错误。
然后我尝试修改成这样
property p_a;
@(posedge clk) $rose(a) -> ##2 $rose(b);
endproperty
这给了我语法错误,才意识到它实际上不是'|->'
property p_a;
@(posedge clk) $rose(a) |-> ##2 $rose(b);
endproperty
这有效,那么 属性 中的符号 ->
是什么?我知道它通常用于触发事件。
->
运算符是逻辑蕴涵运算符,作用于逻辑操作数:
The logical implication expression1 –> expression2 is logically equivalent to
(!expression1 || expression2)
|->
是一个顺序蕴涵,用于表达某些时间属性。
The implication construct specifies that the checking of a property is performed conditionally on the match of a sequential antecedent ... This construct is used to precondition monitoring of a property expression and is allowed at the property
level. The result of the implication is either true or false. The left-hand operand sequence_expr is called the antecedent, while the right-hand operand property_expr is called the consequent...
换句话说,第一个可以用于逻辑功能,第二个用于事件序列。他们有很大的不同。
我遇到了一个例子 属性 可以在这里使用:
property p_a;
@(posedge clk) $rose(a) -> $rose(b);
endproperty
以上没有语法错误。
然后我尝试修改成这样
property p_a;
@(posedge clk) $rose(a) -> ##2 $rose(b);
endproperty
这给了我语法错误,才意识到它实际上不是'|->'
property p_a;
@(posedge clk) $rose(a) |-> ##2 $rose(b);
endproperty
这有效,那么 属性 中的符号 ->
是什么?我知道它通常用于触发事件。
->
运算符是逻辑蕴涵运算符,作用于逻辑操作数:
The logical implication expression1 –> expression2 is logically equivalent to (!expression1 || expression2)
|->
是一个顺序蕴涵,用于表达某些时间属性。
The implication construct specifies that the checking of a property is performed conditionally on the match of a sequential antecedent ... This construct is used to precondition monitoring of a property expression and is allowed at the property level. The result of the implication is either true or false. The left-hand operand sequence_expr is called the antecedent, while the right-hand operand property_expr is called the consequent...
换句话说,第一个可以用于逻辑功能,第二个用于事件序列。他们有很大的不同。