$finish and @(final_step())

From: Tamhankar Prasanna-A14507 <Prasanna.Tamhankar_at_.....>
Date: Thu Apr 21 2005 - 00:57:03 PDT
Hi all,

LRM says "final_step generates global events only on the last point in an analysis" (section 6.7.4), however, should final_step  event trigger if a $finish is encountered ? Consider a case where say some files were opened (in initial_step) and are to be closed in final_step. If a $finish event happens before the simulator reaches the simulation end time, it will be nice to trigger the final_step so as to close all the files. 

I have included two example modules below, the first one is purely analog, second one is mixed signal.

module analogFinish;

  analog begin

    @(initial_step("static")) begin
       // some file opens
    end
    if ($abstime > 0.7) begin
      $strobe("%m About to call analog finish"); 
      $finish(0);
    end

    @(final_step("tran")) begin
      $strobe("%m >> Time %g: '@(final_step('tran'))' event has fired.", $abstime);
      // some file closes
    end
  end
endmodule

`timescale 1ms / 1ms
module digitalFinish;
  initial begin
     #700;
     $display("Time %g: Digital $finish(0) is about to occur.", $realtime);
     $finish(0);
  end
  analog begin
    @(initial_step("static")) begin
     // some file open
    end
    
    @(final_step("tran")) begin
      $strobe("%m >> Time %g: '@(final_step('tran'))' event has fired.", $abstime);
      // some file close
    end
  end
endmodule

Also, in this module digitalFinish, assume that the analog and the digital engines synchronized at 0.6 seconds. Analog takes a step to say 0.74 seconds and then the digital tries to catch up, but at 0.7 (#700) encounters a $finish. Should the analog  engine then synchronize with digital by backing-up from 0.74 to 0.7 and then end the simulation ?

Best regards,
Prasanna
Received on Thu Apr 21 00:57:19 2005

This archive was generated by hypermail 2.1.8 : Thu Apr 21 2005 - 00:58:12 PDT