[78] | 1 | #ifndef morpheo_behavioural_core_multi_ooo_engine_ooo_engine_rename_unit_register_translation_unit_stat_list_unit_Types_h |
---|
| 2 | #define morpheo_behavioural_core_multi_ooo_engine_ooo_engine_rename_unit_register_translation_unit_stat_list_unit_Types_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Types.h 123 2009-06-08 20:43:30Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #include "Behavioural/include/Types.h" |
---|
| 12 | |
---|
| 13 | namespace morpheo { |
---|
| 14 | namespace behavioural { |
---|
| 15 | |
---|
| 16 | namespace core { |
---|
| 17 | namespace multi_ooo_engine { |
---|
| 18 | namespace ooo_engine { |
---|
| 19 | namespace rename_unit { |
---|
| 20 | namespace register_translation_unit { |
---|
| 21 | namespace stat_list_unit { |
---|
| 22 | |
---|
| 23 | class stat_list_entry_t |
---|
| 24 | { |
---|
[117] | 25 | public : bool _is_free ; // set = is present in free list |
---|
| 26 | public : bool _is_link ; // set = is present in rat |
---|
| 27 | public : bool _is_use ; // set = is present in ROB (used by an instruction as destination) |
---|
| 28 | // not necesseray in single thread mode : because an thread can't rename when they have an event |
---|
| 29 | // in multi thread, the renaming continue and an old register can be reused |
---|
[78] | 30 | |
---|
| 31 | public : stat_list_entry_t (void) {}; |
---|
| 32 | public : ~stat_list_entry_t (void) {}; |
---|
| 33 | |
---|
| 34 | public : void reset (bool is_link) |
---|
| 35 | { |
---|
| 36 | _is_free = 0; |
---|
| 37 | _is_link = is_link; |
---|
[117] | 38 | _is_use = is_link; |
---|
[78] | 39 | } |
---|
| 40 | |
---|
[117] | 41 | public : void insert_write_old (void) |
---|
| 42 | { |
---|
| 43 | // old is not in the rat, but is already used (if miss prediction or event) |
---|
| 44 | _is_link = 0; |
---|
| 45 | } |
---|
[112] | 46 | |
---|
[117] | 47 | public : void insert_write_new (void) |
---|
[78] | 48 | { |
---|
| 49 | _is_free = 0; |
---|
| 50 | _is_link = 1; |
---|
[117] | 51 | _is_use = 1; |
---|
[78] | 52 | } |
---|
| 53 | |
---|
[112] | 54 | public : void retire_write_old (bool restore, bool restore_old) |
---|
[78] | 55 | { |
---|
[112] | 56 | // restore restore_old is_link |
---|
| 57 | // 0 x 0 - normal case : unallocate |
---|
| 58 | // 1 0 0 - event and previous update |
---|
| 59 | // 1 1 1 - event and first update |
---|
[117] | 60 | |
---|
| 61 | if (restore and restore_old) |
---|
| 62 | { |
---|
| 63 | _is_link = 1; |
---|
| 64 | // _is_use = 1; // already set |
---|
| 65 | } |
---|
| 66 | else |
---|
| 67 | { |
---|
[123] | 68 | _is_link = 0; |
---|
[117] | 69 | _is_use = 0; |
---|
| 70 | } |
---|
| 71 | |
---|
[78] | 72 | } |
---|
| 73 | |
---|
[112] | 74 | public : void retire_write_new (bool restore, bool restore_old) |
---|
[78] | 75 | { |
---|
[112] | 76 | // restore restore_old is_link |
---|
| 77 | // 0 x 1 - normal case : allocate |
---|
| 78 | // 1 x 0 - event, need restore oldest register |
---|
[88] | 79 | |
---|
[112] | 80 | if (restore) |
---|
[117] | 81 | { |
---|
| 82 | // test if is the actual mapping (in RAT) |
---|
| 83 | if (_is_link) |
---|
| 84 | _is_use = 0; |
---|
[112] | 85 | |
---|
[117] | 86 | _is_link = 0; |
---|
| 87 | } |
---|
[78] | 88 | } |
---|
| 89 | |
---|
| 90 | public : void free (void) |
---|
| 91 | { |
---|
| 92 | _is_free = 1; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | public : bool can_free (void) |
---|
| 96 | { |
---|
| 97 | return ((_is_free == 0) and |
---|
[117] | 98 | (_is_link == 0) and |
---|
| 99 | (_is_use == 0)); |
---|
[78] | 100 | } |
---|
| 101 | |
---|
[88] | 102 | public : friend std::ostream& operator<< (std::ostream& output, |
---|
[78] | 103 | stat_list_entry_t & x) |
---|
| 104 | { |
---|
[88] | 105 | output << x._is_free << " " |
---|
[117] | 106 | << x._is_link << " " |
---|
| 107 | << x._is_use ; |
---|
[78] | 108 | |
---|
[88] | 109 | return output; |
---|
[78] | 110 | } |
---|
| 111 | |
---|
| 112 | }; |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | }; // end namespace stat_list_unit |
---|
| 116 | }; // end namespace register_translation_unit |
---|
| 117 | }; // end namespace rename_unit |
---|
| 118 | }; // end namespace ooo_engine |
---|
| 119 | }; // end namespace multi_ooo_engine |
---|
| 120 | }; // end namespace core |
---|
| 121 | |
---|
| 122 | }; // end namespace behavioural |
---|
| 123 | }; // end namespace morpheo |
---|
| 124 | |
---|
| 125 | #endif |
---|