What is difference between rsp_1[*2] & $stable(rsp_1) in System Verilog assertion?

Hi All,

Recently i have been asked to write assertion for below checker
If req is they Rsp_1 should be asserted for 2 clock cycle and if req is not there then Rsp_2 should be asserted for 2 clock cycle?
So I have written Assertion property as below


property p_rsp_req
@(posedge clk)  req ? rsp_1[*2] : rsp_2[*2]
endproperty : p_rsp_req 

And I thought of writing as below also


property p_rsp_req
@(posedge clk)  req ?  $stable(rsp_1) : $stable(rsp_2)
endproperty : p_rsp_req 

So now i am confused which is better method and
i am also unclear about below questions

  1. Is rsp_1[*2] is same as $stable(rsp_1) ? How above codes differ each other ?
  2. Here i am using select operator in both cases and since we are not using any delay or implication operator How condition statement will executed will rsp_1 expression considered from same clock tick of req or will it take 1 clock cycle delay ?

In reply to SUNODH:

They are very different.

*rsp_1[2] is a sequence saying that rsp_1 must be true in the current cycle and true in the next cycle.

$stable(rsp_1) is a boolean function returning true if rsp_1 has the same value it had in the previous cycle.

You cannot use the select/condition operator on a sequence. You can use an implication.

property p_rsp_req
@(posedge clk)  if (req) rsp_1[*2] else rsp_2[*2];
endproperty : p_rsp_req 

Your requirements say nothing about when the 2 clock cycles rsp_1 must be asserted in relation to when req is asserted, or what rsp_1 should be if req is not true

In reply to SUNODH:
You said “rsp_1 should be asserted for 2 clock cycle(s)”. If “asserted” means Resp_1 has the value true or non-zero, then *rsp_1[2] represent that. $stable(rsp_1) means true for consecutive cycles or false for consecutive cycles.

You cannot use the conditional operator except in a non-temporal expression. I has to be evaluated in a single point in time. Sequences or a series of expressions that get evaluated over a time span, that is what temporal means.