Only issue responses if we aren;t already blocked
[gem5.git] / src / mem / request.hh
index c69b36c401c9684d093f3cc964354183bc31fe2c..e54984fcde1f6d372399a68821eef07efbf5b472 100644 (file)
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Ron Dreslinski
+ *          Steve Reinhardt
+ *          Ali Saidi
  */
 
 /**
- * @file Decleration of a request, the overall memory request consisting of
+ * @file
+ * Declaration of a request, the overall memory request consisting of
  the parts of the request that are persistent throughout the transaction.
  */
 
 #ifndef __MEM_REQUEST_HH__
 #define __MEM_REQUEST_HH__
 
-#include "arch/isa_traits.hh"
+#include "sim/host.hh"
+#include "sim/root.hh"
+
+#include <cassert>
 
 class Request;
 
 typedef Request* RequestPtr;
 
+
 /** The request is a Load locked/store conditional. */
 const unsigned LOCKED          = 0x001;
 /** The virtual address is also the physical address. */
@@ -58,6 +67,8 @@ const unsigned PF_EXCLUSIVE   = 0x100;
 const unsigned EVICT_NEXT      = 0x200;
 /** The request should ignore unaligned access faults */
 const unsigned NO_ALIGN_FAULT   = 0x400;
+/** The request was an instruction read. */
+const unsigned INST_READ        = 0x800;
 
 class Request
 {
@@ -124,6 +135,13 @@ class Request
         : validCpuAndThreadNums(false)
     { setPhys(_paddr, _size, _flags); }
 
+    Request(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc,
+            int _cpuNum, int _threadNum)
+    {
+        setThreadContext(_cpuNum, _threadNum);
+        setVirt(_asid, _vaddr, _size, _flags, _pc);
+    }
+
     /**
      * Set up CPU and thread numbers. */
     void setThreadContext(int _cpuNum, int _threadNum)
@@ -197,6 +215,8 @@ class Request
     /** Accessor function for asid.*/
     int getAsid() { assert(validAsidVaddr); return asid; }
 
+    /** Accessor function to check if sc result is valid. */
+    bool scResultValid() { return validScResult; }
     /** Accessor function for store conditional return value.*/
     uint64_t getScResult() { assert(validScResult); return scResult; }
     /** Accessor function for store conditional return value.*/
@@ -211,6 +231,13 @@ class Request
     /** Accessor function for pc.*/
     Addr getPC() { assert(validPC); return pc; }
 
+    /** Accessor Function to Check Cacheability. */
+    bool isUncacheable() { return (getFlags() & UNCACHEABLE) != 0; }
+
+    bool isInstRead() { return (getFlags() & INST_READ) != 0; }
+
+    bool isLocked() { return (getFlags() & LOCKED) != 0; }
+
     friend class Packet;
 };