Simulation hangs

In reply to murali.gubba:
Although adding #1 inside the task eliminates the hang, it is not a very efficient way of coding. What you want to is have timer_load execute whenever an input argument changes. For that you can do

forever @(*)
  begin 
    control.timer_load(cpu_timer_ld_dn, gate_rise_edge, timer_modes, load_timer_reg);
  end

Also, it is better to use functions for procedures that are not time consuming. Declare the return type of the function as void if you do not want it to return a value.