3.2.4 Abstract interface header file

System Generator (SimGen) automatically generates the definition of the abstract interface class into the directory that contains all of the source files that System Canvas generates.

To call methods of the abstract interface class, the C++ code must know the class declaration of the abstract interface class. The name of the header file and the name of the abstract interface class are protocol_ProtocolName.h and protocol_ProtocolName, where ProtocolName is the name of the protocol for this abstract interface. There is one generated header file for each protocol in the system. The header file is always generated, even if it is not used by C++ code.

SimGen generates the abstract interface class and the header file directly from the protocol definition in the LISA+ file. The interface class contains all behaviors of the protocol (master or slave) as virtual member functions that are in the same order as in the LISA+ protocol definition. The function names, parameters, return type, and order are exactly the same in the LISA+ protocol definition and in the generated abstract interface class.

C++ code that is to be compiled independently of the LISA+ code can take a copy of this generated header file. By taking a copy of the header file, both the C++ code and the LISA+ code agree on the interface. This is exactly the same as the interface agreement between two C++ modules.

Whenever you change the LISA+ protocol definition, the abstract interface class also changes and you must also update the interface header file that the C++ code uses.

If the C++ code includes the abstract interface header file and receives a pointer to such an interface, it can call any of the interface methods. The call semantics depend on the type of port the abstract interface belongs to and the implementation of the port.

Invoking a function in the abstract interface typically has the same semantics as if the LISA+ component containing the port invoked the corresponding behavior locally.

If the abstract interface belongs to a slave port, or an internal port that is not connected to any other ports, and the port implements the slave behaviors of the protocol, the C++ code can call all the slave behaviors on the port. This is the most typical use case.

For example, the LISA+ component can use a specific protocol to communicate with the C++ component. It can also provide access functions for the C++ code to certain resources in the protocol. The only purpose of such a protocol would be to communicate with C++ code.

If the abstract interface belongs to a master port that connects to one or more slave ports, invoking a function on the abstract interface results in calls to all slaves connected to the master port. If no slave is connected to the master port, or if none of the connected slaves implement the behavior being called, the results are undefined.

Non-ConfidentialPDF file icon PDF version101092_0100_03_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.