cpu/o3: clean up scoreboard object
[gem5.git] / src / dev / etherdevice.hh
index 5d86275b4479cdaeb0cdf90c3efde541d4806840..ace600a4e108b8fb0d92761f18161b0eb20b3e6e 100644 (file)
@@ -39,6 +39,7 @@
 #include "base/statistics.hh"
 #include "dev/pcidev.hh"
 #include "params/EtherDevice.hh"
+#include "params/EtherDevBase.hh"
 #include "sim/sim_object.hh"
 
 class EtherInt;
@@ -47,12 +48,12 @@ class EtherInt;
  * The base EtherObject class, allows for an accesor function to a
  * simobj that returns the Port.
  */
-class EtherDevice : public PciDev
+class EtherDevice : public PciDevice
 {
   public:
     typedef EtherDeviceParams Params;
     EtherDevice(const Params *params)
-        : PciDev(params)
+        : PciDevice(params)
     {}
 
     const Params *
@@ -120,4 +121,31 @@ class EtherDevice : public PciDev
     Stats::Scalar droppedPackets;
 };
 
+/**
+ * Dummy class to keep the Python class hierarchy in sync with the C++
+ * object hierarchy.
+ *
+ * The Python object hierarchy includes the EtherDevBase class which
+ * is used by some ethernet devices as a way to share common
+ * configuration information in the generated param structs. Since the
+ * Python hierarchy is used to generate a SWIG interface for all C++
+ * SimObjects, we need to reflect this in the C++ object hierarchy. If
+ * we don't, SWIG might end up doing 'bad things' when it down casts
+ * ethernet objects to their base class(es).
+ */
+class EtherDevBase : public EtherDevice
+{
+  public:
+    EtherDevBase(const EtherDevBaseParams *params)
+        : EtherDevice(params)
+    {}
+
+    const EtherDevBaseParams *
+    params() const
+    {
+        return dynamic_cast<const EtherDevBaseParams *>(_params);
+    }
+
+};
+
 #endif //__DEV_ETHERDEVICE_HH__