System verilog SystemVerilog断言

System verilog SystemVerilog断言,system-verilog,assertions,system-verilog-assertions,System Verilog,Assertions,System Verilog Assertions,我有以下接口: interface tx_in_interface (input bit clk, input bit tx_srstn); //dut input logic [15:0] xi; logic [15:0] xq; logic [15:0] sin; logic [15:0] cos; int chind2; endinterface interface tx_out_interface (input bit

我有以下接口:

interface tx_in_interface (input bit clk, input bit tx_srstn);
   //dut input
   logic [15:0] xi;   
   logic [15:0] xq;   
   logic [15:0] sin;  
   logic [15:0] cos;  
   int  chind2;   
endinterface



interface tx_out_interface (input bit clk, input bit tx_srstn);
   //dut output
   logic [15:0] y;
   int chind2;   
endinterface
我想检查每次sin等于1(dec)y都是
xi/sqrt(2)
,每次cos等于1(dec)y都是
xq/sqrt(2)


我可以用一种特定的systemVerilog断言(不使用记分板或覆盖率)来实现吗?

是的,我认为您可以简单地编写以下两个属性

property sin_check;
  (sin == 'd1) |-> y == (xi/sqrt(2));
endproperty

property cos_check;
  (cos == 'd1) |-> y == (xq/sqrt(2));
endproperty

以下2个断言可以验证指定的条件:

//Creating instances of interface 
tx_in_interface tx_i; 
tx_out_interface tx_o;

//Checking conditions 
assert property (@posedge tx_i.clk) (tx_i.sin == 1) |-> tx_o.y == (tx_i.xi/sqrt(2)); 
else $error("Sine output error!");

assert property (@posedge tx_o.clk) (tx_i.cos == 1) |-> tx_o.y == (xq/sqrt(2)); 
else $error("Cos output error!");

杜洛斯是一个很好的资源。

是的。两个SVA断言可以起到作用,一个是在
sin
为1时检查
y
是否为
xi/sqrt(2)
,另一个是在
cos
为1时检查
y
是否为
xq/sqrt(2)
。不清楚你在问什么。你知道SVA断言吗?@Matthew Taylor-我知道,但在本期(SVA断言)中是新的。你能给其中一个例子举个代码吗?这里有一个例子。@Matthew Taylor-我已经开始读了。我还没有看到的问题是涉及来自不同接口的信号的关联。您可以像在Verilog/SystemVerilog中的任何其他地方一样使用分层引用,例如
assert属性(…模块安装tx_in_interface.inst.sin==16'd1->…模块安装tx_out_interface.inst.y==…模块安装tx_in_interface.inst.xi/sqrt(2))…