Creating Co-simulation Models (ModelSim)

To use a model which is to be simulated in ModelSim, you must first create a VHDL model in Twin Builder with the entity information and an empty architecture decorated with a special foreign attribute as in the following example.

--co-simulation model entity

ENTITY inv_modelsim IS

GENERIC (TP_LH : REAL := 0.0;

TP_HL : REAL := 0.0);

PORT (x : IN BIT := '0';

y : OUT BIT := '1');

END ENTITY inv_modelsim;

 

ARCHITECTURE behav OF inv_modelsim IS

--foreign attribute

ATTRIBUTE foreign OF behav : ARCHITECTURE IS "ModelSim";

BEGIN

END behav;

 

The entity information is all that is needed to generate the complete interface for the foreign model. The foreign attribute is defined in package STANDARD by the VHDL-AMS Language Reference Manual and marks the architecture for “implementation-dependent elaboration”.

You can use a specific library/model/architecture from ModelSim, by extending the foreign string. The syntax is:

“ModelSim.<library name>.<entity name>.<architecture name>”

By default the co-simulation will use the work library, the same entity name as that of the interface model and the default architecture. You can specify either of the following combinations:

<library name>

<library name>.<entity name> or

<library name>.<entity name>.<architecture name>.