SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
simics::systemc::Device< T > Class Template Reference

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.
 
Deviceoperator= (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 ()
 

Detailed Description

template<typename T>
class simics::systemc::Device< T >

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.

Member Enumeration Documentation

◆ ownership_t

template<typename T >
enum simics::systemc::Device::ownership_t
Enumerator
DONT_TAKE_OWNERSHIP 
TAKE_OWNERSHIP 

Constructor & Destructor Documentation

◆ Device() [1/5]

template<typename T >
simics::systemc::Device< T >::Device ( )
inline

Default constructor.

Use when elaborating the SystemC device during the finalize phase.

◆ Device() [2/5]

template<typename T >
simics::systemc::Device< T >::Device ( Device< T > &  other)
inline

Assume ownership of the underlying simulation and device model.

Creating one Device from another will transfer the ownership of the underlying device_model and simulation reference to the new Device object.

Parameters
otherThe old device 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. However, the original Device object can safely be assigned to again.

◆ Device() [3/5]

template<typename T >
simics::systemc::Device< T >::Device ( iface::SimulationInterface simulation)
inlineexplicit

This constructor automatically allocates an object of type T with default arguments.

Parameters
simulationThe simulation interface (typically the Adapter object).

◆ Device() [4/5]

template<typename T >
simics::systemc::Device< T >::Device ( iface::SimulationInterface simulation,
const std::string &  device_name 
)
inline

This constructor automatically allocates an object of type T with device_name passed as the only argument to T's constructor.

Parameters
simulationThe simulation interface (typically the Adapter object).
device_nameName of the SystemC model, passed as the argument to T's constructor.

◆ Device() [5/5]

template<typename T >
simics::systemc::Device< T >::Device ( iface::SimulationInterface simulation,
T *  device_model,
ownership_t  ownership = TAKE_OWNERSHIP 
)
inline

Wrap an existing model in this Device.

Parameters
simulationThe simulation interface (typically the Adapter object).
device_modelThe SystemC model wrapped by this Device
ownershipIf 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.

◆ ~Device()

template<typename T >
virtual simics::systemc::Device< T >::~Device ( )
inlinevirtual

Member Function Documentation

◆ operator->() [1/2]

template<typename T >
DeviceAccess< T > simics::systemc::Device< T >::operator-> ( )
inline

Access the underlying device object with the proper simulation context.

◆ operator->() [2/2]

template<typename T >
const DeviceAccess< T > simics::systemc::Device< T >::operator-> ( ) const
inline

Access the underlying device object with the proper simulation context.

◆ operator=()

template<typename T >
Device & simics::systemc::Device< T >::operator= ( Device< T > &  other)
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.

◆ pointer() [1/2]

template<typename T >
T * simics::systemc::Device< T >::pointer ( )
inline

pointer to underlying device object

◆ pointer() [2/2]

template<typename T >
const T * simics::systemc::Device< T >::pointer ( ) const
inline

pointer to underlying device object


The documentation for this class was generated from the following file: