module finalmin;
  int b;

  myprog p1 ();

  initial begin
    b <= 20;
  end
endmodule

program myprog;
  int a;

  initial begin
    $display("INITIAL display: a=%0d  b=%0d  (at time 0)", a, b);
    #10 a  = 10;
    $display("INITIAL display: a=%0d  b=%0d", a, b);
    $finish;
  end

  final begin
    $display("FINAL display: a=%0d  b=%0d", a, b);
    $strobe ("FINAL strobe : a=%0d  b=%0d", a, b);
    $display("FINAL.hierarchy display: a=%0d  b=%0d", a, finalmin.b);
    $strobe ("FINAL.hierarchy strobe : a=%0d  b=%0d", a, finalmin.b);
    //showit;                                // task call is illegal
    showit2;
  end

  task showit;
    $display("SHOWIT.task display: a=%0d  b=%0d", a, b);
  endtask

  function void showit2;
    $display("SHOWIT.function display: a=%0d  b=%0d", a, b);
    $strobe ("SHOWIT.function strobe : a=%0d  b=%0d", a, b);
    $display("SHOWIT.function display: a=%0d  b=%0d", a, finalmin.b);
    $strobe ("SHOWIT.function strobe : a=%0d  b=%0d", a, finalmin.b);
  endfunction
endprogram

// INITIAL display: a=0  b=20  (at time 0)
// INITIAL display: a=10  b=20
// ** Note: $finish    : finalmin.v(18)
//    Time: 10 ns  Iteration: 0  Instance: /finalmin/p1
// FINAL display: a=10  b=20
// FINAL.hierarchy display: a=10  b=20
// SHOWIT.function display: a=10  b=20
// SHOWIT.function display: a=10  b=20

