btb.hh revision 1061
1#ifndef __BTB_HH__ 2#define __BTB_HH__ 3 4// For Addr type. 5#include "arch/alpha/isa_traits.hh" 6 7class DefaultBTB 8{ 9 private: 10 struct BTBEntry 11 { 12 BTBEntry() 13 : tag(0), target(0), valid(false) 14 { 15 } 16 17 Addr tag; 18 Addr target; 19 bool valid; 20 }; 21 22 public: 23 DefaultBTB(unsigned numEntries, unsigned tagBits, 24 unsigned instShiftAmt); 25 26 Addr lookup(const Addr &inst_PC); 27 28 bool valid(const Addr &inst_PC); 29 30 void update(const Addr &inst_PC, const Addr &target_PC); 31 32 private: 33 inline unsigned getIndex(const Addr &inst_PC); 34 35 inline Addr getTag(const Addr &inst_PC); 36 37 BTBEntry *btb; 38 39 unsigned numEntries; 40 41 unsigned idxMask; 42 43 unsigned tagBits; 44 45 unsigned tagMask; 46 47 unsigned instShiftAmt; 48 49 unsigned tagShiftAmt; 50}; 51 52#endif // __BTB_HH__ 53