summaryrefslogtreecommitdiff
path: root/mem
diff options
context:
space:
mode:
authorRon Dreslinski <rdreslin@umich.edu>2006-04-07 15:54:48 -0400
committerRon Dreslinski <rdreslin@umich.edu>2006-04-07 15:54:48 -0400
commit9e3d79694ca9e204bcbfa9c197db17b581dc7a29 (patch)
treeb220b8a9bb0f1bfeff1c72cef2126c0af2a94a19 /mem
parent62ebe251dac998202403bea45ba69345dc5bf42d (diff)
downloadgem5-9e3d79694ca9e204bcbfa9c197db17b581dc7a29.tar.xz
Move to a model with a unified request object.
Constructor takes a bool to signify that it is either a cpu_request or not a cpu_request. When accedding variables of a cpu_request it asserts that it is a cpu_request. It also asserts that a value being read has been written at some point in time prior (not gaurnteeing it is up to date, but it was at least written before read). There is also a isCpuReq() function to determine if this is a cpu_request. It should be called before accesing a cpu_request only variable. SConscript: Add compilation support for request.cc arch/alpha/tlb.cc: arch/alpha/tlb.hh: cpu/cpu_exec_context.hh: cpu/exec_context.hh: cpu/simple/cpu.cc: cpu/simple/cpu.hh: dev/io_device.cc: mem/page_table.cc: mem/page_table.hh: mem/port.cc: Update for unified request object and accessor functions. mem/request.hh: Remove CpuRequest, make it a unified object. Make variables private with accessor functions. May want to move things from .cc file into header (usually a assert() and either returning a value, or writting two). --HG-- extra : convert_revision : f1e45cc490dadc7a418634539b03c3e72684a6e3
Diffstat (limited to 'mem')
-rw-r--r--mem/page_table.cc11
-rw-r--r--mem/page_table.hh2
-rw-r--r--mem/port.cc6
-rw-r--r--mem/request.hh104
4 files changed, 106 insertions, 17 deletions
diff --git a/mem/page_table.cc b/mem/page_table.cc
index 714ddde35..c4e1ea193 100644
--- a/mem/page_table.cc
+++ b/mem/page_table.cc
@@ -121,11 +121,14 @@ PageTable::translate(Addr vaddr, Addr &paddr)
Fault
-PageTable::translate(CpuRequestPtr &req)
+PageTable::translate(RequestPtr &req)
{
- assert(pageAlign(req->vaddr + req->size - 1) == pageAlign(req->vaddr));
- if (!translate(req->vaddr, req->paddr)) {
+ Addr paddr;
+ assert(pageAlign(req->getVaddr() + req->getSize() - 1)
+ == pageAlign(req->getVaddr()));
+ if (!translate(req->getVaddr(), paddr)) {
return genMachineCheckFault();
}
- return page_check(req->paddr, req->size);
+ req->setPaddr(paddr);
+ return page_check(req->getPaddr(), req->getSize());
}
diff --git a/mem/page_table.hh b/mem/page_table.hh
index 8f0842f58..26248261a 100644
--- a/mem/page_table.hh
+++ b/mem/page_table.hh
@@ -83,7 +83,7 @@ class PageTable
* field of mem_req.
* @param req The memory request.
*/
- Fault translate(CpuRequestPtr &req);
+ Fault translate(RequestPtr &req);
};
diff --git a/mem/port.cc b/mem/port.cc
index fb4f3b4e0..d19d8146c 100644
--- a/mem/port.cc
+++ b/mem/port.cc
@@ -36,15 +36,15 @@
void
Port::blobHelper(Addr addr, uint8_t *p, int size, Command cmd)
{
- Request req;
+ Request req(false);
Packet pkt;
pkt.req = &req;
pkt.cmd = cmd;
for (ChunkGenerator gen(addr, size, peerBlockSize());
!gen.done(); gen.next()) {
- pkt.addr = req.paddr = gen.addr();
- pkt.size = req.size = gen.size();
+ req.setPaddr(pkt.addr = gen.addr());
+ req.setSize(pkt.size = gen.size());
pkt.data = p;
sendFunctional(pkt);
p += gen.size();
diff --git a/mem/request.hh b/mem/request.hh
index 5e2275741..e9b1672ce 100644
--- a/mem/request.hh
+++ b/mem/request.hh
@@ -37,10 +37,8 @@
#include "arch/isa_traits.hh"
class Request;
-class CpuRequest;
typedef Request* RequestPtr;
-typedef CpuRequest* CpuRequestPtr;
/** The request is a Load locked/store conditional. */
const unsigned LOCKED = 0x001;
@@ -63,45 +61,133 @@ class Request
{
//@todo Make Accesor functions, make these private.
public:
+ /** Cunstructor, needs a bool to signify if it is/isn't Cpu Request. */
+ Request(bool isCpu);
+
+//First non-cpu request fields
+ private:
/** The physical address of the request. */
Addr paddr;
-
- /** whether this req came from the CPU or not **DO we need this??***/
- bool nicReq;
+ /** Wether or not paddr is valid (has been written yet). */
+ bool validPaddr;
/** The size of the request. */
int size;
+ /** Wether or not size is valid (has been written yet). */
+ bool validSize;
/** The time this request was started. Used to calculate latencies. */
Tick time;
+ /** Wether or not time is valid (has been written yet). */
+ bool validTime;
/** Destination address if this is a block copy. */
Addr copyDest;
+ /** Wether or not copyDest is valid (has been written yet). */
+ bool validCopyDest;
+ /** Flag structure for the request. */
uint32_t flags;
-};
+ /** Wether or not flags is valid (has been written yet). */
+ bool validFlags;
-class CpuRequest : public Request
-{
- //@todo Make Accesor functions, make these private.
+//Accsesors for non-cpu request fields
public:
+ /** Accesor for paddr. */
+ Addr getPaddr();
+ /** Accesor for paddr. */
+ void setPaddr(Addr _paddr);
+
+ /** Accesor for size. */
+ int getSize();
+ /** Accesor for size. */
+ void setSize(int _size);
+
+ /** Accesor for time. */
+ Tick getTime();
+ /** Accesor for time. */
+ void setTime(Tick _time);
+
+ /** Accesor for copy dest. */
+ Addr getCopyDest();
+ /** Accesor for copy dest. */
+ void setCopyDest(Addr _copyDest);
+
+ /** Accesor for flags. */
+ uint32_t getFlags();
+ /** Accesor for paddr. */
+ void setFlags(uint32_t _flags);
+
+//Now cpu-request fields
+ private:
+ /** Bool to signify if this is a cpuRequest. */
+ bool cpuReq;
+
/** The virtual address of the request. */
Addr vaddr;
+ /** Wether or not the vaddr is valid. */
+ bool validVaddr;
/** The address space ID. */
int asid;
+ /** Wether or not the asid is valid. */
+ bool validAsid;
/** The return value of store conditional. */
uint64_t scResult;
+ /** Wether or not the sc result is valid. */
+ bool validScResult;
/** The cpu number for statistics. */
int cpuNum;
+ /** Wether or not the cpu number is valid. */
+ bool validCpuNum;
/** The requesting thread id. */
int threadNum;
+ /** Wether or not the thread id is valid. */
+ bool validThreadNum;
/** program counter of initiating access; for tracing/debugging */
Addr pc;
+ /** Wether or not the pc is valid. */
+ bool validPC;
+
+//Accessor Functions for cpu request fields
+ public:
+ /** Accesor function to determine if this is a cpu request or not.*/
+ bool isCpuRequest();
+
+ /** Accesor function for vaddr.*/
+ Addr getVaddr();
+ /** Accesor function for vaddr.*/
+ void setVaddr(Addr _vaddr);
+
+ /** Accesor function for asid.*/
+ int getAsid();
+ /** Accesor function for asid.*/
+ void setAsid(int _asid);
+
+ /** Accesor function for store conditional return value.*/
+ uint64_t getScResult();
+ /** Accesor function for store conditional return value.*/
+ void setScResult(uint64_t _scResult);
+
+ /** Accesor function for cpu number.*/
+ int getCpuNum();
+ /** Accesor function for cpu number.*/
+ void setCpuNum(int _cpuNum);
+
+ /** Accesor function for thread number.*/
+ int getThreadNum();
+ /** Accesor function for thread number.*/
+ void setThreadNum(int _threadNum);
+
+ /** Accesor function for pc.*/
+ Addr getPC();
+ /** Accesor function for pc.*/
+ void setPC(Addr _pc);
+
};
#endif // __MEM_REQUEST_HH__