tlb.hh (4960:f0e3c34737d3) tlb.hh (4967:fb9a1d205359)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 47 unchanged lines hidden (view full) ---

56 typedef std::multimap<Addr, int> PageTable;
57 PageTable lookupTable; // Quick lookup into page table
58
59 PTE *table; // the Page Table
60 int size; // TLB Size
61 int nlu; // not last used entry (for replacement)
62
63 void nextnlu() { if (++nlu >= size) nlu = 0; }
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 47 unchanged lines hidden (view full) ---

56 typedef std::multimap<Addr, int> PageTable;
57 PageTable lookupTable; // Quick lookup into page table
58
59 PTE *table; // the Page Table
60 int size; // TLB Size
61 int nlu; // not last used entry (for replacement)
62
63 void nextnlu() { if (++nlu >= size) nlu = 0; }
64 PTE *lookup(Addr vpn, uint8_t asn) const;
64 PTE *lookup(Addr vpn, uint8_t asn);
65
66 public:
67 TLB(const std::string &name, int size);
68 virtual ~TLB();
69
70 int getsize() const { return size; }
71
72 PTE &index(bool advance = true);

--- 14 unchanged lines hidden (view full) ---

87
88 // Checkpointing
89 virtual void serialize(std::ostream &os);
90 virtual void unserialize(Checkpoint *cp, const std::string &section);
91
92 // Most recently used page table entries
93 PTE *PTECache[3];
94 inline void flushCache() { memset(PTECache, 0, 3 * sizeof(PTE*)); }
65
66 public:
67 TLB(const std::string &name, int size);
68 virtual ~TLB();
69
70 int getsize() const { return size; }
71
72 PTE &index(bool advance = true);

--- 14 unchanged lines hidden (view full) ---

87
88 // Checkpointing
89 virtual void serialize(std::ostream &os);
90 virtual void unserialize(Checkpoint *cp, const std::string &section);
91
92 // Most recently used page table entries
93 PTE *PTECache[3];
94 inline void flushCache() { memset(PTECache, 0, 3 * sizeof(PTE*)); }
95 inline PTE* updateCache(PTE *pte) {
96 PTECache[2] = PTECache[1];
97 PTECache[1] = PTECache[0];
98 PTECache[0] = pte;
99 return pte;
100 }
95 };
96
97 class ITB : public TLB
98 {
99 protected:
100 mutable Stats::Scalar<> hits;
101 mutable Stats::Scalar<> misses;
102 mutable Stats::Scalar<> acv;
103 mutable Stats::Formula accesses;
104
105 public:
106 ITB(const std::string &name, int size);
107 virtual void regStats();
108
101 };
102
103 class ITB : public TLB
104 {
105 protected:
106 mutable Stats::Scalar<> hits;
107 mutable Stats::Scalar<> misses;
108 mutable Stats::Scalar<> acv;
109 mutable Stats::Formula accesses;
110
111 public:
112 ITB(const std::string &name, int size);
113 virtual void regStats();
114
109 Fault translate(RequestPtr &req, ThreadContext *tc) const;
115 Fault translate(RequestPtr &req, ThreadContext *tc);
110 };
111
112 class DTB : public TLB
113 {
114 protected:
115 mutable Stats::Scalar<> read_hits;
116 mutable Stats::Scalar<> read_misses;
117 mutable Stats::Scalar<> read_acv;

--- 6 unchanged lines hidden (view full) ---

124 Stats::Formula misses;
125 Stats::Formula acv;
126 Stats::Formula accesses;
127
128 public:
129 DTB(const std::string &name, int size);
130 virtual void regStats();
131
116 };
117
118 class DTB : public TLB
119 {
120 protected:
121 mutable Stats::Scalar<> read_hits;
122 mutable Stats::Scalar<> read_misses;
123 mutable Stats::Scalar<> read_acv;

--- 6 unchanged lines hidden (view full) ---

130 Stats::Formula misses;
131 Stats::Formula acv;
132 Stats::Formula accesses;
133
134 public:
135 DTB(const std::string &name, int size);
136 virtual void regStats();
137
132 Fault translate(RequestPtr &req, ThreadContext *tc, bool write) const;
138 Fault translate(RequestPtr &req, ThreadContext *tc, bool write);
133 };
134}
135
136#endif // __ALPHA_MEMORY_HH__
139 };
140}
141
142#endif // __ALPHA_MEMORY_HH__