Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_GetResolutionLimit()

Gets the simulator resolution limit.

Syntax

limit = mti_GetResolutionLimit() 

Returns

Name
Type
Description
limit
int
The simulator resolution limit in log10 seconds

Arguments

None

Description

mti_GetResolutionLimit() returns the simulator resolution limit in log10 seconds. In other words, mti_GetResolutionLimit() returns n from the expression:

time_scale = 1*10^n seconds

The values returned by mti_GetResolutionLimit() are as follows:

limit
time_scale
2
100 sec
1
10 sec
0
1 sec
-1
100 ms
-2
10 ms
-3
1 ms
-4
100 us
-5
10 us
-6
1 us
-7
100 ns
-8
10 ns
-9
1 ns
-10
100 ps
-11
10 ps
-12
1 ps
-13
100 fs
-14
10 fs
-15
1 fs

Related functions

None

Example

FLI code

#include <mti.h>

static char * convertLimit( int limit )
{
  switch ( limit ) {
    case 2:    return( "100 sec" );
    case 1:    return( "10 sec" );
    case 0:    return( "1 sec" );
    case -1:   return( "100 ms" );
    case -2:   return( "10 ms" );
    case -3:   return( "1 ms" );
    case -4:   return( "100 us" );
    case -5:   return( "10 us" );
    case -6:   return( "1 us" );
    case -7:   return( "100 ns" );
    case -8:   return( "10 ns" );
    case -9:   return( "1 ns" );
    case -10:  return( "100 ps" );
    case -11:  return( "10 ps" );
    case -12:  return( "1 ps" );
    case -13:  return( "100 fs" );
    case -14:  return( "10 fs" );
    case -15:  return( "1 fs" );
    default:   return( "Unexpected limit" );
  }
}

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.   */
)
{
  mti_PrintFormatted( "The resolution limit of the simulator is \"%s\".\n",
                     convertLimit( mti_GetResolutionLimit() ) );
} 

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";
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 -t 10ps -c top
Reading .../modeltech/sunos5/../tcl/vsim/pref.tcl 

# 5.4b

# vsim -t 10ps -c top 
# Loading .../modeltech/sunos5/../std.standard
# Loading work.top(a)
# Loading work.for_model(a)
# Loading ./for_model.sl
# The resolution limit of the simulator is "10 ps".
VSIM 1> quit
% vsim -t 100fs -c top
Reading .../modeltech/sunos5/../tcl/vsim/pref.tcl 

# 5.4b

# vsim -t 100fs -c top 
# Loading .../modeltech/sunos5/../std.standard
# Loading work.top(a)
# Loading work.for_model(a)
# Loading ./for_model.sl
# The resolution limit of the simulator is "100 fs".
VSIM 1> quit
% 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
# The resolution limit of the simulator is "1 ns".
VSIM 1> quit 


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

ModelSim