# IndexPolicy, ReplacementPolicy, and Entry in Gem5 explanation

All the variable is SimObj in Gem5. For instance, the SignaturePath Prefetcher is an instance of QueuedPrefetcher, The parameter to instantiate the object is passed with

struct SignaturePathPrefetcherParams
: public QueuedPrefetcherParams
{
gem5::prefetch::SignaturePath * create() const;
uint8_t num_counter_bits;
unsigned pattern_table_assoc;
uint64_t pattern_table_entries;
gem5::BaseIndexingPolicy * pattern_table_indexing_policy;
gem5::replacement_policy::Base * pattern_table_replacement_policy;
double prefetch_confidence_threshold;
uint16_t signature_bits;
uint8_t signature_shift;
unsigned signature_table_assoc;
uint64_t signature_table_entries;
gem5::BaseIndexingPolicy * signature_table_indexing_policy;
gem5::replacement_policy::Base * signature_table_replacement_policy;
unsigned strides_per_pattern_entry;
};


Because there are actually 3 entries defined in SPPPrefetcher, the version 2 of SPP add the Global History Register Table, every time you accessed the prefetcher, say grabbing information from L2 access info, is adding an entry in these three tables. And the timing of fetching is during the pipeline fetching the data.

The associativity of the table inside SPPPrefetcher is always 1. So the Base IndexPolicy is too tooo toooo overly enculpsion for this prefetcher.

The BaseIndexPolicy is every time you access the entry, the AssociativeSet will initialize a set resides the vector you access, say a TaggedEntry that uses the address as a tag, it will also initialize the ReplcamentPolicy basically requiring the entry vector and pattern vector. every time find a victim will call the replacement policy and call LRU to evict the victim. I will do it using a lambda function over vector view.