from cloned git
[predictor-hash.git] / predictorhash.h
blob287a435fb93fc3a7f9573c73b0c73ca5d16aade6
1 #ifndef PREDICTORHASH_H
2 #define PREDICTORHASH_H
6 #define PREDICT_TABLE_SIZE 0x1000 // 256 entry table
7 #define INDEX_MASK 0x00000FFF // 8 bit index in a 256 entry table
8 #define TAG_MASK 0x00003000 // next 6 bits for tag
9 #define TAG_SHIFT 12 // shift to bring the tag down for comparison.
10 #define HASH_SHIFT 5 // shift the prev_hash by this many bits before ORing with last_hash
12 struct predict_table_entry{
13 /*Phase prediction paper says that their predictor has
14 256 entries encompassing less than 500 bytes. This should make each entry of
15 2 bytes (a little less). How to divide this between tag and predicted id ?
17 On-line simpoint says that they have a signature table of 1024 entries. Thus
18 the phase_id can go up to 10 bits. This leaves only 6 bits for Tag ? Or did
19 they use larger table entries ?
22 // limit the size in the light of above discussion?
23 unsigned int tag;
24 unsigned int phase_id;
27 struct PredictorHash {
29 // how much in future we have to predict
30 unsigned int future_len;
32 unsigned short * history;
33 unsigned int hist_head;
34 unsigned int hist_tail;
36 /*it shows only the num-entries. size of history = hist_len*2*2 bytes
37 * if short */
38 unsigned int history_length;
39 int largest_center;
42 // prediction table
43 // see the size : shall we limit the size ??
44 struct predict_table_entry predict_table[PREDICT_TABLE_SIZE];
45 unsigned int prev_hash; // contains the id and num_occr of
46 // prev (before the last) phase hashed
48 unsigned int last_phase_predictions; //stats
49 unsigned int new_phase_predictions;
53 struct PredictorHash * predictor_create(
54 unsigned int hist_size
55 ,unsigned int futur_len
57 #endif //PREDICTORHASH_H