MATLAB DESIGN HDL CODER RELEASE NOTES User's Guide Page 326

  • Download
  • Add to my manuals
  • Print
  • Page
    / 410
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 325
326 www.xilinx.com System Generator for DSP User Guide
UG640 (v 12.2) July 23, 2010
Chapter 4: Importing HDL Modules
this_block.setEntityName('foo');
Note: The Configuration Wizard automatically sets the name of the top-level entity when it
generates a configuration M-function.
Defining Block Ports
The port interface of a black box is defined by the block's configuration M-function. Recall
that black box ports are defined using port descriptors. A port descriptor provides
methods for configuring various port attributes, including port width, data type, binary
point, and sample rate.
Adding New Ports
When defining a black box port interface, it is necessary to add input and output ports to
the block descriptor. These ports correspond to the ports on the module you are importing.
In your model, the black box block port interface is determined by the port names that are
declared on the block descriptor object. SysgenBlockDescriptor provides methods for
adding input and output ports:
Adding an input port:
this_block.addSimulinkInport('din');
Adding an output port:
this_block.addSimulinkOutport('dout');
The string parameter passed to methods addSimulinkInport and addSimulinkOutport
specifies the port name. These names should match the corresponding port names in
the imported module.
Note:
Use lower case text to specify port names.
Adding a bidirectional port:
config_phase = this_block.getConfigPhaseString;
if (strcmpi(config_phase,'config_netlist_interface'))
this_block.addInoutport('bidi');
% Rate and type info should be added here as well
end
Bi-directional ports are supported only during the netlisting of a design and will not
appear on the System Generator diagram; they only appear in the generated HDL. As
such, it is important to only add the bi-directional ports when System Generator is
generating the HDL. The if-end conditional statement is guarding the execution of the
code to add-in the bi-directional port.
It is also possible to define both the input and output ports using a single method call. The
setSimulinkPorts method accepts two parameters. The first parameter is a cell array of
strings that define the input port names for the block. The second parameter is a cell array
of strings that define the output port names for the block.
Note:
The Configuration Wizard automatically sets the port names when it generates a
configuration M-function
Obtaining a Port Object
Once a port has been added to a block descriptor, it is often necessary to configure
individual attributes on the port. Before configuring the port, you must obtain a descriptor
for the port you would like to configure. SysgenBlockDescriptor provides methods for
Page view 325
1 2 ... 321 322 323 324 325 326 327 328 329 330 331 ... 409 410

Comments to this Manuals

No comments