summaryrefslogtreecommitdiff
path: root/src/mem/cache/coherence
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/coherence')
-rw-r--r--src/mem/cache/coherence/coherence_protocol.cc42
-rw-r--r--src/mem/cache/coherence/coherence_protocol.hh9
2 files changed, 12 insertions, 39 deletions
diff --git a/src/mem/cache/coherence/coherence_protocol.cc b/src/mem/cache/coherence/coherence_protocol.cc
index 33a8a4e63..6d9f68b54 100644
--- a/src/mem/cache/coherence/coherence_protocol.cc
+++ b/src/mem/cache/coherence/coherence_protocol.cc
@@ -41,7 +41,7 @@
#include "mem/cache/miss/mshr.hh"
#include "mem/cache/cache.hh"
#include "mem/cache/coherence/coherence_protocol.hh"
-#include "sim/builder.hh"
+#include "params/CoherenceProtocol.hh"
using namespace std;
@@ -258,18 +258,12 @@ CoherenceProtocol::assertShared(BaseCache *cache, PacketPtr &pkt,
}
CoherenceProtocol::CoherenceProtocol(const string &name,
- const string &protocol,
+ Enums::Coherence protocol,
const bool doUpgrades)
: SimObject(name)
{
- // Python should catch this, but in case it doesn't...
- if (!(protocol == "msi" || protocol == "mesi" ||
- protocol == "mosi" || protocol == "moesi")) {
- fatal("CoherenceProtocol: unrecognized protocol %s\n", protocol);
- }
-
- bool hasOwned = (protocol == "mosi" || protocol == "moesi");
- bool hasExclusive = (protocol == "mesi" || protocol == "moesi");
+ bool hasOwned = (protocol == Enums::mosi || protocol == Enums::moesi);
+ bool hasExclusive = (protocol == Enums::mesi || protocol == Enums::moesi);
if (hasOwned && !doUpgrades) {
fatal("CoherenceProtocol: ownership protocols require upgrade "
@@ -466,30 +460,8 @@ CoherenceProtocol::invalidTransition(BaseCache *cache, PacketPtr &pkt,
return false;
}
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(CoherenceProtocol)
-
- Param<string> protocol;
- Param<bool> do_upgrades;
-
-END_DECLARE_SIM_OBJECT_PARAMS(CoherenceProtocol)
-
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(CoherenceProtocol)
-
- INIT_PARAM(protocol, "name of coherence protocol"),
- INIT_PARAM_DFLT(do_upgrades, "use upgrade transactions?", true)
-
-END_INIT_SIM_OBJECT_PARAMS(CoherenceProtocol)
-
-
-CREATE_SIM_OBJECT(CoherenceProtocol)
+CoherenceProtocol *
+CoherenceProtocolParams::create()
{
- return new CoherenceProtocol(getInstanceName(), protocol,
- do_upgrades);
+ return new CoherenceProtocol(name, protocol, do_upgrades);
}
-
-REGISTER_SIM_OBJECT("CoherenceProtocol", CoherenceProtocol)
-
-#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/src/mem/cache/coherence/coherence_protocol.hh b/src/mem/cache/coherence/coherence_protocol.hh
index 775bc807a..e5d48ec2d 100644
--- a/src/mem/cache/coherence/coherence_protocol.hh
+++ b/src/mem/cache/coherence/coherence_protocol.hh
@@ -39,10 +39,11 @@
#include <string>
-#include "sim/sim_object.hh"
-#include "mem/packet.hh"
-#include "mem/cache/cache_blk.hh"
#include "base/statistics.hh"
+#include "enums/Coherence.hh"
+#include "mem/cache/cache_blk.hh"
+#include "mem/packet.hh"
+#include "sim/sim_object.hh"
class BaseCache;
class MSHR;
@@ -60,7 +61,7 @@ class CoherenceProtocol : public SimObject
* @param protocol The string representation of the protocol to use.
* @param doUpgrades True if bus upgrades should be used.
*/
- CoherenceProtocol(const std::string &name, const std::string &protocol,
+ CoherenceProtocol(const std::string &name, Enums::Coherence protocol,
const bool doUpgrades);
/**