request: add accessor and constructor for setting time other than curTick

This commit is contained in:
Nathan Binkert 2009-05-29 15:30:16 -07:00
parent 7f50ea05ac
commit a0104b6ff6
2 changed files with 25 additions and 7 deletions

View file

@ -537,7 +537,7 @@ class Packet : public FastAlloc, public Printable
flags = 0; flags = 0;
addr = req->getPaddr(); addr = req->getPaddr();
size = req->getSize(); size = req->getSize();
time = req->getTime(); time = req->time();
flags.set(VALID_ADDR|VALID_SIZE); flags.set(VALID_ADDR|VALID_SIZE);
deleteData(); deleteData();

View file

@ -152,7 +152,7 @@ class Request : public FastAlloc
* latencies. This field is set to curTick any time paddr or vaddr * latencies. This field is set to curTick any time paddr or vaddr
* is written. * is written.
*/ */
Tick time; Tick _time;
/** The address space ID. */ /** The address space ID. */
int asid; int asid;
@ -188,6 +188,11 @@ class Request : public FastAlloc
setPhys(paddr, size, flags); setPhys(paddr, size, flags);
} }
Request(Addr paddr, int size, Flags flags, Tick time)
{
setPhys(paddr, size, flags, time);
}
Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
int cid, ThreadID tid) int cid, ThreadID tid)
{ {
@ -213,12 +218,12 @@ class Request : public FastAlloc
* allocated Request object. * allocated Request object.
*/ */
void void
setPhys(Addr _paddr, int _size, Flags _flags) setPhys(Addr _paddr, int _size, Flags _flags, Tick time)
{ {
assert(_size >= 0); assert(_size >= 0);
paddr = _paddr; paddr = _paddr;
size = _size; size = _size;
time = curTick; _time = time;
flags.clear(~STICKY_FLAGS); flags.clear(~STICKY_FLAGS);
flags.set(_flags); flags.set(_flags);
@ -226,6 +231,12 @@ class Request : public FastAlloc
privateFlags.set(VALID_PADDR|VALID_SIZE); privateFlags.set(VALID_PADDR|VALID_SIZE);
} }
void
setPhys(Addr _paddr, int _size, Flags _flags)
{
setPhys(_paddr, _size, _flags, curTick);
}
/** /**
* Set up a virtual (e.g., CPU) request in a previously * Set up a virtual (e.g., CPU) request in a previously
* allocated Request object. * allocated Request object.
@ -239,7 +250,7 @@ class Request : public FastAlloc
size = _size; size = _size;
flags = _flags; flags = _flags;
pc = _pc; pc = _pc;
time = curTick; _time = curTick;
flags.clear(~STICKY_FLAGS); flags.clear(~STICKY_FLAGS);
flags.set(_flags); flags.set(_flags);
@ -313,10 +324,17 @@ class Request : public FastAlloc
/** Accessor for time. */ /** Accessor for time. */
Tick Tick
getTime() time() const
{ {
assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR)); assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
return time; return _time;
}
void
time(Tick time)
{
assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
_time = time;
} }
/** Accessor for flags. */ /** Accessor for flags. */