Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_GetLibraryName()

Gets the physical name of the library that contains a region.

Syntax

lib_name = mti_GetLibraryName( region_id ) 

Returns

Name
Type
Description
lib_name
char *
The physical name of the library that contains the specified design unit region

Arguments

Name
Type
Description
region_id
mtiRegionIdT
A handle to a region

Description

mti_GetLibraryName() returns the physical name of the library that contains the design unit identified by the specified region. If the region is not a design unit, then the parent design unit is used. The returned pointer must not be freed.

mti_GetLibraryName() can be used on both VHDL and Verilog regions.

Related functions

mti_GetPrimaryName()

mti_GetRegionFullName()

mti_GetRegionName()

mti_GetRegionSourceName()

mti_GetSecondaryName()

Example

FLI code

#include "mti.h"

static void printRegionInfo( mtiRegionIdT regid )
{
  char * lib_name;
  char * region_name;

  if ( regid ) {
    region_name = mti_GetRegionFullName( regid );
    lib_name    = mti_GetLibraryName( regid );
    mti_PrintFormatted( "  Region %s is in Library %s\n",
                       region_name, lib_name );
    mti_VsimFree( region_name );
  }
}

void loadDoneCB( void * param )
{
  mti_PrintMessage( "\nLoad Done phase:\n" );
  printRegionInfo( mti_FindRegion( "top" ) );
  printRegionInfo( mti_FindRegion( "inst1" ) );
  printRegionInfo( mti_FindRegion( "inst1/i1" ) );
  printRegionInfo( mti_FindRegion( "inst1/flip" ) );
  printRegionInfo( mti_FindRegion( "inst1/toggle" ) );
}

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.   */
)
{
  char * lib_name;

  mti_AddLoadDoneCB( loadDoneCB, 0 );
  mti_PrintMessage( "\nElaboration phase:\n" );
  lib_name = mti_GetLibraryName( region );
  mti_PrintFormatted( "  Foreign architecture region is in Library %s\n",
                      lib_name );
} 

HDL code

for_model.vhd 
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; 
inv.vhd 
entity inv is
  generic ( delay : time := 5 ns );
  port ( a : in bit;
         b : out bit
       );
end inv;

architecture b of inv is
begin
  b <= a after delay;
end b; 
mid.vhd 
library for_model_lib;
library inv_lib;

entity mid is
end mid;

architecture a of mid is

  signal s1 : bit := '0';
  signal s2 : bit := '0';
  signal s3 : bit := '0';
  signal s4 : bit := '0';

  component for_model is
  end component;
  for all : for_model use entity for_model_lib.for_model(a);

  component inv is
    generic ( delay : time := 5 ns );
    port ( a : in bit;
           b : out bit
         );
  end component;
  for all : inv use entity inv_lib.inv(b);

begin

  flip : inv port map ( s3, s4 );


  i1 : for_model;

  s1 <= not s1 after 5 ns;

  toggle : inv port map ( s1, s2 );

end a; 
top.vhd 
library mid_lib;

entity top is
end top;

architecture a of top is
  component mid is
  end component;
  for all : mid use entity mid_lib.mid(a);
begin
  inst1 : mid;
end a; 

Simulation output

% vlib for_model_lib
% vlib my_inv_lib
% vlib my_mid_lib
% vlib work
% vmap inv_lib my_inv_lib
Copying /u/debid/dev/modeltech/sunos5/../modelsim.ini to modelsim.ini
Modifying modelsim.ini
% vmap mid_lib my_mid_lib
Modifying modelsim.ini
% vcom -93 for_model.vhd -work for_model_lib
Model Technology ModelSim SE vcom 5.5 Compiler 2000.10 Mar  2 2001
-- Loading package standard
-- Compiling entity for_model
-- Compiling architecture a of for_model
% vcom -93 inv.vhd -work inv_lib
Model Technology ModelSim SE vcom 5.5 Compiler 2000.10 Mar  2 2001
-- Loading package standard
-- Compiling entity inv
-- Compiling architecture b of inv
% vcom -93 mid.vhd -work mid_lib
Model Technology ModelSim SE vcom 5.5 Compiler 2000.10 Mar  2 2001
-- Loading package standard
-- Compiling entity mid
-- Compiling architecture a of mid
-- Loading entity for_model
-- Loading entity inv
% vcom -93 top.vhd
Model Technology ModelSim SE vcom 5.5 Compiler 2000.10 Mar  2 2001
-- Loading package standard
-- Compiling entity top
-- Compiling architecture a of top
-- Loading entity mid
% vsim -c top
Reading .../modeltech/sunos5/../tcl/vsim/pref.tcl 

# 5.5

# vsim -c top 
# Loading .../modeltech/sunos5/../std.standard
# Loading work.top(a)
# Loading my_mid_lib.mid(a)
# Loading my_inv_lib.inv(b)
# Loading for_model_lib.for_model(a)
# Loading ./for_model.sl
# 
# Elaboration phase:
#   Foreign architecture region is in Library for_model_lib
# 
# Load Done phase:
#   Region /top is in Library work
#   Region /top/inst1 is in Library my_mid_lib
#   Region /top/inst1/i1 is in Library for_model_lib
#   Region /top/inst1/flip is in Library my_inv_lib
#   Region /top/inst1/toggle is in Library my_inv_lib
VSIM 1> run 10
VSIM 2> quit 


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

ModelSim