Create Special Primitives

A Special Primitive is a specialization of a Primitive that has either parameters or multiple ports or both. With a Special Primitive, you can assign constant values to a parameter or specify the exact number of ports a multiple port stands for.

A double arrow on a port indicates that the port is a multiple port. See Add input or output ports for more information on the different types of ports. A multiple port allows you to connect any number of signals to it, if the domain in which the model is developed, has a built-in merge or fork primitive (see Autoforking for details).

It is not easy to read such block diagrams to determine which port represents what. A solution is to instantiate a Special Primitive where the exact number of ports is defined and graphically displayed when the special is instantiated. Each input or output port of a Special Primitive has a unique identifier and can accept only one connection.

There are three ways to work with primitives that have multiple connections.

  1. You can draw multiple connections to or from the double-arrow porthole. This has some limitations as it is not possible to control what order the connections will actually be made in. That is not critical for an Add primitive, but for some primitive types it is important to know which connection corresponds to which element of the multiple ports. In some cases such as in the SDF domain, it is not possible to have multiple connections to a port as the domain does not contain a built-in merge primitive.
  2. You can attach HOF primitives (Nop) that realize "bus create" or "bus break out" to the multiple ports, choosing one that provides the right number of ports for the model. The Nop primitive fires in the order of the connections made. These primitives are available in MLD Libraries→HOF Domain. This solves the problem with multiple connections to a single multiple input port, but may not make an easy to read block diagram.
  3. You can instantiate a Special Primitive with the specified number of single ports. The result is an easy to interpret block diagram.

A number of special primitives with a predefined number of input and output ports exist in MLDesigner. These special models are not visible in the tree view because navigation of the libraries is easier without long lists of references to specialized versions of a primitive. These special primitives define the exact number of input or output ports and give each port a unique identifier. The purpose of the Special Primitive is to make the systems and modules easier to interpret as each transition between multi-portholes can be clearly traced.

To instantiate a Special Primitive, drag a primitive with multiple input or output ports into a system or module. You will see the Select Special Primitive dialog where you can select an appropriate special primitive from the list of existing primitives. If you do not find a Special Primitive with the appropriate amount of ports, you can create your own Special Primitive.

Here is an example of how to create a Special Primitive that has 17 single input ports based on the existing AddInt primitive, that supports multiple inputs.

  1. Go to MLD Libraries→SDF Domain→Arithmetic→AddInt.
  2. Right-click on the AddInt entry in the Tree View and choose Save As.
  3. Give the primitive a unique name and save it to one of your libraries. Notice the radio button option group Specials in the Save As New Model dialog. The option Include means that all .mml files describing the special primitive’s interface are copied to the new library.
  4. Right-click on your newly saved AddInt primitive and choose Create Special to activate the Create Special Primitive dialog.
  5. The AddInt primitive has a multiple input port and a single output port. As a result only the Input Ports drop-down menu is active. Select Input from the drop-down menu to activate the New Value dialog.
  6. Type 17 in the input field and click OK.
  7. In the field Physical Name you can see the physical name of the Special Primitive. You may also enter a logical name in the field Logical Name.
  8. If you have finished the Special Primitive definition you can click the Create Special button. An error message will be displayed if a special already exists with the same number of ports (and thus with the same physical name).

While creating special primitives it is not possible to edit incorrect entries. To remove any specials close the Create Special Primitive dialog and activate the Delete Special Primitive dialog by choosing Delete Special item from the context menu. Select the special you want to delete and click the OK button.

The Create Special Primitive dialog consists not only of drop-down menus for the different port types. There is also a drop-down menu for parameters which allows you to create special models with predefined parameter values. In the previous example this field was not active. An example of a primitive with predefined parameter values can be found in the SDF Domain→Logic library and is called Logic. This is a special case of a primitive having predefined functions where the name of the primitive determines the function it performs. If you want to have an overview of specializations existing for the Logic primitive, right-click the corresponding Tree View item and choose Open Special. The Select Special Primitive dialog will appear listing the special primitives. You can view a specialized version in the Model Editor with a double-click on the according item.