Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


64-bit time values in the FLI

64-bit time values in the FLI are represented by the type mtiTime64T, which is defined in mti.h. As of ModelSim version 5.4, this type is defined as a 64-bit C long type on 64-bit systems, and as a C union type with 64-bit storage alignment on 32-bit systems.

Because the syntax for referencing mtiTime64T objects has changed, C preprocessor macros have been provided in mti.h to deal with mtiTime64T references and to make
FLI code portable between 32- and 64-bit systems. The macros MTI_TIME64_INIT, MTI_TIME64_ASGN, MTI_TIME64_HI32, and MTI_TIME64_LO32 support initialization, assignment, and reference to mtiTime64T objects as a 32-bit signed highorder component and a 32-bit unsigned low-order component. Here is a small example:

#include "mti.h"

mtiTime64T t1      = MTI_TIME64_INIT(0,1);    /* 1     */
mtiTime64T t2_32   = MTI_TIME64_INIT(1,0);    /* 2**32 */
mtiTime64T tMinus1 = MTI_TIME64_INIT(-1,~0U); /* -1    */

void increment_time(mtiTime64T *tval)
{
#if defined(_LP64) || defined(__LP64__)
    *tval = *tval + 1;

#else
    int t_hi;
    unsigned int t_lo;
    t_hi = MTI_TIME64_HI32(*tval);
    t_lo = MTI_TIME64_LO32(*tval);
    ++t_lo;
    if (t_lo == 0)
        ++t_hi;
    MTI_TIME64_ASGN(*tval, t_hi, t_lo);
#endif
} 



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

ModelSim