#include "params/MipsITB.hh"
namespace MipsISA {
+ Fault
+ TLB::translate(RequestPtr req, ThreadContext *tc, bool)
+ {
+ Fault fault = GenericTLB::translate(req, tc);
+ if (fault != NoFault)
+ return fault;
+
+ typeof(req->getSize()) size = req->getSize();
+ Addr paddr = req->getPaddr();
+
+ if (!isPowerOf2(size))
+ panic("Invalid request size!\n");
+ if ((size - 1) & paddr)
+ return new GenericAlignmentFault(paddr);
+
+ return NoFault;
+ }
+
void
TlbEntry::serialize(std::ostream &os)
{
void unserialize(Checkpoint *cp, const std::string §ion);
};
- class ITB : public GenericITB<>
+ class TLB : public GenericTLB
{
public:
- ITB(const std::string &name) : GenericITB<>(name)
+ TLB(const std::string &name) : GenericTLB(name)
+ {}
+
+ Fault translate(RequestPtr req, ThreadContext *tc, bool=false);
+ };
+
+ class ITB : public TLB
+ {
+ public:
+ ITB(const std::string &name) : TLB(name)
{}
};
- class DTB : public GenericDTB<>
+ class DTB : public TLB
{
public:
- DTB(const std::string &name) : GenericDTB<>(name)
+ DTB(const std::string &name) : TLB(name)
{}
};
};
void unserialize(Checkpoint *cp, const std::string §ion);
};
- class ITB : public GenericITB<false, false>
+ class ITB : public GenericTLB
{
public:
- ITB(const std::string &name) : GenericITB<false, false>(name)
+ ITB(const std::string &name) : GenericTLB(name)
{}
};
- class DTB : public GenericDTB<false, false>
+ class DTB : public GenericTLB
{
public:
- DTB(const std::string &name) : GenericDTB<false, false>(name)
+ DTB(const std::string &name) : GenericTLB(name)
{}
};
};
#include "sim/tlb.hh"
Fault
-GenericTLBBase::translate(RequestPtr req, ThreadContext * tc)
+GenericTLB::translate(RequestPtr req, ThreadContext * tc, bool)
{
#if FULL_SYSTEM
panic("Generic translation shouldn't be used in full system mode.\n");
class ThreadContext;
class Packet;
-class GenericTLBBase : public SimObject
+class GenericTLB : public SimObject
{
protected:
- GenericTLBBase(const std::string &name) : SimObject(name)
+ GenericTLB(const std::string &name) : SimObject(name)
{}
- Fault translate(RequestPtr req, ThreadContext *tc);
-};
-
-template <bool doSizeCheck=true, bool doAlignmentCheck=true>
-class GenericTLB : public GenericTLBBase
-{
- public:
- GenericTLB(const std::string &name) : GenericTLBBase(name)
- {}
-
- Fault translate(RequestPtr req, ThreadContext *tc, bool=false)
- {
- Fault fault = GenericTLBBase::translate(req, tc);
- if (fault != NoFault)
- return fault;
-
- typeof(req->getSize()) size = req->getSize();
- Addr paddr = req->getPaddr();
-
- if(doSizeCheck && !isPowerOf2(size))
- panic("Invalid request size!\n");
- if (doAlignmentCheck && ((size - 1) & paddr))
- return new GenericAlignmentFault(paddr);
-
- return NoFault;
- }
-};
-
-template <bool doSizeCheck=true, bool doAlignmentCheck=true>
-class GenericITB : public GenericTLB<doSizeCheck, doAlignmentCheck>
-{
public:
- GenericITB(const std::string &name) :
- GenericTLB<doSizeCheck, doAlignmentCheck>(name)
- {}
-};
-
-template <bool doSizeCheck=true, bool doAlignmentCheck=true>
-class GenericDTB : public GenericTLB<doSizeCheck, doAlignmentCheck>
-{
- public:
- GenericDTB(const std::string &name) :
- GenericTLB<doSizeCheck, doAlignmentCheck>(name)
- {}
+ Fault translate(RequestPtr req, ThreadContext *tc, bool=false);
};
#endif // __ARCH_SPARC_TLB_HH__