VHDL Cosimulation

Cosimulate a hardware component by applying input signals to and reading output signals from a VHDL model under simulation in ModelSim

Library

Link for ModelSim

Description

The VHDL Cosimulation block cosimulates a hardware component by applying input signals to and reading output signals from a VHDL model under simulation in ModelSim. You can use this block to model a source or sink device by configuring the block with input or output ports only.

Using tabbed panels on the block's dialog box, you can configure the following:

The Ports tab provides fields for mapping signals of your VHDL design to input and output ports in your block. The signals that you map can be at any level of the VHDL design hierarchy. Simulink deposits an input port signal on a ModelSim signal at the signal's sample rate. Conversely, Simulink reads an output port signal from a specified ModelSim signal at the Simulink sample rate.

In general, Simulink handles port sample periods as follows:

Dialog Box

The Block Parameters dialog box consists of four tabbed panes of configuration options:

Ports Tab

Block input ports

Signals of your VHDL model that are to be driven by Simulink. Simulink deposits values on the specified ModelSim signal at the signal's sample rate.

Specify each port of interest as a test signal pathname, using ModelSim pathname syntax, and enter one pathname per line. A sample pathname for an input port might be /manchester/samp.

The ports that you map can be at any level of the VHDL design hierarchy.

Block output ports

Signals of your VHDL model that are to be read by Simulink. Simulink reads an output port signal from the specified ModelSim signal at the Simulink signal's sample rate. You can specify a sample rate or -1 in the Output sample time text field. The value -1 instructs the block to inherit the output sample rate from the input rate.

Specify each port of interest as a test signal pathname, using ModelSim pathname syntax, and enter one pathname per line. A sample pathname for an output port might be /manchester/data.

The ports that you map can be at any level of the VHDL design hierarchy.

Output sample time

The time interval (ticks) between consecutive samples applied to all output ports. The resolution of the time interval is equal to the simulator resolution that is set for ModelSim. To determine the resolution, at the ModelSim prompt, enter echo $resolution or report simulator state. The default for this field depends on how you are using the block.

If the Block Has...The Default Is...
Input and output ports-1, inherit the sample time of the signal source
Input ports only (sink)0, has no impact
Output ports only (source)2

Comm Tab

ModelSim running on this computer

If selected, the block configuration assumes Simulink and ModelSim are running on the same computer. When both applications run on the same computer, you have the option of using shared memory or TCP sockets for the communication channel between the two applications.

Host name

If Simulink and ModelSim are running on different computers, this text field specifies the host name of the computer that is running your VHDL simulation in ModelSim.

Shared memory

If selected, Simulink and ModelSim use the shared memory for communication. To select this option, you must also select ModelSim running on this computer. For more information on modes of communication, see Modes of Communication.

Port number or service

A valid port number or service for your computer system. For information on choosing TCP socket ports, see Choosing TCP/IP Socket Ports.

Clocks Tab

Rising-edge clocks

One or more rising-edge clocks that drive values to the VHDL signals that you are modeling, using the deposit method. Specify each clock as a signal pathname, using ModelSim pathname syntax, and enter one pathname per line. A sample pathname for a clock might be /manchester/clk. You can include the ModelSim simulator prefix sim:, but it is not required.

Falling-edge clocks

One or more falling-edge clocks that drive deposit values to the VHDL signals that you are modeling. Specify each clock as a signal pathname, using ModelSim pathname syntax, and enter one pathname per line. A sample pathname for a clock might be /manchester/clk. You can include the ModelSim simulator prefix sim:, but it is not required.

Tcl Tab

Before simulation command

A Tcl command line to be executed before ModelSim simulates the VHDL component of your Simulink model. You can specify multiple commands by appending each command with a semicolon (;), the standard Tcl concatenation operator.

Alternatively, you can create a ModelSim DO file that lists Tcl commands and then specify that file with the ModelSim do command as follows:

do mycosimstartup.do

Use of this field can range from something as simple as a one-line echo command to confirm that a simulation is running to a complex script that performs an extensive simulation initialization and startup sequence.

After simulation command

A Tcl command line to be executed before ModelSim simulates the VHDL component of your Simulink model. You can specify multiple commands by appending each command with a semicolon (;), the standard Tcl concatenation operator.

Alternatively, you can create a ModelSim DO file that lists Tcl commands and then specify that file with the ModelSim do command as follows:

do mycosimcleanup.do


Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS