[gem5-dev] Change in gem5/gem5[master]: mem-cache: Add print function to ReplaceableEntry

2020-01-17 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/23567 )


Change subject: mem-cache: Add print function to ReplaceableEntry
..

mem-cache: Add print function to ReplaceableEntry

Add a basic print function to acquire and display information about
replaceable entries.

Change-Id: I9640113d305fbe086c5bfaf8928a911bfcac50bb
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23567
Tested-by: kokoro 
Reviewed-by: Nikos Nikoleris 
Reviewed-by: Jason Lowe-Power 
Maintainer: Nikos Nikoleris 
Maintainer: Jason Lowe-Power 
---
M src/mem/cache/cache_blk.hh
M src/mem/cache/replacement_policies/replaceable_entry.hh
2 files changed, 17 insertions(+), 3 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh
index dce0ce4..42b8ebd 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -345,7 +345,8 @@
  *
  * @return string with basic state information
  */
-virtual std::string print() const
+std::string
+print() const override
 {
 /**
  *  state   M   O   E   S   I
@@ -382,9 +383,9 @@
   default:s = 'T'; break; // @TODO add other types
 }
 return csprintf("state: %x (%c) valid: %d writable: %d  
readable: %d "
-"dirty: %d | tag: %#x set: %#x way: %#x", status,  
s,

+"dirty: %d | tag: %#x %s", status, s,
 isValid(), isWritable(), isReadable(), isDirty(),  
tag,

-getSet(), getWay());
+ReplaceableEntry::print());
 }

 /**
diff --git a/src/mem/cache/replacement_policies/replaceable_entry.hh  
b/src/mem/cache/replacement_policies/replaceable_entry.hh

index 2b08749..9a59b1f 100644
--- a/src/mem/cache/replacement_policies/replaceable_entry.hh
+++ b/src/mem/cache/replacement_policies/replaceable_entry.hh
@@ -34,6 +34,8 @@
 #include 
 #include 

+#include "base/cprintf.hh"
+
 /**
  * The replacement data needed by replacement policies. Each replacement  
policy

  * should have its own implementation of replacement data.
@@ -99,6 +101,17 @@
  * @return The way to which this entry belongs.
  */
 uint32_t getWay() const { return _way; }
+
+/**
+ * Prints relevant information about this entry.
+ *
+ * @return A string containg the contents of this entry.
+ */
+virtual std::string
+print() const
+{
+return csprintf("set: %#x way: %#x", getSet(), getWay());
+}
 };

 #endif // __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH_

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23567
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I9640113d305fbe086c5bfaf8928a911bfcac50bb
Gerrit-Change-Number: 23567
Gerrit-PatchSet: 5
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: mem-cache: Add print function to ReplaceableEntry

2019-12-12 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/23567 )



Change subject: mem-cache: Add print function to ReplaceableEntry
..

mem-cache: Add print function to ReplaceableEntry

Add a basic print function to acquire and display information about
replaceable entries.

Change-Id: I9640113d305fbe086c5bfaf8928a911bfcac50bb
Signed-off-by: Daniel R. Carvalho 
---
M src/mem/cache/cache_blk.hh
M src/mem/cache/replacement_policies/replaceable_entry.hh
2 files changed, 17 insertions(+), 3 deletions(-)



diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh
index 3bc3786..c3e37e3 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -377,7 +377,8 @@
  *
  * @return string with basic state information
  */
-virtual std::string print() const
+std::string
+print() const override
 {
 /**
  *  state   M   O   E   S   I
@@ -414,9 +415,9 @@
   default:s = 'T'; break; // @TODO add other types
 }
 return csprintf("state: %x (%c) valid: %d writable: %d  
readable: %d "
-"dirty: %d | tag: %#x set: %#x way: %#x", status,  
s,

+"dirty: %d | tag: %#x %s", status, s,
 isValid(), isWritable(), isReadable(), isDirty(),  
tag,

-getSet(), getWay());
+ReplaceableEntry::print());
 }

 /**
diff --git a/src/mem/cache/replacement_policies/replaceable_entry.hh  
b/src/mem/cache/replacement_policies/replaceable_entry.hh

index 2b08749..9a59b1f 100644
--- a/src/mem/cache/replacement_policies/replaceable_entry.hh
+++ b/src/mem/cache/replacement_policies/replaceable_entry.hh
@@ -34,6 +34,8 @@
 #include 
 #include 

+#include "base/cprintf.hh"
+
 /**
  * The replacement data needed by replacement policies. Each replacement  
policy

  * should have its own implementation of replacement data.
@@ -99,6 +101,17 @@
  * @return The way to which this entry belongs.
  */
 uint32_t getWay() const { return _way; }
+
+/**
+ * Prints relevant information about this entry.
+ *
+ * @return A string containg the contents of this entry.
+ */
+virtual std::string
+print() const
+{
+return csprintf("set: %#x way: %#x", getSet(), getWay());
+}
 };

 #endif // __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH_

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23567
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I9640113d305fbe086c5bfaf8928a911bfcac50bb
Gerrit-Change-Number: 23567
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev