14#ifndef SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
15#define SIMICS_SYSTEMC_COMPOSITE_PCI_GASKET_CLASS_H
17#if defined SIMICS_6_API || defined SHOW_OBSOLETE_API
21#include <simics/simulator/sim-get-class.h>
34template<
unsigned int BUSWIDTH = 32,
35 typename TYPES = tlm::tlm_base_protocol_types>
37 :
public ConfObject,
public PciGasket<BUSWIDTH, TYPES>,
38 public GasketClassInterface,
public Version,
39 public SimulationInterfaceProxy {
41 explicit PciGasketClass(ConfObjectRef o)
42 : ConfObject(o), PciGasket<BUSWIDTH, TYPES>(this) {}
43 virtual void finalize() {
45 SIM_set_object_configured(obj());
48 simulation_ref_.require();
52 iface::ScVersionInterface *version()
override {
55 void createGasket(iface::SimulationInterface *simulation)
override {
56 setSimulation(simulation);
57 sc_core::sc_object *obj = sc_core::sc_find_object(
58 sc_pci_device_name_.c_str());
60 SIM_LOG_ERROR(simulation->simics_object(), Log_Configuration,
61 "Invalid SystemC object name for "
62 "PciDeviceQueryInterface and "
63 "BaseAddressRegisterQueryInterface implementor");
67 iface::PciDeviceQueryInterface *pci =
68 dynamic_cast<iface::PciDeviceQueryInterface *
>(obj);
69 iface::BaseAddressRegisterQueryInterface *bar =
70 dynamic_cast<iface::BaseAddressRegisterQueryInterface *
>(obj);
71 this->connect(pci, bar, this->obj());
73 static conf_class_t *registerGasketClass(
const char* class_name) {
75 if (SIM_clear_exception() == SimExc_No_Exception) {
79 auto new_cls = make_class<PciGasketClass>(
81 "model of SystemC compsite pci gasket class",
82 "Class for binding Simics interface to SystemC Pci Gasket.",
83 Sim_Class_Kind_Pseudo);
85 new_cls->add(Attribute(
"device",
"s",
86 "Name of the SystemC object that implements the"
87 " PciDeviceQueryInterface and"
88 " BaseAddressRegisterQueryInterface."
89 "All TLM2 sockets returned by the object must"
90 " have BUSWIDTH = 32 and TYPES ="
91 " tlm::tlm_base_protocol_types",
92 ATTR_CLS_VAR(PciGasketClass,
95 new_cls->add(Attribute(
"simulation",
"o",
96 "Simics object implementing the SystemC"
97 " Simulation interface.",
98 ATTR_CLS_VAR(PciGasketClass, simulation_ref_),
100 PciGasketBase::initClassInternal<PciGasketClass>(new_cls.get());
102 return *new_cls.get();
106 std::string sc_pci_device_name_;
107 ConfObjectRef simulation_ref_;
conf_class_t * SIM_get_class(const char *NOTNULL name)