//--------------------------------------------------------------------------- // // ASSERT_ALWAYS_ON_EDGE // //--------------------------------------------------------------------------- // NAME // ASSERT_ALWAYS_ON_EDGE - An invariant concurrent assertion to ensure // that its argument always evaluates TRUE // //--------------------------------------------------------------------------- module assert_always_on_edge (clk, reset_n, sampling_event, test_expr); // synopsys template parameter severity_level = 0; parameter edge_type= 0; parameter options=0; parameter msg="VIOLATION"; input clk, reset_n, sampling_event, test_expr; //synopsys translate_off `ifdef ASSERT_ON parameter assert_name = "ASSERT ALWAYS ON EDGE"; integer error_count; initial error_count = 0; `include "ovl_header.h" `include "ovl_task.h" `ifdef ASSERT_INIT_MSG initial ovl_init_msg; // Call the User Defined Init Message Routine `endif reg sampling_event_fired; reg sampling_event_prev; initial sampling_event_prev <= 0; always @(posedge clk) begin `ifdef ASSERT_GLOBAL_RESET if (`ASSERT_GLOBAL_RESET != 1'b0) begin `else if (reset_n != 0) begin // active low reset `endif // Capture Sampling Event @Clock for rising edge detections sampling_event_prev <= sampling_event; if ((edge_type == `OVL_NOEDGE) && (!test_expr)) ovl_error(""); else if ((edge_type == `OVL_POSEDGE) && (!sampling_event_prev) && (sampling_event) && (!test_expr)) ovl_error(""); else if ((edge_type == `OVL_NEGEDGE) && (sampling_event_prev) && (!sampling_event) && (!test_expr)) ovl_error(""); else if ((edge_type == `OVL_ANYEDGE) && (sampling_event_prev != sampling_event) && (!test_expr)) ovl_error(""); end end `endif //synopsys translate_on endmodule