[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$ |
---|
| 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 | { |
---|
| 25 | private : bool _is_free ; // set = is present in free list |
---|
| 26 | private : bool _is_link ; // set = is present in rat |
---|
| 27 | private : bool _is_valid; // set = an instruction have write in this register |
---|
| 28 | private : uint32_t _counter ; // number of register that must read this register |
---|
| 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; |
---|
| 37 | _is_valid = 1; |
---|
| 38 | _counter = 0; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | public : void insert_read (void) |
---|
| 42 | { |
---|
| 43 | _counter ++; |
---|
| 44 | } |
---|
| 45 | public : void insert_write (void) |
---|
| 46 | { |
---|
| 47 | _is_free = 0; |
---|
| 48 | _is_link = 1; |
---|
| 49 | _is_valid = 0; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | public : void retire_read (void) |
---|
| 53 | { |
---|
| 54 | _counter --; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public : void retire_write_old (void) |
---|
| 58 | { |
---|
| 59 | _is_link = 0; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | public : void retire_write_new (void) |
---|
| 63 | { |
---|
| 64 | _is_valid = 1; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | public : void free (void) |
---|
| 68 | { |
---|
| 69 | _is_free = 1; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | public : bool can_insert_read (uint32_t max_reader) |
---|
| 73 | { |
---|
| 74 | return ((_counter+1) < max_reader); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | public : bool can_free (void) |
---|
| 78 | { |
---|
| 79 | return ((_is_free == 0) and |
---|
| 80 | (_is_link == 0) and |
---|
| 81 | (_is_valid == 1) and |
---|
| 82 | (_counter == 0)); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | public : friend std::ostream& operator<< (std::ostream& output_stream, |
---|
| 86 | stat_list_entry_t & x) |
---|
| 87 | { |
---|
| 88 | output_stream << x._is_free << " " |
---|
| 89 | << x._is_link << " " |
---|
| 90 | << x._is_valid << " " |
---|
| 91 | << x._counter; |
---|
| 92 | |
---|
| 93 | return output_stream; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | }; |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | }; // end namespace stat_list_unit |
---|
| 100 | }; // end namespace register_translation_unit |
---|
| 101 | }; // end namespace rename_unit |
---|
| 102 | }; // end namespace ooo_engine |
---|
| 103 | }; // end namespace multi_ooo_engine |
---|
| 104 | }; // end namespace core |
---|
| 105 | |
---|
| 106 | }; // end namespace behavioural |
---|
| 107 | }; // end namespace morpheo |
---|
| 108 | |
---|
| 109 | #endif |
---|