16#ifndef SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
17#define SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
19#if defined SIMICS_6_API || defined SHOW_OBSOLETE_API
23#include <simics/simulator/sim-get-class.h>
36template<
unsigned int BUSWIDTH = 32,
37 typename TYPES = tlm::tlm_base_protocol_types>
39 :
public ConfObject,
public PciGasket<BUSWIDTH, TYPES>,
40 public GasketClassInterface,
public Version,
41 public SimulationInterfaceProxy {
43 explicit PciGasketClass(ConfObjectRef o)
44 : ConfObject(o), PciGasket<BUSWIDTH, TYPES>(this) {}
45 virtual void finalize() {
47 SIM_set_object_configured(obj());
50 simulation_ref_.require();
54 iface::ScVersionInterface *version()
override {
57 void createGasket(iface::SimulationInterface *simulation)
override {
58 setSimulation(simulation);
59 sc_core::sc_object *obj = sc_core::sc_find_object(
60 sc_pci_device_name_.c_str());
62 SIM_LOG_ERROR(simulation->simics_object(), Log_Configuration,
63 "Invalid SystemC object name for "
64 "PciDeviceQueryInterface and "
65 "BaseAddressRegisterQueryInterface implementor");
69 iface::PciDeviceQueryInterface *pci =
70 dynamic_cast<iface::PciDeviceQueryInterface *
>(obj);
71 iface::BaseAddressRegisterQueryInterface *bar =
72 dynamic_cast<iface::BaseAddressRegisterQueryInterface *
>(obj);
73 this->connect(pci, bar, this->obj());
75 static conf_class_t *registerGasketClass(
const char* class_name) {
77 if (SIM_clear_exception() == SimExc_No_Exception) {
81 auto new_cls = make_class<PciGasketClass>(
83 "model of SystemC compsite pci gasket class",
84 "Class for binding Simics interface to SystemC Pci Gasket.",
85 Sim_Class_Kind_Pseudo);
87 new_cls->add(Attribute(
"device",
"s",
88 "Name of the SystemC object that implements the"
89 " PciDeviceQueryInterface and"
90 " BaseAddressRegisterQueryInterface."
91 "All TLM2 sockets returned by the object must"
92 " have BUSWIDTH = 32 and TYPES ="
93 " tlm::tlm_base_protocol_types",
94 ATTR_CLS_VAR(PciGasketClass,
97 new_cls->add(Attribute(
"simulation",
"o",
98 "Simics object implementing the SystemC"
99 " Simulation interface.",
100 ATTR_CLS_VAR(PciGasketClass, simulation_ref_),
102 PciGasketBase::initClassInternal<PciGasketClass>(new_cls.get());
104 return *new_cls.get();
108 std::string sc_pci_device_name_;
109 ConfObjectRef simulation_ref_;
conf_class_t * SIM_get_class(const char *NOTNULL name)