summaryrefslogtreecommitdiff
path: root/dev/tsunami_io.hh
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-08-23 11:45:52 -0400
committerNathan Binkert <binkertn@umich.edu>2005-08-23 11:45:52 -0400
commitc761aaae652b101959a6f5e182b67f841727de85 (patch)
tree38069755c319cfd6d1da4d8bb8ca362164ae2bc0 /dev/tsunami_io.hh
parent1771ee203fd749b21a51439cde853f7134688f30 (diff)
downloadgem5-c761aaae652b101959a6f5e182b67f841727de85.tar.xz
Lots of fixes to serialization and naming of various device
objects. The improper serialization of arrays was particularly bad. dev/alpha_console.cc: dev/isa_fake.cc: dev/ns_gige.cc: dev/pciconfigall.cc: dev/tsunami_cchip.cc: dev/tsunami_io.cc: dev/tsunami_pchip.cc: the pio interface is a different simobject and should have a different name. dev/ethertap.cc: fix serialization. dev/ide_ctrl.cc: - the pio interface is a different simobject and should have a different name. - properly initialize variables - When serializing an array, the size is the number of elements, not the number of bytes! dev/pcidev.cc: When serializing an array, the size is the number of elements, not the number of bytes! dev/tsunami_io.hh: Don't make objects SimObjects if they're not exposed to python. Don't add serialization functions to events, it's generally not what you want. allow the real time clock and interval timer to serialize themselves, must pass a base name since it is not a SimObject and the values will be going into the section of the parent. --HG-- extra : convert_revision : 3fc5de9b858ed770c8f385cf38b53242cf859c33
Diffstat (limited to 'dev/tsunami_io.hh')
-rw-r--r--dev/tsunami_io.hh110
1 files changed, 47 insertions, 63 deletions
diff --git a/dev/tsunami_io.hh b/dev/tsunami_io.hh
index 5f20cbf4a..35a417e6e 100644
--- a/dev/tsunami_io.hh
+++ b/dev/tsunami_io.hh
@@ -54,45 +54,33 @@ class TsunamiIO : public PioDevice
struct tm tm;
protected:
-
/** Real-Time Clock (MC146818) */
- class RTC : public SimObject
+ class RTC
{
- /** Event for RTC periodic interrupt */
- class RTCEvent : public Event
- {
- private:
- /** A pointer back to tsunami to create interrupt the processor. */
- Tsunami* tsunami;
- Tick interval;
-
- public:
- RTCEvent(Tsunami* t, Tick i);
-
- /** Schedule the RTC periodic interrupt */
- void scheduleIntr();
-
- /** Event process to occur at interrupt*/
- virtual void process();
-
- /** Event description */
- virtual const char *description();
-
- /**
- * Serialize this object to the given output stream.
- * @param os The stream to serialize to.
- */
- virtual void serialize(std::ostream &os);
-
- /**
- * Reconstruct the state of this object from a checkpoint.
- * @param cp The checkpoint use.
- * @param section The section name of this object
- */
- virtual void unserialize(Checkpoint *cp, const std::string &section);
- };
+ private:
+ /** Event for RTC periodic interrupt */
+ struct RTCEvent : public Event
+ {
+ /** A pointer back to tsunami to create interrupt the processor. */
+ Tsunami* tsunami;
+ Tick interval;
+
+ RTCEvent(Tsunami* t, Tick i);
+
+ /** Schedule the RTC periodic interrupt */
+ void scheduleIntr();
+
+ /** Event process to occur at interrupt*/
+ virtual void process();
+
+ /** Event description */
+ virtual const char *description();
+ };
private:
+ std::string _name;
+ const std::string &name() const { return _name; }
+
/** RTC periodic interrupt event */
RTCEvent event;
@@ -124,7 +112,7 @@ class TsunamiIO : public PioDevice
uint8_t stat_regB;
public:
- RTC(Tsunami* t, Tick i);
+ RTC(const std::string &name, Tsunami* t, Tick i);
/** Set the initial RTC time/date */
void set_time(time_t t);
@@ -142,21 +130,22 @@ class TsunamiIO : public PioDevice
* Serialize this object to the given output stream.
* @param os The stream to serialize to.
*/
- virtual void serialize(std::ostream &os);
+ void serialize(const std::string &base, std::ostream &os);
/**
* Reconstruct the state of this object from a checkpoint.
* @param cp The checkpoint use.
* @param section The section name of this object
*/
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ void unserialize(const std::string &base, Checkpoint *cp,
+ const std::string &section);
};
/** Programmable Interval Timer (Intel 8254) */
- class PITimer : public SimObject
+ class PITimer
{
/** Counter element for PIT */
- class Counter : public SimObject
+ class Counter
{
/** Event for counter interrupt */
class CounterEvent : public Event
@@ -175,23 +164,13 @@ class TsunamiIO : public PioDevice
/** Event description */
virtual const char *description();
- /**
- * Serialize this object to the given output stream.
- * @param os The stream to serialize to.
- */
- virtual void serialize(std::ostream &os);
-
- /**
- * Reconstruct the state of this object from a checkpoint.
- * @param cp The checkpoint use.
- * @param section The section name of this object
- */
- virtual void unserialize(Checkpoint *cp, const std::string &section);
-
friend class Counter;
};
private:
+ std::string _name;
+ const std::string &name() const { return _name; }
+
CounterEvent event;
/** Current count value */
@@ -219,7 +198,7 @@ class TsunamiIO : public PioDevice
uint8_t read_byte, write_byte;
public:
- Counter();
+ Counter(const std::string &name);
/** Latch the current count (if one is not already latched) */
void latchCount();
@@ -246,27 +225,31 @@ class TsunamiIO : public PioDevice
* Serialize this object to the given output stream.
* @param os The stream to serialize to.
*/
- virtual void serialize(std::ostream &os);
+ void serialize(const std::string &base, std::ostream &os);
/**
* Reconstruct the state of this object from a checkpoint.
* @param cp The checkpoint use.
* @param section The section name of this object
*/
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ void unserialize(const std::string &base, Checkpoint *cp,
+ const std::string &section);
};
private:
+ std::string _name;
+ const std::string &name() const { return _name; }
+
/** PIT has three seperate counters */
- Counter counter[3];
+ Counter *counter[3];
public:
/** Public way to access individual counters (avoid array accesses) */
- Counter &counter0;
- Counter &counter1;
- Counter &counter2;
+ Counter counter0;
+ Counter counter1;
+ Counter counter2;
- PITimer();
+ PITimer(const std::string &name);
/** Write control word */
void writeControl(const uint8_t* data);
@@ -275,14 +258,15 @@ class TsunamiIO : public PioDevice
* Serialize this object to the given output stream.
* @param os The stream to serialize to.
*/
- virtual void serialize(std::ostream &os);
+ void serialize(const std::string &base, std::ostream &os);
/**
* Reconstruct the state of this object from a checkpoint.
* @param cp The checkpoint use.
* @param section The section name of this object
*/
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ void unserialize(const std::string &base, Checkpoint *cp,
+ const std::string &section);
};
/** Mask of the PIC1 */