Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_TickLow()

Gets the low value of a ranged type.

Syntax

low = mti_TickLow( type_id ) 

Returns

Name
Type
Description
low
mtiInt32T
The low value of the range of the specified type; 0 for real, time, and record types

Arguments

Name
Type
Description
type_id
mtiTypeIdT
A handle to a VHDL type

Description

mti_TickLow() returns the value of type'LOW for ranged types. For real, time, and record types, mti_TickLow() returns 0.

Related functions

mti_TickDir()

mti_TickHigh()

mti_TickLeft()

mti_TickLength()

mti_TickRight()

Example

FLI code

#include <mti.h>

static char * getTypeStr( mtiTypeIdT typeid )
{
  switch ( mti_GetTypeKind( typeid ) ) {
    case MTI_TYPE_SCALAR:    return "Scalar";
    case MTI_TYPE_ARRAY:     return "Array";
    case MTI_TYPE_RECORD:    return "Record";
    case MTI_TYPE_ENUM:      return "Enumeration";
    case MTI_TYPE_PHYSICAL:  return "Physical";
    case MTI_TYPE_REAL:      return "Real";
    case MTI_TYPE_TIME:      return "Time";
    default:                 return "UNKNOWN";
  }
}

static void initInstance( void )
{
  mtiSignalIdT sigid;
  mtiTypeIdT   typeid;

  mti_PrintMessage( "Design Signals:\n" );
  for ( sigid = mti_FirstSignal( mti_GetTopRegion() );
        sigid; sigid = mti_NextSignal() ) {
    typeid = mti_GetSignalType( sigid );
    mti_PrintFormatted( "%14s: type %-12s; low = %d, high = %d\n",
                     mti_GetSignalName( sigid ), getTypeStr( typeid ),
                      mti_TickLow( typeid ), mti_TickHigh( typeid ));
  }
}

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;

library ieee;
use ieee.std_logic_1164.all;

entity top is

  type bitarray is array( -2 downto -5 ) of bit;

  type rectype is record
    a : bit;
    b : integer;
    c : bitarray;
  end record;

  type bigtime is range 0 to integer'high
    units
      hour;
      day   = 24 hour;
      week  = 7 day;
      month = 4 week;
      year  = 12 month;
    end units;

end top;

architecture a of top is

  signal bitsig      : bit       := '1';
  signal intsig      : integer   := 42;
  signal physsig     : bigtime   := 3 hour;
  signal realsig     : real      := 10.2;
  signal timesig     : time      := 3 ns;
  signal stdlogicsig : std_logic := 'H';

  signal bitarr      : bitarray := "1100";
  signal stdlogicarr : std_logic_vector( 3 downto 0 ) := "01LH";
  signal uparray     : bit_vector( 1 to 4 ) := "0101";

  signal rec         : rectype   := ( '0', 0, "1001" );

  component for_model
  end component;

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

begin

  inst1 : for_model;

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 .../modeltech/sunos5/../ieee.std_logic_1164(body)
# Loading work.top(a)
# Loading work.for_model(a)
# Loading ./for_model.sl
# Design Signals:
#         bitsig: type Enumeration ; low = 0, high = 1
#         intsig: type Scalar      ; low = -2147483648, high = 2147483647
#        physsig: type Physical    ; low = 0, high = 2147483647
#        realsig: type Real        ; low = 0, high = 0
#        timesig: type Time        ; low = 0, high = 0
#    stdlogicsig: type Enumeration ; low = 0, high = 8
#         bitarr: type Array       ; low = -5, high = -2
#    stdlogicarr: type Array       ; low = 0, high = 3
#        uparray: type Array       ; low = 1, high = 4
#            rec: type Record      ; low = 0, high = 0
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