• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Property for when writes to a fifo stop

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 64
  • Views 15008
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Property for when writes to a fifo stop

archive
archive over 18 years ago

I need a property for formal analysis that says when writes to a FIFO stop, the FIFO eventually empties.  The logic in the module I am verifying does the reading of the FIFO.  I'm trying to verify that the logic will always read everything out.  The write is an input to the module.

I broke it up into an assumption and an assertion.  Let me know if you think this works or if you have a better idea.  Thanks.

//psl assume_wr_stops: assume always(
// eventually! ~write
//)@(posedge clk);

//psl assert_eventually_empty: assert always(
// eventually! empty
//)@(posedge clk);


Originally posted in cdnusers.org by weberrm
  • Cancel
  • archive
    archive over 18 years ago

    Hi,

    Unless the read signal was constant, IFV would fail this assertion as by simply alternating the value of write,

    i.e. write 0 1 0 1 0 1 0 1 etc...

    This would satisfy the assumption, but unless the FIFO was always being read, it would never reach an empty state.

    Can you clarify the requirement here, for example when the write stops, do you never expect it to start again?
    If this is the case then you would need another assumption, for example:

    //psl assume_wr_never_restarts: assume always(
    // {~write} |=> {~write}
    //)@(posedge clk);


    Vince.



    Originally posted in cdnusers.org by vincentr
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    Not quite. I want to say that writes will eventually completely stop and when they do the fifo should eventually empty.  There could be many stops and starts of the writes along the way.


    Originally posted in cdnusers.org by weberrm
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    I think the answer is to use an abort.

    //psl assert_eventually_empty: assert always(
    // {~empty} |-> {[*] ; empty}! abort (write)
    //)@(posedge clk);

    So, if writes stop, this assertion will check to make sure that the FIFO will evenutally become empty.


    Originally posted in cdnusers.org by weberrm
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    I don't think you can do this without some verilog code.
    Look at this. I think it should work:


    `ifdef FORMAL_ON

    reg [SIZE-1:0] num_write;
    reg [SIZE-1:0] cnt_write;


    // Let the formal tool pick a value for num_write and keep it stable
    // psl assume_num_write_stable : assume always (stable(num_write));

    // Count numbers of write
    always @(posedge clk)
    begin
    if (reset)
    cnt_write <= 0;
    else if (write)
    cnt_write <= cnt_write+1'b1;
    else
    cnt_write <= cnt_write;
    end

    // if numbers of writes reaches num_write, don't generate any writes anymore
    //psl assume_max_write : assume always ((cnt_write == num_write) -> (~write) @(posedge clk);

    // Force number of write equal to num_write. This will force write to be asserted
    //psl assume_write: assume always (eventually! cnt_write == num_write) @(posedge clk);

    // force read to be asserted. If not, the fifo will never go empty
    // psl assume_read: assume always (eventually! read) @(posedge clk);

    // the fifo should eventually be empty
    //psl assert_empty: assert always (eventually! empty) @(posedge clk);

    `endif FORMAL_ON

    Claude


    Originally posted in cdnusers.org by cbeaureg
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    Hi Claude,

    Thanks for the reply.  Did you see my last post?  Do you think there is still a problem doing it the way I mention?  If so, can you explain?  Thanks.

    Also, your code puts an assumption on the read.  However, my example was describing a case where the logic being verified is what is reading the fifo.  I am verifying that the logic does indeed empty the fifo if writes stop.

    Ross


    Originally posted in cdnusers.org by weberrm
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 18 years ago

    Ross,

    Yes your solution works fine and is much more elegant than mine!! I tried both solution on some fifo code I had. Both worked.
    I did have to add the constraint on read because I considered as an input to the fifo block.

    Thanks,

    Claude


    Originally posted in cdnusers.org by cbeaureg
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information