Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_GetSecondaryName()

Gets the secondary name of a VHDL region.

Syntax

sec_name = mti_GetSecondaryName( region_id ) 

Returns

Name
Type
Description
sec_name
char *
The secondary name of the specified region

Arguments

Name
Type
Description
region_id
mtiRegionIdT
A handle to a VHDL region

Description

mti_GetSecondaryName() returns the secondary name of the specified region; that is, an architecture name. If the region is not a secondary design unit, then the parent secondary design unit is used. A NULL is returned if the region is a VHDL package or a Verilog region.

The returned pointer must not be freed.

Related functions

mti_GetLibraryName()

mti_GetPrimaryName()

mti_GetRegionFullName()

mti_GetRegionName()

mti_GetRegionSourceName()

Example

FLI code

#include <mti.h>

static void printRegionInfo( char * region )
{
  char *       primary_name;
  char *       region_name;
  char *       secondary_name;
  mtiRegionIdT regid;

  regid          = mti_FindRegion( region );
  region_name    = mti_GetRegionFullName( regid );
  primary_name   = mti_GetPrimaryName( regid );
  secondary_name = mti_GetSecondaryName( regid );
  mti_PrintFormatted( "  Region %s; Primary name is %s, "
                      "Secondary name is %s\n",
                       region_name, primary_name,
                       secondary_name ? secondary_name : "<NULL>" );
  mti_VsimFree( region_name );
}

static void initInstance( void )
{
  mti_PrintFormatted( "Load Done Callback Function:\n" );

  printRegionInfo( "/top" );
  printRegionInfo( "/top/linst1" );
  printRegionInfo( "/top/linst2" );
  printRegionInfo( "/top/finst" );
  printRegionInfo( "/for_pkg" );
}

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 * primary_name;
  char * region_name;
  char * secondary_name;

  mti_PrintFormatted( "Foreign Init Function:\n" );

  region_name    = mti_GetRegionFullName( region );
  primary_name   = mti_GetPrimaryName( region );
  secondary_name = mti_GetSecondaryName( region );
  mti_PrintFormatted( "  Region parameter is %s; Primary name is %s, "
                     "Secondary name is %s\n",
                     region_name, primary_name,
                     secondary_name ? secondary_name : "<NULL>" );
  mti_VsimFree( region_name );

  mti_AddLoadDoneCB( initInstance, 0 );
} 

HDL code

entity for_model is
end for_model;

architecture for_arch of for_model is
 attribute foreign of for_arch : architecture is "initForeign for_model.sl;";
begin
end for_arch;

package for_pkg is

 procedure test_proc;

end for_pkg;

package body for_pkg is

 procedure test_proc is
  begin
   assert false report "I'm in the test_proc." severity note;
  end;

end for_pkg;

use work.for_pkg.all;

entity lower is
end lower;

architecture level of lower is
begin

 p1 : process
  begin
   test_proc;
   wait for 20 ns;
  end process;

end level;

library ieee;
use ieee.std_logic_1164.all;

entity top is
end top;

architecture beh of top is

 component for_model
 end component;

 component lower
 end component;

begin

 linst1 : lower;

 linst2 : lower;

 finst  : for_model;

end beh;

configuration cfg_top of top is
 for beh
  for all : lower
   use entity work.lower(level);
  end for;
  for all : for_model
   use entity work.for_model(for_arch);
  end for;
 end for;
end cfg_top; 

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.for_pkg(body)
# Loading work.top(beh)
# Loading work.lower(level)
# Loading work.for_model(for_arch)
# Loading ./for_model.sl
# Foreign Init Function:
#   Region parameter is /top/finst; Primary name is for_model, Secondary name is for_arch
# Load Done Callback Function:
#   Region /top; Primary name is top, Secondary name is beh
#   Region /top/linst1; Primary name is lower, Secondary name is level
#   Region /top/linst2; Primary name is lower, Secondary name is level
#   Region /top/finst; Primary name is for_model, Secondary name is for_arch
#   Region /for_pkg; Primary name is for_pkg, Secondary name is <NULL>
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