Co-simulation Setup (ModelSim)

In this step, the top level design is compiled and elaborated in ModelSim. ModelSim is then started with the top level design (entity “top” architecture “implement”) and co-simulation can begin.

Prior to simulating, you must compile all models and sub-models to be simulated in ModelSim separately into ModelSim libraries. These libraries must be available from the same directory as the Twin Builder project through appropriate definitions in the cds.lib file. For details on how to compile models, library management and the cdl.lib file, see the Mentor Graphics ModelSim user documentation. In addition, Twin Builder uses ‘worklib’ as the default work library to compile and elaborate the ModelSim netlist.

-- Inverter behavioral model description

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 inv_modelsim;

 

ARCHITECTURE behav OF inv_modelsim IS

CONSTANT lh : TIME := TP_LH * 1 sec;

CONSTANT hl : TIME := TP_HL * 1 sec;

SIGNAL INV_OUT : BIT := '0';

BEGIN

 

INV_OUT <= NOT X;

 

Y <= INV_OUT AFTER hl WHEN INV_OUT = '0' ELSE

INV_OUT AFTER lh;

 

END behav;

When you start a simulation (for a design with models marked for ModelSim simulation) in Twin Builder, Twin Builder generates the top-level ModelSim netlist, then compiles, elaborates, and starts ModelSim with the top level design which in turn loads the co-simulation interface.

The commands executed by Twin Builder to set up ModelSim are:

 

vlib work

vcom -bindAtCompile <sml_name>_EDSCoSim_Netlist.vhd

vsim -t 1fs work.top

 

When ModelSim successfully loads the co-simulation dll, the message “Successfully loaded the Simplorer-ModelSim Co-simulation Interface”appears. Once the ModelSim prompt appears, co-simulation setup is complete.

Note that once a setup is completed for a schematic, it remains valid until you load a new schematic. This also means that only one valid co-simulation setup can exist at one time. If an existing ModelSim setup is found by Twin Builder, it will attempt to link to it and will fail if the existing model loaded in ModelSim has a different interface that the one it is trying to link to.