diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-08-28 14:30:50 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-08-28 14:30:50 -0700 |
commit | a3367adaff66997044553cb9a746e101418afbdd (patch) | |
tree | 4a26081985724fe95e9b993e8d49994d2e65a755 /src/sim/tlb.hh | |
parent | 3ab19130770e04aaede1a3582959a01bb482b96b (diff) | |
download | gem5-a3367adaff66997044553cb9a746e101418afbdd.tar.xz |
Address translation: De-templatize the GenericTLB class.
--HG--
extra : convert_revision : b605a90a4a1071e39f49085a839fdcd175e09fdb
Diffstat (limited to 'src/sim/tlb.hh')
-rw-r--r-- | src/sim/tlb.hh | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/src/sim/tlb.hh b/src/sim/tlb.hh index c4c171015..4239b4cf3 100644 --- a/src/sim/tlb.hh +++ b/src/sim/tlb.hh @@ -39,56 +39,14 @@ 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__ |