//--------------------------------------------------------------------------- // // ASSERT_ONE_COLD // //--------------------------------------------------------------------------- // NAME // ASSERT_ONE_COLD - An invariant concurrent assertion to ensure // only one bit of the 'test_expr' variable is // active low. // // inactive = 0 allows inactive state of test_expr to be all zeros // inactive = 1 allows inactive state of test_expr to be all ones // inactive = 2 (default) specifies no inactive state is allowed // //--------------------------------------------------------------------------- module assert_one_cold (clk, reset_n, test_expr); // synopsys template parameter severity_level = 0; parameter width=32; parameter inactive=2; `ifdef ASSERT_V1_0_1 // Previous version of the library `else // New version to allow for future options parameter options = 0; `endif parameter msg="VIOLATION"; input clk, reset_n; input [width-1:0] test_expr; //synopsys translate_off `ifdef ASSERT_ON wire [width-1:0] test_expr_i = ~test_expr; wire [width-1:0] test_expr_i_1 = test_expr_i - {{width-1{1'b0}},1'b1}; wire inactive_val=(inactive==1)?1'b1:1'b0; parameter assert_name = "ASSERT_ONE_COLD"; integer error_count; initial error_count = 0; `include "ovl_task.h" `ifdef ASSERT_INIT_MSG initial ovl_init_msg; // Call the User Defined Init Message Routine `endif always @(posedge clk) begin `ifdef ASSERT_GLOBAL_RESET if (`ASSERT_GLOBAL_RESET != 1'b0) begin `else if (reset_n != 1'b0) begin `endif if ((test_expr ^ test_expr)==0) begin // OK, test_expr contains no X/Z. if ((inactive>1) || (test_expr!={width{inactive_val}})) begin if (( test_expr_i == {width{1'b0}}) || ((test_expr_i & test_expr_i_1) != {width{1'b0}})) begin ovl_error(""); end end end else begin ovl_error("Error: test_expr contains X/Z value"); end end end // always `endif //synopsys translate_on endmodule