HDL Cosimulation

Cosimulate hardware component by communicating with HDL module instance executing in HDL simulator

Library

EDA Simulator Link DS

Description

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

The tabbed panes on the block's dialog box let you configure:

The Ports pane provides fields for mapping signals of your HDL design to input and output ports in your block. The signals can be at any level of the HDL design hierarchy.

The Timescales pane lets you choose an optimal timing relationship between Simulink and the HDL simulator. You can configure either a relative timing relationship (Simulink seconds correspond to an HDL simulator-defined tick interval) or an absolute timing relationship (Simulink seconds correspond to an absolute unit of HDL simulator time).

The Connection pane specifies the communications mode used between Simulink and the HDL simulator. If you use TCP socket communication, this pane provides fields for specifying a socket port and for the host name of a remote computer running the HDL simulator. The Connection pane also provides the option for bypassing the cosimulation block during Simulink simulation.

Dialog Box

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

Ports Pane

Specify fields for mapping signals of your HDL design to input and output ports in your block. Simulink deposits an input port signal on an HDL simulator signal at the signal's sample rate. Conversely, Simulink reads an output port signal from a specified HDL simulator signal at the specified sample rate.

In general, Simulink handles port sample periods as follows:

In addition to specifying output port sample times, you can force the fixed point data types on output ports. For example, setting the Data Type property of an 8-bit output port to Signed and setting its Fraction Length property to 5 would force the data type to sfix8_En5.

(Note, however, that can not force width; the width is always inherited from the HDL simulator. )

The list at the center of the pane displays HDL signals corresponding to ports on the HDL Cosimulation block.

Maintain this list with the buttons on the left of the pane:

To commit edits to the Simulink model, you must also click Apply.

To edit the a signal name, double-click on the name. Set the signal properties on the same line and in the appropriate columns. The properties of a signal are as follows.

Full HDL Name

Specifies the signal path name, using the HDL simulator path name syntax. For example, a path name for an input port might be manchester.samp. The signal can be at any level of the HDL design hierarchy. The HDL Cosimulation block port corresponding to the signal is labeled with the Full HDL Name.

For rules on specifying signal/port and module path specifications in Simulink, see Specifying HDL Signal/Port and Module Paths for Cosimulation.

I/O Mode

Select either Input or Output.

Input designates signals of your HDL module that are to be driven by Simulink. Simulink deposits values on the specified the HDL simulator signal at the signal's sample rate.

Output designates signals of your HDL module that are to be read by Simulink. For output signals, you must specify an explicit sample time. You can also specify a data type (except width), if desired (see Date Type and Fraction Length in a following section).

Since Simulink signals do not have the semantic of tri-states (there is no 'Z' value), it is not meaningful to connect to a bi-directional HDL signal directly. In order to interface with bi-directional signals, you can interface to the input of the output driver, the enable of the output driver, and the output of the input driver. This leaves the actual tri-state buffer in HDL where resolution functions can handle interfacing with other tri-state buffers.

Sample Time

This property is enabled only for output signals. You must specify an explicit sample time.

Sample Time represents the time interval between consecutive samples applied to the output port. The default sample time is 1. The exact interpretation of the output port sample time depends on the settings of the Timescales pane of the HDL Cosimulation block (see Timescales Pane). See also Representation of Simulation Time.

Data Type, Fraction Length

These two related parameters apply only to output signals.

The Data Type property is enabled only for output signals. You can direct Simulink to determine the data type, or you can assign an explicit data type (with option fraction length). By explicitly assigning a data type, you can force fixed point data types on output ports of an HDL Cosimulation block.

The Fraction Length property specifies the size, in bits, of the fractional part of the signal in fixed-point representation. Fraction Length is enabled when the Data Type property is not set to Inherit.

Output port data types are determined by the signal width and by the Data Type and Fraction Length properties of the signal.

To assign a port data type, set the Data Type and Fraction Length properties as follows:

Connection Pane

This figure shows the default configuration of the Connection pane. By default, the block is configured for shared memory communication between Simulink and the HDL simulator, running on a single computer.

If you select TCP/IP socket mode communication, the pane displays additional properties, as shown in the following figure.

Connection Mode

If you want to bypass the HDL simulator when running a Simulink simulation, use these options to specify what type of simulation connection you want. Select one of the following:

With the 2nd and 3rd options, the EDA Simulator Link™ DS cosimulation interface does not communicate with the HDL simulator during Simulink simulation.

The HDL Simulator is running on this computer

Select this option if you want to run Simulink and the HDL simulator on the same computer. When both applications run on the same computer, you have the choice of using shared memory or TCP sockets for the communication channel between the two applications. If this option is deselected, only TCP/IP socket mode is available, and the Connection method list is disabled.

Connection method

This list is enabled when The HDL Simulator is running on this computer is selected. Select Socket if you want Simulink and the HDL simulator to communicate via a designated TCP/IP socket. Select Shared memory if you want Simulink and the HDL simulator to communicate via shared memory. For more information on these connection methods, see Communicating with MATLAB or Simulink and the HDL Simulator.

Host name

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

Port number or service

Indicate a valid TCP socket port number or service for your computer system (if not using shared memory). For information on choosing TCP socket ports, see Choosing TCP/IP Socket Ports.

Show connection info on icon

When this option is selected, Simulink indicates information about the selected communication method and (if applicable) communication options information on the HDL Cosimulation block icon. If shared memory is selected, the icon displays the string SharedMem. If TCP socket communication is selected, the icon displays the host name and port number in the format hostname:port.

In a model that has multiple HDL Cosimulation blocks, with each communicating to different instances of the HDL simulator in different modes, this information helps to distinguish between different cosimulation sessions.

Timescales Pane

The Timescales pane of the HDL Cosimulation block parameters dialog lets you choose a timing relationship between Simulink and the HDL simulator. The following figure shows the default settings of the Timescales pane.

The Timescales pane specifies a correspondence between one second of Simulink time and some quantity of HDL simulator time. This quantity of HDL simulator time can be expressed in one of the following ways:

For detailed information on the relationship between Simulink and the HDL simulator during cosimulation, and on the operation of relative and absolute timing modes, see Representation of Simulation Time.

  


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