Table of Contents Previous page Next page Index

ModelSim

Model Technology Inc.


mti_GetTopRegion()

Gets the first top-level region.

Syntax

region_id = mti_GetTopRegion() 

Returns

Name
Type
Description
region_id
mtiRegionIdT
A handle to the first top-level region

Arguments

None

Description

mti_GetTopRegion() returns the region ID of the first top-level region in the design hierarchy. mti_NextRegion() can be used to get additional top-level regions. Top-level regions are VHDL architectures and packages and Verilog modules.

Related functions

mti_FindRegion()

mti_FirstLowerRegion()

mti_HigherRegion()

mti_NextRegion()

Example

FLI code

#include <mti.h>

void printHierarchy( mtiRegionIdT region, int indent )
{
  char *       region_name;
  mtiRegionIdT regid;

  region_name = mti_GetRegionFullName( region );
  mti_PrintFormatted( "%*cRegion %s\n", indent, ' ', region_name );
  indent += 2;
  for ( regid = mti_FirstLowerRegion( region );
        regid; regid = mti_NextRegion( regid ) ) {
    printHierarchy( regid, indent );
  }
  mti_VsimFree( region_name );
}

void loadDoneCB( void * param )
{
  mtiRegionIdT regid;

  mti_PrintMessage( "\nDesign Hierarchy:\n" );
  for ( regid = mti_GetTopRegion(); regid; regid = mti_NextRegion(regid) ) {
    printHierarchy( regid, 1 );
  }
}

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( loadDoneCB, 0 );
} 

HDL code

top.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;

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;

package my_pkg is
  type my_type is array ( 7 downto 0 ) of integer;
end package my_pkg;

use work.my_pkg.all;

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 work.for_model(a);

  component inv is
    generic ( delay : time := 5 ns );
    port ( a : in bit;
           b : out bit
         );
  end component;

begin

  flip : inv port map ( s3, s4 );

  i1 : for_model;

  s1 <= not s1 after 5 ns;
  s3 <= not s3 after 5 ns;

  toggle : inv port map ( s1, s2 );

end a;

entity top is
end top;

architecture a of top is
  component mid is
  end component;
begin
  inst1 : mid;
end a; 
vertop.v 
module verbot;

  reg reg2;

  initial begin
    reg2 = 0;
  end

  always begin
    #5 reg2 = ~ reg2;
  end

endmodule

module vertop;

  reg reg1;

  initial begin
    reg1 = 0;
  end

  always begin
    #5 reg1 = ~ reg1;
  end

  verbot verinst1 ();

endmodule 

Simulation output

% vlog vertop.v
Model Technology ModelSim SE/EE vlog 5.4b Compiler 2000.06 Jun  9 2000
-- Compiling module verbot
-- Compiling module vertop

Top level modules:
  vertop
% vcom -93 top.vhd
Model Technology ModelSim SE/EE vcom 5.4b Compiler 2000.06 Jun  9 2000
-- Loading package standard
-- Compiling entity for_model
-- Compiling architecture a of for_model
-- Compiling entity inv
-- Compiling architecture b of inv
-- Compiling package my_pkg
-- Loading package my_pkg
-- Compiling entity mid
-- Compiling architecture a of mid
-- Loading entity for_model
-- Loading entity inv
-- Compiling entity top
-- Compiling architecture a of top
-- Loading entity mid
% vsim -c top vertop
Reading .../modeltech/sunos5/../tcl/vsim/pref.tcl 

# 5.4b

# vsim -c top vertop 
# Loading .../modeltech/sunos5/../std.standard
# Loading work.my_pkg
# Loading work.top(a)
# Loading work.vertop
# Loading work.verbot
# Loading work.mid(a)
# Loading work.inv(b)
# Loading work.for_model(a)
# Loading ./for_model.sl
# 
# Design Hierarchy:
#  Region /top
#    Region /top/inst1
#      Region /top/inst1/flip
#      Region /top/inst1/i1
#      Region /top/inst1/toggle
#  Region /vertop
#    Region /vertop/verinst1
#  Region /standard
#  Region /my_pkg
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