[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 112 2009-03-18 22:36:26Z 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 | { |
---|
[88] | 25 | public : bool _is_free ; // set = is present in free list |
---|
| 26 | public : bool _is_link ; // set = is present in rat |
---|
[112] | 27 | //public : bool _is_valid; // set = an instruction have write in this register |
---|
| 28 | //public : uint32_t _counter ; // number of register that must read this register |
---|
[78] | 29 | |
---|
| 30 | public : stat_list_entry_t (void) {}; |
---|
| 31 | public : ~stat_list_entry_t (void) {}; |
---|
| 32 | |
---|
| 33 | public : void reset (bool is_link) |
---|
| 34 | { |
---|
| 35 | _is_free = 0; |
---|
| 36 | _is_link = is_link; |
---|
[112] | 37 | // _is_valid = 1; |
---|
| 38 | // _counter = 0; |
---|
[78] | 39 | } |
---|
| 40 | |
---|
[112] | 41 | // public : void insert_read (void) |
---|
| 42 | // { |
---|
| 43 | // _counter ++; |
---|
| 44 | // } |
---|
| 45 | |
---|
[78] | 46 | public : void insert_write (void) |
---|
| 47 | { |
---|
| 48 | _is_free = 0; |
---|
| 49 | _is_link = 1; |
---|
[112] | 50 | // _is_valid = 0; |
---|
[78] | 51 | } |
---|
| 52 | |
---|
[112] | 53 | // public : void retire_read (void) |
---|
| 54 | // { |
---|
| 55 | // _counter --; |
---|
| 56 | // } |
---|
[78] | 57 | |
---|
[112] | 58 | public : void retire_write_old (bool restore, bool restore_old) |
---|
[78] | 59 | { |
---|
[112] | 60 | // restore restore_old is_link |
---|
| 61 | // 0 x 0 - normal case : unallocate |
---|
| 62 | // 1 0 0 - event and previous update |
---|
| 63 | // 1 1 1 - event and first update |
---|
| 64 | |
---|
| 65 | _is_link = restore and restore_old; |
---|
[78] | 66 | } |
---|
| 67 | |
---|
[112] | 68 | public : void retire_write_new (bool restore, bool restore_old) |
---|
[78] | 69 | { |
---|
[112] | 70 | // restore restore_old is_link |
---|
| 71 | // 0 x 1 - normal case : allocate |
---|
| 72 | // 1 x 0 - event, need restore oldest register |
---|
[88] | 73 | |
---|
[112] | 74 | if (restore) |
---|
| 75 | _is_link = 0; |
---|
| 76 | |
---|
[88] | 77 | // in all case |
---|
[112] | 78 | // _is_valid = 1; |
---|
[78] | 79 | } |
---|
| 80 | |
---|
| 81 | public : void free (void) |
---|
| 82 | { |
---|
| 83 | _is_free = 1; |
---|
| 84 | } |
---|
| 85 | |
---|
[112] | 86 | // public : bool can_insert_read (uint32_t max_reader) |
---|
| 87 | // { |
---|
| 88 | // return ((_counter+1) < max_reader); |
---|
| 89 | // } |
---|
[78] | 90 | |
---|
| 91 | public : bool can_free (void) |
---|
| 92 | { |
---|
| 93 | return ((_is_free == 0) and |
---|
[112] | 94 | (_is_link == 0) // and |
---|
| 95 | // (_is_valid == 1) and // if is_link <- 0, then retire_write_old or reset |
---|
| 96 | // (_counter == 0) |
---|
| 97 | ); |
---|
[78] | 98 | } |
---|
| 99 | |
---|
[88] | 100 | public : friend std::ostream& operator<< (std::ostream& output, |
---|
[78] | 101 | stat_list_entry_t & x) |
---|
| 102 | { |
---|
[88] | 103 | output << x._is_free << " " |
---|
[112] | 104 | << x._is_link // << " " |
---|
| 105 | // << x._is_valid << " " |
---|
| 106 | // << x._counter |
---|
| 107 | ; |
---|
[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 |
---|