5#include "sparta/utils/MathUtils.hpp"
6#include "cache/BasicCacheItem.hpp"
7#include "cache/SimpleCache2.hpp"
8#include "cache/ReplacementIF.hpp"
18 page_size_(page_size),
23 "TLBEntry: Page size must be a power of 2. page_size=" << page_size);
29 page_size_(rhs.page_size_),
37 BasicCacheItem::operator=(rhs);
38 page_size_ = rhs.page_size_;
47 void reset(uint64_t addr)
50 BasicCacheItem::setAddr(addr);
54 void setValid(
bool v) { valid_ = v; }
57 bool isValid()
const {
return valid_; }
60 void setModified(
bool m) { (void) m; }
63 bool read(uint64_t offset, uint32_t size, uint32_t *buf)
const
73 bool write(uint64_t offset, uint32_t size, uint32_t *buf)
const
88 class SimpleTLB :
public sparta::cache::SimpleCache2<SimpleTLBEntry>,
92 static constexpr const char* name =
"tlb";
99 PARAMETER(uint64_t, tlb_page_size, 4096,
"Page size in bytes (power of 2)")
100 PARAMETER(uint64_t, tlb_num_of_entries, 32,
"L1 TLB # of entries (power of 2)")
101 PARAMETER(uint64_t, tlb_associativity, 32,
"L1 TLB associativity (power of 2)")
103 using Handle = std::shared_ptr<SimpleTLB>;
110 sparta::cache::TreePLRUReplacement(p->tlb_associativity)),
#define PARAMETER(type, name, def, doc)
Parameter declaration.
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Represents a counter of type counter_type (uint64_t). 2 and greater than 0 with a ceiling specified....
Generic container of Parameters.
Node in a composite tree representing a sparta Tree item.
The is the base class for user defined blocks in simulation.
log::MessageSource debug_logger_
Default debug logger.
Unit(TreeNode *rc, const std::string &name)
Construct unit with a ResouceContainer.
sparta::StatisticSet unit_stat_set_
The Unit's statistic set.
Macros for handling exponential backoff.