Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_GetCheckpointFilename()

Gets the name of the current checkpoint file.

Syntax

filename = mti_GetCheckpointFilename() 

Returns

Name
Type
Description
filename
char *
A pointer to the name of the current checkpoint file

Arguments

None

Description

mti_GetCheckpointFilename() returns the filename specified with the most recent checkpoint or restore command. A NULL is returned if no checkpoint or restore command has been given.

The returned pointer must not be freed.

Related functions

None

Example

FLI code

#include <stdlib.h>
#include <mti.h>

static char * instance_info;

void saveCallback( void * param )
{
  char * inst_info = (char *)param;
  mti_PrintFormatted( "Saving instance info \"%s\"\n", inst_info );
  mti_SaveString( inst_info );
  mti_PrintFormatted( "Checkpoint filename is %s\n",
                     mti_GetCheckpointFilename() );
}

void restoreCallback( void * param )
{
  char * inst_info = (char *)param;
  strcpy( inst_info, mti_RestoreString() );
  mti_PrintFormatted( "Restored instance info \"%s\"\n", instance_info );
  mti_PrintFormatted( "Checkpoint filename is %s\n",
                     mti_GetCheckpointFilename() );
}

void cleanupCallback( void * param )
{
  mti_PrintMessage( "Cleaning up...\n" );
  free( param );
}

void initForeign(
  mtiRegionIdT       region,   /* The ID of the region in which this     */
                               /* foreign architecture is instantiated.  */
  char              *param,    /* The last part of the string in the     */
                               /* foreign attribute.                     */
  mtiInterfaceListT *generics, /* A list of generics for the foreign model.*/
  mtiInterfaceListT *ports     /* A list of ports for the foreign model.   */
)
{
  instance_info = malloc( strlen(param) + 1 );
  strcpy( instance_info, param );
  mti_AddSaveCB( saveCallback, instance_info );
  mti_AddRestoreCB( restoreCallback, instance_info );
  mti_AddQuitCB( cleanupCallback, instance_info );
  mti_AddRestartCB( cleanupCallback, instance_info );
} 

HDL code

entity for_model is
end for_model;

architecture a of for_model is
  attribute foreign of a : architecture is
    "initForeign for_model.sl; for_model";
begin
end a;

entity top is
end top;

architecture a of top is

  signal s1 : bit := '0';

  component for_model is
  end component;

  for all : for_model use entity work.for_model(a);
begin

  i1 : for_model;

  s1 <= not s1 after 5 ns;

end a; 

Simulation output

% vsim -c top
Reading .../modeltech/sunos5/../tcl/vsim/pref.tcl 

# 5.4b

# vsim -c top 
# Loading .../modeltech/sunos5/../std.standard
# Loading work.top(a)
# Loading work.for_model(a)
# Loading ./for_model.sl
VSIM 1> run 20
VSIM 2> checkpoint my_checkpoint.file
# Saving instance info "for_model"
# Checkpoint filename is my_checkpoint.file
VSIM 3> run 30
VSIM 4> checkpoint my_other_cp.file
# Saving instance info "for_model"
# Checkpoint filename is my_other_cp.file
VSIM 5> run 40
VSIM 6> restore my_checkpoint.file
# Loading checkpoint/restore data from file "my_checkpoint.file"
# Checkpoint created Fri Jun 23 10:18:12 2000
# Restoring state at time 20 ns, iteration 1
# Restored instance info "for_model"
# Checkpoint filename is my_checkpoint.file
VSIM 7> run 10
VSIM 8> quit
# Cleaning up... 


Model Technology Inc.
Voice: (503) 641-1340
Fax: (503)526-5410
http://www.model.com
sales@model.com
TOC PREV NEXT INDEX

ModelSim