In reply to mseyunni:
I am not very clear on what you meant by:
A checker is ignored by synthesis tools, thus, any code there (like with “always_ff”) or any other code is not considered as part of the RTL design. More on checker below from my SVA book.
The origin of the checker construct stems from the formal verification world, and hence, certain restrictions are imposed in the modeling styles of a checker. A checker is not intended to be a replacement to a module/interface , as its goal is strictly for verification. Hence the modeling styles allowed in a checker represent a subset suitable for the definition of assertions and coverage with the supporting environment. IEEE 1800-2012 significantly enhanced the 1800-2009 version of a checker to encapsulate a set of properties, assertions, cover statements, assumptions, and any auxiliary procedural code needed to validate the behavior of the design in simulation and in formal verification. It is expected that the checker will play a significant role in the adoption of assertions and in the definition of assertion libraries. One significant advantage of checkers is that they clearly mark the scope of any auxiliary code used to support assertion and verification libraries. This clear demarcation between assertion library code and RTL code enhances code understanding; eliminates potential conflicts between RTL code and supporting code for assertions (such as the use of always blocks and updates of variables needed for assertions); and allows synthesis or other processing tools to concentrate on one specific region of the model, such as the RTL only.
Also, I am not very clear on the use of assertions here ?
The RTL that I showed was intended to represent your RTL. Under normal simulation where there is always activity (i.e., no lock state, and the uvm_error would not be triggered) your simulation would end under your UVM control normal ending. Under a locked state, the assertions will fail, thus causing the action block (the
uvm_error) to fire, thus ending the sim.
I thought the previous solution of starting a counter and resetting the counter upon seeing an activity was something like what I was looking for
Apologies, that assertion is indeed confusing and incorrect and not what you want; a misunderstanding. This is more of what you want.
import uvm_pkg::*; `include "uvm_macros.svh"
module dut #(parameter MAX_DEL = 200)
(input logic clk, rst_n, input logic activity, output int count);
always_ff @(posedge clk) begin : act
if (!rst_n) count <= 0;
else if (activity) count <= 0;
else begin
count++;
if(count>=MAX_DEL) `uvm_error("ID", "did not wake up")
end
end : act
// The assertion below replaces the always_ff block
ap_activity: assert property(@(posedge clk) activity |-> ##[1:MAX_DEL] activity)
else `uvm_error("ID", "did not wake up");
endmodule : dut
Thus, instead of count code, you can use assertions. With the always_ff, the synthesis tool may or may not include in your code. Instead, the assertion does not use the count, and assertions are ignored by synthesis. You could also make up an always construct that emulates this assertion, and the synthesis tool may or may not ignore it. Th assertion states that if there an an activity, there should be another one within 1 to MAX_DEL cycles.
If you have multiple conditions in different places that can trigger this “activity” signal, you could write separate assertions for the different situations, or you can combine them in a special interface.
I hope that this helps.