![]() |
![]() |
![]() |
![]() |
mti_GetNextNextEventTime()
Gets the next event time (from a VHDL process).
Syntax
status = mti_GetNextNextEventTime( next_time )Returns
Name Type Description status int A number that indicates which types of events are pending (See below for details)Arguments
Name Type Description next_time mtiTime64T * Returns the time at which the next simulation event will occur (See below for details)Description
mti_GetNextNextEventTime() returns the next simulation event time when called from within a VHDL process. The current run command's stop time is considered to be a pending event, as is the stop time of a step command.
The return value and next_time parameter are set as follows:
Related functions
Example
FLI code
#include <mti.h> static void checkTime( void ) { int status; mtiTime64T next_time; status = mti_GetNextNextEventTime( &next_time ); switch ( status ) { case 0: mti_PrintFormatted( " No pending events; Next time is [%d,%d]\n", MTI_TIME64_HI32( next_time ), MTI_TIME64_LO32( next_time ) ); break; case 1: mti_PrintFormatted( " Pending events; Next time is [%d,%d]\n", MTI_TIME64_HI32( next_time ), MTI_TIME64_LO32( next_time ) ); break; case 2: mti_PrintFormatted( " Pending postponed processes; " "Next time is [%d,%d]\n", MTI_TIME64_HI32( next_time ), MTI_TIME64_LO32( next_time ) ); break; } } void doProc( void ) { mti_PrintFormatted( "Time [%d,%d]: doProc()\n", mti_NowUpper(), mti_Now() ); checkTime(); } static void checkRegion( void ) { mti_PrintFormatted( "Time [%d,%d]: checkRegion()\n", mti_NowUpper(), mti_Now() ); checkTime(); } static void initInstance( void ) { mtiProcessIdT procid; mtiSignalIdT sigid; sigid = mti_FindSignal( "/top/s1" ); procid = mti_CreateProcess( "Test Process", checkRegion, 0 ); mti_Sensitize( procid, sigid, MTI_EVENT ); } 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_AddLoadDoneCB( initInstance, 0 ); }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; package for_pkg is procedure test_proc; attribute foreign of test_proc : procedure is "doProc for_model.sl;"; end for_pkg; package body for_pkg is procedure test_proc is begin end; end for_pkg; use work.for_pkg.all; entity top is end top; architecture a of top is component for_model end component; for all : for_model use entity work.for_model(a); signal s1 : bit := '0'; begin s1 <= not s1 after 4 ns; finst : for_model; p1 : postponed process begin wait for 16 ns; test_proc; end process; 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.for_pkg(body) # Loading ./for_model.sl # Loading work.top(a) # Loading work.for_model(a) VSIM 1> run 3 VSIM 2> run 4 # Time [0,4]: checkRegion() # Pending events; Next time is [0,7] VSIM 3> run 9 # Time [0,8]: checkRegion() # Pending events; Next time is [0,12] # Time [0,12]: checkRegion() # Pending events; Next time is [0,16] # Time [0,16]: checkRegion() # Pending postponed processes; Next time is [0,16] VSIM 4> quit
![]() Model Technology Inc. Voice: (503) 641-1340 Fax: (503)526-5410 http://www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |