How can we prioritize between different initial begin

In reply to bhadanisandip:

There are many possible solutions, but without knowing the motivation behind your request, it is difficult to give you the most efficient way.

Most of the time, this introduces a race in variable initialization. Sometimes you can move the initialization to the variable declaration, which executes before the initial block.

int A = some_function();
initial $display("A is %d", A);

If you start having more levels of dependancies, then you need to move to a “initialize on first use” coding pattern. This is where you never refer to a variable directly, but instead use a function to check the value and initialize it before returning its value.

class A;
endclass
A handle;
function A get_handle();
  if (A==null)
       A = new();
  return A;
endfunction