X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcpu%2Fmemtest%2Fmemtest.hh;h=bb71da355dc9b750350df61965119ac4ea6173c0;hb=69fc2af00600ced942d81dba082d9780e5325c9e;hp=2694efd39d00ae92aa54811972dd7decb376515f;hpb=b565660c42cbf8f9ec9442cd6c0b7d488c7816af;p=gem5.git diff --git a/src/cpu/memtest/memtest.hh b/src/cpu/memtest/memtest.hh index 2694efd39..bb71da355 100644 --- a/src/cpu/memtest/memtest.hh +++ b/src/cpu/memtest/memtest.hh @@ -35,8 +35,8 @@ #include #include "base/statistics.hh" -//#include "mem/functional/functional.hh" -//#include "mem/mem_interface.hh" +#include "base/fast_alloc.hh" +#include "params/MemTest.hh" #include "sim/eventq.hh" #include "sim/sim_exit.hh" #include "sim/sim_object.hh" @@ -48,50 +48,43 @@ class Packet; class MemTest : public MemObject { public: - - MemTest(const std::string &name, -// MemInterface *_cache_interface, -// PhysicalMemory *main_mem, -// PhysicalMemory *check_mem, - unsigned _memorySize, - unsigned _percentReads, - unsigned _percentFunctional, - unsigned _percentUncacheable, - unsigned _progressInterval, - unsigned _percentSourceUnaligned, - unsigned _percentDestUnaligned, - Addr _traceAddr, - Counter _max_loads, - bool _atomic); + typedef MemTestParams Params; + MemTest(const Params *p); virtual void init(); // register statistics virtual void regStats(); - inline Tick cycles(int numCycles) const { return numCycles; } + inline Tick ticks(int numCycles) const { return numCycles; } // main simulation loop (one cycle) void tick(); virtual Port *getPort(const std::string &if_name, int idx = -1); + /** + * Print state of address in memory system via PrintReq (for + * debugging). + */ + void printAddr(Addr a); + protected: class TickEvent : public Event { private: MemTest *cpu; + public: - TickEvent(MemTest *c) - : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c) {} - void process() {cpu->tick();} - virtual const char *description() { return "tick event"; } + TickEvent(MemTest *c) : Event(CPU_Tick_Pri), cpu(c) {} + void process() { cpu->tick(); } + virtual const char *description() const { return "MemTest tick"; } }; TickEvent tickEvent; + class CpuPort : public Port { - MemTest *memtest; public: @@ -100,6 +93,8 @@ class MemTest : public MemObject : Port(_name, _memtest), memtest(_memtest) { } + bool snoopRangeSent; + protected: virtual bool recvTiming(PacketPtr pkt); @@ -113,14 +108,16 @@ class MemTest : public MemObject virtual void recvRetry(); virtual void getDeviceAddressRanges(AddrRangeList &resp, - AddrRangeList &snoop) - { resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,-1)); } + bool &snoop) + { resp.clear(); snoop = false; } }; CpuPort cachePort; CpuPort funcPort; - class MemTestSenderState : public Packet::SenderState + bool snoopRangeSent; + + class MemTestSenderState : public Packet::SenderState, public FastAlloc { public: /** Constructor. */ @@ -132,21 +129,23 @@ class MemTest : public MemObject uint8_t *data; }; -// Request *dataReq; PacketPtr retryPkt; -// MemInterface *cacheInterface; -// PhysicalMemory *mainMem; -// PhysicalMemory *checkMem; -// SimpleThread *thread; bool accessRetry; + + // + // The dmaOustanding flag enforces only one dma at a time + // + bool dmaOutstanding; - unsigned size; // size of testing memory region + unsigned size; // size of testing memory region - unsigned percentReads; // target percentage of read accesses - unsigned percentFunctional; // target percentage of functional accesses + unsigned percentReads; // target percentage of read accesses + unsigned percentFunctional; // target percentage of functional accesses unsigned percentUncacheable; + bool issueDmas; + int id; std::set outstandingAddrs; @@ -162,12 +161,12 @@ class MemTest : public MemObject Addr traceBlockAddr; - Addr baseAddr1; // fix this to option - Addr baseAddr2; // fix this to option + Addr baseAddr1; // fix this to option + Addr baseAddr2; // fix this to option Addr uncacheAddr; - unsigned progressInterval; // frequency of progress reports - Tick nextProgressMessage; // access # for next progress report + unsigned progressInterval; // frequency of progress reports + Tick nextProgressMessage; // access # for next progress report unsigned percentSourceUnaligned; unsigned percentDestUnaligned; @@ -179,9 +178,9 @@ class MemTest : public MemObject bool atomic; - Stats::Scalar<> numReadsStat; - Stats::Scalar<> numWritesStat; - Stats::Scalar<> numCopiesStat; + Stats::Scalar numReadsStat; + Stats::Scalar numWritesStat; + Stats::Scalar numCopiesStat; // called by MemCompleteEvent::process() void completeRequest(PacketPtr pkt);