Utility class for handling direct access to the SystemC top module (i.e. More...
#include <device.h>
Public Types | |
enum | ownership_t { DONT_TAKE_OWNERSHIP , TAKE_OWNERSHIP } |
Public Member Functions | |
Device () | |
Default constructor. | |
Device (Device &other) | |
Assume ownership of the underlying simulation and device model. | |
Device (iface::SimulationInterface *simulation) | |
This constructor automatically allocates an object of type T with default arguments. | |
Device (iface::SimulationInterface *simulation, const std::string &device_name) | |
This constructor automatically allocates an object of type T with device_name passed as the only argument to T's constructor. | |
Device (iface::SimulationInterface *simulation, T *device_model, ownership_t ownership=TAKE_OWNERSHIP) | |
Wrap an existing model in this Device. | |
Device & | operator= (Device &other) |
Assume ownership of the underlying simulation and device model. | |
DeviceAccess< T > | operator-> () |
Access the underlying device object with the proper simulation context. | |
const DeviceAccess< T > | operator-> () const |
Access the underlying device object with the proper simulation context. | |
T * | pointer () |
pointer to underlying device object | |
const T * | pointer () const |
pointer to underlying device object | |
virtual | ~Device () |
Utility class for handling direct access to the SystemC top module (i.e.
the device). Using this class ensures that the correct simulation context is set in the SC kernel.
enum simics::systemc::Device::ownership_t |
|
inline |
Default constructor.
Use when elaborating the SystemC device during the finalize phase.
|
inline |
|
inlineexplicit |
This constructor automatically allocates an object of type T with default arguments.
simulation | The simulation interface (typically the Adapter object). |
|
inline |
This constructor automatically allocates an object of type T with device_name passed as the only argument to T's constructor.
simulation | The simulation interface (typically the Adapter object). |
device_name | Name of the SystemC model, passed as the argument to T's constructor. |
|
inline |
Wrap an existing model in this Device.
simulation | The simulation interface (typically the Adapter object). |
device_model | The SystemC model wrapped by this Device |
ownership | If ownership is set to DONT_TAKE_OWNERSHIP the device_model will not be freed by the Device object, it is the callers responsibility to free the pointer passed to the constructor. If ownership is set to TAKE_OWNERSHIP the Device object will claim ownership of the device_model and will delete it when the Device is deleted. |
|
inlinevirtual |
|
inline |
Access the underlying device object with the proper simulation context.
|
inline |
Access the underlying device object with the proper simulation context.
|
inline |
Assume ownership of the underlying simulation and device model.
Assigning one Device to another will transfer the ownership of the underlying device_model and simulation reference to the left hand side of the expression. The operand on the right hand side will have its device_model and simulation set to NULL. Thus it is an error to dereference the device_model through the original Device object (rhs) after the assignment. However, the original Device object can safely be assigned to again.
It is an error to assign to a Device that already has a non-NULL device_model or simulation.
|
inline |
pointer to underlying device object
|
inline |
pointer to underlying device object