[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 88 2008-12-10 18:31:39Z 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 |
---|
| 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; |
---|
| 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 | |
---|
[88] | 57 | public : void retire_write_old (bool restore_old) |
---|
[78] | 58 | { |
---|
[88] | 59 | if (not restore_old) |
---|
| 60 | { |
---|
| 61 | _is_link = 0; |
---|
| 62 | } |
---|
| 63 | // else nothing |
---|
[78] | 64 | } |
---|
| 65 | |
---|
[88] | 66 | public : void retire_write_new (bool restore_old) |
---|
[78] | 67 | { |
---|
[88] | 68 | if (restore_old) |
---|
| 69 | { |
---|
| 70 | _is_link = 0; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | // in all case |
---|
[78] | 74 | _is_valid = 1; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | public : void free (void) |
---|
| 78 | { |
---|
| 79 | _is_free = 1; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | public : bool can_insert_read (uint32_t max_reader) |
---|
| 83 | { |
---|
| 84 | return ((_counter+1) < max_reader); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | public : bool can_free (void) |
---|
| 88 | { |
---|
| 89 | return ((_is_free == 0) and |
---|
| 90 | (_is_link == 0) and |
---|
[88] | 91 | // (_is_valid == 1) and // if is_link <- 0, then retire_write_old or reset |
---|
[78] | 92 | (_counter == 0)); |
---|
| 93 | } |
---|
| 94 | |
---|
[88] | 95 | public : friend std::ostream& operator<< (std::ostream& output, |
---|
[78] | 96 | stat_list_entry_t & x) |
---|
| 97 | { |
---|
[88] | 98 | output << x._is_free << " " |
---|
| 99 | << x._is_link << " " |
---|
| 100 | << x._is_valid << " " |
---|
| 101 | << x._counter; |
---|
[78] | 102 | |
---|
[88] | 103 | return output; |
---|
[78] | 104 | } |
---|
| 105 | |
---|
| 106 | }; |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | }; // end namespace stat_list_unit |
---|
| 110 | }; // end namespace register_translation_unit |
---|
| 111 | }; // end namespace rename_unit |
---|
| 112 | }; // end namespace ooo_engine |
---|
| 113 | }; // end namespace multi_ooo_engine |
---|
| 114 | }; // end namespace core |
---|
| 115 | |
---|
| 116 | }; // end namespace behavioural |
---|
| 117 | }; // end namespace morpheo |
---|
| 118 | |
---|
| 119 | #endif |
---|