16#ifndef SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
17#define SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
19#if defined SIMICS_5_API || defined SIMICS_6_API
24#include <simics/simulator/sim-get-class.h>
37template<
unsigned int BUSWIDTH = 32,
38 typename TYPES = tlm::tlm_base_protocol_types>
40 :
public ConfObject,
public PciGasket<BUSWIDTH, TYPES>,
41 public GasketClassInterface,
public Version,
42 public SimulationInterfaceProxy {
44 explicit PciGasketClass(ConfObjectRef o)
45 : ConfObject(o), PciGasket<BUSWIDTH, TYPES>(this) {}
46 virtual void finalize() {
48 SIM_set_object_configured(obj());
51 simulation_ref_.require();
55 virtual iface::ScVersionInterface *version() {
58 virtual void createGasket(iface::SimulationInterface *simulation) {
59 setSimulation(simulation);
60 sc_core::sc_object *obj = sc_core::sc_find_object(
61 sc_pci_device_name_.c_str());
63 SIM_LOG_ERROR(simulation->simics_object(), Log_Configuration,
64 "Invalid SystemC object name for "
65 "PciDeviceQueryInterface and "
66 "BaseAddressRegisterQueryInterface implementor");
70 iface::PciDeviceQueryInterface *pci =
71 dynamic_cast<iface::PciDeviceQueryInterface *
>(obj);
72 iface::BaseAddressRegisterQueryInterface *bar =
73 dynamic_cast<iface::BaseAddressRegisterQueryInterface *
>(obj);
74 this->connect(pci, bar, this->obj());
76 static conf_class_t *registerGasketClass(
const char* class_name) {
78 if (SIM_clear_exception() == SimExc_No_Exception) {
82 auto new_cls = make_class<PciGasketClass>(
84 "model of SystemC compsite pci gasket class",
85 "Class for binding Simics interface to SystemC Pci Gasket.",
86 Sim_Class_Kind_Pseudo);
88 new_cls->add(Attribute(
"device",
"s",
89 "Name of the SystemC object that implements the"
90 " PciDeviceQueryInterface and"
91 " BaseAddressRegisterQueryInterface."
92 "All TLM2 sockets returned by the object must"
93 " have BUSWIDTH = 32 and TYPES ="
94 " tlm::tlm_base_protocol_types",
95 ATTR_CLS_VAR(PciGasketClass,
98 new_cls->add(Attribute(
"simulation",
"o",
99 "Simics object implementing the SystemC"
100 " Simulation interface.",
101 ATTR_CLS_VAR(PciGasketClass, simulation_ref_),
103 PciGasketBase::initClassInternal<PciGasketClass>(new_cls.get());
105 return *new_cls.get();
109 std::string sc_pci_device_name_;
110 ConfObjectRef simulation_ref_;
conf_class_t * SIM_get_class(const char *NOTNULL name)
Definition: pci_bus_interface.h:24