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 | { |
---|
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 |
---|
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 | |
---|
46 | public : void insert_write (void) |
---|
47 | { |
---|
48 | _is_free = 0; |
---|
49 | _is_link = 1; |
---|
50 | // _is_valid = 0; |
---|
51 | } |
---|
52 | |
---|
53 | // public : void retire_read (void) |
---|
54 | // { |
---|
55 | // _counter --; |
---|
56 | // } |
---|
57 | |
---|
58 | public : void retire_write_old (bool restore, bool restore_old) |
---|
59 | { |
---|
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; |
---|
66 | } |
---|
67 | |
---|
68 | public : void retire_write_new (bool restore, bool restore_old) |
---|
69 | { |
---|
70 | // restore restore_old is_link |
---|
71 | // 0 x 1 - normal case : allocate |
---|
72 | // 1 x 0 - event, need restore oldest register |
---|
73 | |
---|
74 | if (restore) |
---|
75 | _is_link = 0; |
---|
76 | |
---|
77 | // in all case |
---|
78 | // _is_valid = 1; |
---|
79 | } |
---|
80 | |
---|
81 | public : void free (void) |
---|
82 | { |
---|
83 | _is_free = 1; |
---|
84 | } |
---|
85 | |
---|
86 | // public : bool can_insert_read (uint32_t max_reader) |
---|
87 | // { |
---|
88 | // return ((_counter+1) < max_reader); |
---|
89 | // } |
---|
90 | |
---|
91 | public : bool can_free (void) |
---|
92 | { |
---|
93 | return ((_is_free == 0) and |
---|
94 | (_is_link == 0) // and |
---|
95 | // (_is_valid == 1) and // if is_link <- 0, then retire_write_old or reset |
---|
96 | // (_counter == 0) |
---|
97 | ); |
---|
98 | } |
---|
99 | |
---|
100 | public : friend std::ostream& operator<< (std::ostream& output, |
---|
101 | stat_list_entry_t & x) |
---|
102 | { |
---|
103 | output << x._is_free << " " |
---|
104 | << x._is_link // << " " |
---|
105 | // << x._is_valid << " " |
---|
106 | // << x._counter |
---|
107 | ; |
---|
108 | |
---|
109 | return output; |
---|
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 |
---|