Uvm_callback enable disable

HI All,

callback_mode

function bit callback_mode(
   	int 	on	 = 	-1
)

//Enable/disable callbacks (modeled like rand_mode and constraint_mode).


Generally methods have either 0 or 1.
0 represents disabled
1 represents enabled
But this has -1.
Question : What significance -1 here? By default callback is enabled or disabled?

Thank You,

In reply to Thirumalesh Kumar:

Rather than have seperate set_callback_mode() and get_callback_mode(), someone came up with a scheme that calling constraint_mode() argument with a value other than 0 or 1, or no argument, is the get_ mode of the function. When you create a callback it is initially enabled.

In reply to dave_59:

In reply to Thirumalesh Kumar:
Rather than have seperate set_callback_mode() and get_callback_mode(), someone came up with a scheme that calling constraint_mode() argument with a value other than 0 or 1, or no argument, is the get_ mode of the function. When you create a callback it is initially enabled.

answer was not clear to me , can you explain to me , more detail

In reply to pavan_krishna:

Calling

  • callback_mode(0) disables the callback, returns 0
  • callback_mode(1) enables the callback, returns 1
  • callback_mode(-1) returns the current callback mode 0 or 1 without enabling or disabling
  • callback_mode() same as calling callback(-1)