我想做一個簡單的斷言,檢查兩個值是否相等。是否有人可以解釋行爲時,我給你兩個不同的值相同的變量當我們將2個值賦給同一個變量時會發生什麼?
logic src_sig ;
logic dest_sig;
logic alt_sig;
assign a = src_sig;
assign a = alt_sig;
assign b = dest_sig;
我斷言順序是:
sequence check_seq(X,Y);
(X == Y);
endsequence
,就連最初的塊是:
initial begin
#100 @ (posedge clk) begin
src_sig <= 1;
dest_sig <=1;
alt_sig <= 0;
end
#10 @ (posedge clk) begin
src_sig <=1;
dest_sig <=0;
alt_sig <= 0;
end
#10 @ (posedge clk) begin
src_sig <= 0;
dest_sig <= 0;
alt_sig <= 1;
end
#10 @ (posedge clk) begin
src_sig <= 0;
dest_sig <= 1;
alt_sig <= 1;
end
#30 $finish;
end
我期望第二個作業將覆蓋第一個作業,或將其分配給src_sig
和alt_sig
。所以要麼分別顯示2個或4個。但我得到以下結果(3次犯)。
"testbench.sv", 31: test.check_assert: started at 103ns failed at 103ns
Offending '(a == b)'
"testbench.sv", 31: test.check_assert: started at 113ns failed at 113ns
Offending '(a == b)'
"testbench.sv", 31: test.check_assert: started at 133ns failed at 133ns
Offending '(a == b)'
請解釋這裏發生了什麼?
編輯::完整代碼
module test_gcc();
logic clk=0;
logic src_sig,dest_sig,alt_sig;
assign a = src_sig;
assign a = alt_sig;
assign b = dest_sig;
initial begin
clk = 0;
forever #1 clk=~clk;
end
sequence check_seq(X,Y);
(X == Y);
endsequence
property check_connection(M,N);
@(posedge clk)
($rose(M)||$rose(N)||$fell(M)||$fell(N)) |-> check_seq(M,N);
endproperty
check_assert : assert property (check_connection(a,b));
initial begin
#100 @ (posedge clk) begin
src_sig <= 1;
dest_sig <=1;
alt_sig <= 0;
end
#10 @ (posedge clk) begin
src_sig <=1;
dest_sig <=0;
alt_sig <= 0;
end
#10 @ (posedge clk) begin
src_sig <= 0;
dest_sig <= 0;
alt_sig <= 1;
end
#10 @ (posedge clk) begin
src_sig <= 0;
dest_sig <= 1;
alt_sig <= 1;
end
#30 $finish;
end
endmodule
我有一些想法,但沒有[MCVE](https://stackoverflow.com/help/mcve)我不能再進一步了。請創建一個MCVE。 –
我已經粘貼了一個鏈接。如果您需要,我也可以發佈整個代碼。謝謝您的幫助。 – SShankar
您的問題在於您最初並未在您的問題中發佈的代碼。這就是爲什麼一個MCVE非常有價值。請編輯您的問題以包含您的所有代碼。 –