tickEvent(this),
cachePort("test", this),
funcPort("functional", this),
+ funcProxy(funcPort),
retryPkt(NULL),
// mainMem(main_mem),
// checkMem(check_mem),
exitSimLoop("maximum number of loads reached");
} else {
assert(pkt->isWrite());
- funcPort.writeBlob(req->getPaddr(), pkt_data, req->getSize());
+ funcProxy.writeBlob(req->getPaddr(), pkt_data, req->getSize());
numWrites++;
numWritesStat++;
}
outstandingAddrs.insert(paddr);
// ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin
- funcPort.readBlob(req->getPaddr(), result, req->getSize());
+ funcProxy.readBlob(req->getPaddr(), result, req->getSize());
DPRINTF(MemTest,
"id %d initiating %sread at addr %x (blk %x) expecting %x\n",
#include "base/statistics.hh"
#include "mem/mem_object.hh"
#include "mem/port.hh"
+#include "mem/port_proxy.hh"
#include "params/MemTest.hh"
#include "sim/eventq.hh"
#include "sim/sim_exit.hh"
CpuPort cachePort;
CpuPort funcPort;
+ PortProxy funcProxy;
class MemTestSenderState : public Packet::SenderState, public FastAlloc
{
baMask = (wsm[i] & (ULL(0xfff) << 20)) | (ULL(0x7f) << 13);
pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10);
- pioPort.readBlob(pteAddr, (uint8_t*)&pteEntry,
- sizeof(uint64_t));
+ sys->physProxy.readBlob(pteAddr, (uint8_t*)&pteEntry,
+ sizeof(uint64_t));
dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | (busAddr & ULL(0x1fff));
baMask = (wsm[i] & (ULL(0xfff) << 20)) | (ULL(0x7f) << 13);
pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10);
- pioPort.readBlob(pteAddr, (uint8_t*)&pteEntry,
- sizeof(uint64_t));
+ sys->physProxy.readBlob(pteAddr, (uint8_t*)&pteEntry,
+ sizeof(uint64_t));
dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | (busAddr & ULL(0x1fff));
Source('packet.cc')
Source('port.cc')
Source('tport.cc')
+Source('port_proxy.cc')
Source('fs_translating_port_proxy.cc')
Source('se_translating_port_proxy.cc')
* @file
* Port object definitions.
*/
-#include <cstring>
-
-#include "base/chunk_generator.hh"
#include "base/trace.hh"
#include "debug/Config.hh"
#include "mem/mem_object.hh"
owner = _owner;
}
-void
-Port::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd)
-{
- Request req;
-
- for (ChunkGenerator gen(addr, size, peerBlockSize());
- !gen.done(); gen.next()) {
- req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId);
- Packet pkt(&req, cmd, Packet::Broadcast);
- pkt.dataStatic(p);
- sendFunctional(&pkt);
- p += gen.size();
- }
-}
-
-void
-Port::writeBlob(Addr addr, uint8_t *p, int size)
-{
- blobHelper(addr, p, size, MemCmd::WriteReq);
-}
-
-void
-Port::readBlob(Addr addr, uint8_t *p, int size)
-{
- blobHelper(addr, p, size, MemCmd::ReadReq);
-}
-
-void
-Port::memsetBlob(Addr addr, uint8_t val, int size)
-{
- // quick and dirty...
- uint8_t *buf = new uint8_t[size];
-
- std::memset(buf, val, size);
- blobHelper(addr, buf, size, MemCmd::WriteReq);
-
- delete [] buf;
-}
-
-
void
Port::printAddr(Addr a)
{
/*
- * Copyright (c) 2011 ARM Limited
+ * Copyright (c) 2011-2012 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Ron Dreslinski
+ * Andreas Hansson
*/
/**
#include <list>
-#include "base/misc.hh"
#include "base/range.hh"
-#include "base/types.hh"
#include "mem/packet.hh"
-#include "mem/request.hh"
/** This typedef is used to clean up getAddrRanges(). It's declared
* outside the Port object since it's also used by some mem objects.
*/
unsigned peerBlockSize() const { return peer->deviceBlockSize(); }
- /** This function is a wrapper around sendFunctional()
- that breaks a larger, arbitrarily aligned access into
- appropriate chunks. The default implementation can use
- getBlockSize() to determine the block size and go from there.
- */
- virtual void readBlob(Addr addr, uint8_t *p, int size);
-
- /** This function is a wrapper around sendFunctional()
- that breaks a larger, arbitrarily aligned access into
- appropriate chunks. The default implementation can use
- getBlockSize() to determine the block size and go from there.
- */
- virtual void writeBlob(Addr addr, uint8_t *p, int size);
-
- /** Fill size bytes starting at addr with byte value val. This
- should not need to be virtual, since it can be implemented in
- terms of writeBlob(). However, it shouldn't be
- performance-critical either, so it could be if we wanted to.
- */
- virtual void memsetBlob(Addr addr, uint8_t val, int size);
-
/** Inject a PrintReq for the given address to print the state of
* that address throughout the memory system. For debugging.
*/
void printAddr(Addr a);
-
- private:
-
- /** Internal helper function for read/writeBlob().
- */
- void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd);
};
#endif //__MEM_PORT_HH__
--- /dev/null
+/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * 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: Andreas Hansson
+ */
+
+#include "base/chunk_generator.hh"
+#include "mem/port_proxy.hh"
+
+void
+PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd)
+{
+ Request req;
+
+ for (ChunkGenerator gen(addr, size, _port.peerBlockSize());
+ !gen.done(); gen.next()) {
+ req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId);
+ Packet pkt(&req, cmd, Packet::Broadcast);
+ pkt.dataStatic(p);
+ _port.sendFunctional(&pkt);
+ p += gen.size();
+ }
+}
+
+void
+PortProxy::memsetBlob(Addr addr, uint8_t v, int size)
+{
+ // quick and dirty...
+ uint8_t *buf = new uint8_t[size];
+
+ std::memset(buf, v, size);
+ blobHelper(addr, buf, size, MemCmd::WriteReq);
+
+ delete [] buf;
+}
/*
- * Copyright (c) 2011 ARM Limited
+ * Copyright (c) 2011-2012 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* @file
* PortProxy Object Declaration.
*
- * Port proxies are used when non structural entities need access to
- * the memory system. Proxy objects replace the previous
- * FunctionalPort, TranslatingPort and VirtualPort objects, which
- * provided the same functionality as the proxies, but were instances
- * of ports not corresponding to real structural ports of the
- * simulated system. Via the port proxies all the accesses go through
- * an actual port and thus are transparent to a potentially
+ * Port proxies are used when non-structural entities need access to
+ * the memory system (or structural entities that want to peak into
+ * the memory system without making a real memory access).
+ *
+ * Proxy objects replace the previous FunctionalPort, TranslatingPort
+ * and VirtualPort objects, which provided the same functionality as
+ * the proxies, but were instances of ports not corresponding to real
+ * structural ports of the simulated system. Via the port proxies all
+ * the accesses go through an actual port (either the system port,
+ * e.g. for processes or initialisation, or a the data port of the
+ * CPU, e.g. for threads) and thus are transparent to a potentially
* distributed memory and automatically adhere to the memory map of
* the system.
*/
#include "arch/isa_traits.hh"
#endif
-#include "base/types.hh"
#include "mem/port.hh"
#include "sim/byteswap.hh"
/**
- * This object is a proxy for a structural port,
- * to be used for debug accesses.
+ * This object is a proxy for a structural port, to be used for debug
+ * accesses.
*
* This proxy object is used when non structural entities
* (e.g. thread contexts, object file loaders) need access to the
*/
class PortProxy
{
- protected:
+ private:
+
+ /** The actual physical port used by this proxy. */
Port &_port;
+ void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd);
+
public:
PortProxy(Port &port) : _port(port) { }
virtual ~PortProxy() { }
- public:
/**
* Read size bytes memory at address and store in p.
*/
- virtual void readBlob(Addr address, uint8_t* p, int size)
- { _port.readBlob(address, p, size); }
+ virtual void readBlob(Addr addr, uint8_t* p, int size)
+ { blobHelper(addr, p, size, MemCmd::ReadReq); }
/**
* Write size bytes from p to address.
*/
- virtual void writeBlob(Addr address, uint8_t* p, int size)
- { _port.writeBlob(address, p, size); }
+ virtual void writeBlob(Addr addr, uint8_t* p, int size)
+ { blobHelper(addr, p, size, MemCmd::WriteReq); }
/**
* Fill size bytes starting at addr with byte value val.
*/
- virtual void memsetBlob(Addr address, uint8_t v, int size)
- { _port.memsetBlob(address, v, size); }
+ virtual void memsetBlob(Addr addr, uint8_t v, int size);
/**
* Read sizeof(T) bytes from address and return as object T.