Technical data

Using the VHDL FLI with foreign architectures
456
-
VHDL Foreign Language Interface and Verilog PLI ModelSim EE/PLUS Reference Manual
Note:
Although compilation and simulation switches are platform-specific, references to load shared
objects are the same for all platforms. For information on loading objects see "Declaring the FOREIGN
attribute" (p456), "Declaring the subprogram in VHDL" (p458) for the FLI , and "Specifying the PLI file to
load" (p483) for the PLI.
Using the VHDL FLI with foreign architectures
To use the interface, you first create and compile an architecture with the
FOREIGN attribute. The string value of the attribute is used to specify the name
of a C initialization function, and the name of an object file to load. When VSIM
elaborates the architecture, the initialization function will be called. Parameters to
the function include a list of ports and a list of generics, see: "Mapping to VHDL
data types" (p481).
A foreign architecture body may contain only the foreign attribute declaration and
specification. Any other declarations or statements are ignored. In addition, only
the port clause and generic clause of the corresponding entity are accessible to the
foreign architecture. Any other entity declarations are ignored.
Declarin
g
the FOREIGN attribute
Starting with VHDL93, the FOREIGN language attribute is declared in package
STANDARD. With the 1987 version, you need to declare the attribute yourself.
You can declare it in a separate package, or you can declare it in the architecture
that you are replacing. (This will continue to work even with VHDL93).
The FOREIGN attribute string
The value of the FOREIGN attribute is a string in three parts. For the following
declaration:
ATTRIBUTE foreign OF arch_name : ARCHITECTURE IS "app_init app.so; parameter";
the attribute string parses this way:
app_init
The name of the initialization function for this architecture. This part is required. See "The
C initialization function" (p457).
app.so
The path to the shared object file to load. This part is required. See "Location of shared
object files" (p457).