1 | #ifdef SYSTEMC |
---|
2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
3 | /* |
---|
4 | * $Id$ |
---|
5 | * |
---|
6 | * [ Description ] |
---|
7 | * |
---|
8 | */ |
---|
9 | |
---|
10 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Reservation_station.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace core { |
---|
15 | namespace multi_execute_loop { |
---|
16 | namespace execute_loop { |
---|
17 | namespace multi_read_unit { |
---|
18 | namespace read_unit { |
---|
19 | namespace reservation_station { |
---|
20 | |
---|
21 | |
---|
22 | #undef FUNCTION |
---|
23 | #define FUNCTION "Reservation_station::genMoore" |
---|
24 | void Reservation_station::genMoore (void) |
---|
25 | { |
---|
26 | log_printf(FUNC,Reservation_station,FUNCTION,"Begin"); |
---|
27 | |
---|
28 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
29 | |
---|
30 | // accept a new instructions when reservation_station is not full |
---|
31 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
32 | for (internal_INSERT_SLOT=0; (internal_INSERT_SLOT<_param->_size_queue) and (_queue_valid[internal_INSERT_SLOT]==true); internal_INSERT_SLOT++); |
---|
33 | internal_INSERT_ACK = (internal_INSERT_SLOT<_param->_size_queue); |
---|
34 | #else |
---|
35 | internal_INSERT_ACK = not _queue_control->full(); |
---|
36 | #endif |
---|
37 | PORT_WRITE(out_INSERT_ACK, internal_INSERT_ACK); |
---|
38 | |
---|
39 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
40 | |
---|
41 | uint32_t index_queue=0; |
---|
42 | const uint32_t nb_slot_scan = _param->_size_queue-_param->_nb_inst_retire+1; |
---|
43 | |
---|
44 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
45 | { |
---|
46 | bool val = false; |
---|
47 | uint32_t index_find = 0;; |
---|
48 | |
---|
49 | for (; ( |
---|
50 | #ifndef SYSTEMC_VHDL_COMPATIBILITY |
---|
51 | (index_queue<_queue_control->nb_elt()) and |
---|
52 | #endif |
---|
53 | (index_queue>=i) and |
---|
54 | (index_queue<nb_slot_scan+i) and |
---|
55 | (val==false)); |
---|
56 | index_queue++) |
---|
57 | { |
---|
58 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
59 | index_find = index_queue; |
---|
60 | #else |
---|
61 | index_find = (*_queue_control)[index_queue]; |
---|
62 | #endif |
---|
63 | internal_RETIRE_SLOT [i] = index_queue; |
---|
64 | |
---|
65 | val = |
---|
66 | ( |
---|
67 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
68 | _queue_valid [index_queue] and |
---|
69 | #endif |
---|
70 | _queue[index_find]._data_ra_val and |
---|
71 | _queue[index_find]._data_rb_val and |
---|
72 | _queue[index_find]._data_rc_val |
---|
73 | ); |
---|
74 | |
---|
75 | // cout << "========== Moore : " << endl |
---|
76 | // << " * i : " << i << endl |
---|
77 | // << " * val : " << val << endl |
---|
78 | // << " * index_queue : " << index_queue << endl |
---|
79 | // << " * index_find : " << index_find << endl; |
---|
80 | } |
---|
81 | |
---|
82 | internal_RETIRE_VAL [i] = val; |
---|
83 | PORT_WRITE(out_RETIRE_VAL [i], val); |
---|
84 | |
---|
85 | if (val) |
---|
86 | { |
---|
87 | |
---|
88 | // #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
89 | // index_find = internal_RETIRE_SLOT [i]; |
---|
90 | // #else |
---|
91 | // index_find = (*_queue_control)[internal_RETIRE_SLOT [i]]; |
---|
92 | // #endif |
---|
93 | if (_param->_have_port_context_id) |
---|
94 | PORT_WRITE(out_RETIRE_CONTEXT_ID [i],_queue[index_find]._context_id); |
---|
95 | if (_param->_have_port_front_end_id) |
---|
96 | PORT_WRITE(out_RETIRE_FRONT_END_ID [i],_queue[index_find]._front_end_id); |
---|
97 | if (_param->_have_port_ooo_engine_id) |
---|
98 | PORT_WRITE(out_RETIRE_OOO_ENGINE_ID [i],_queue[index_find]._ooo_engine_id); |
---|
99 | if (_param->_have_port_rob_id) |
---|
100 | PORT_WRITE(out_RETIRE_ROB_ID [i],_queue[index_find]._rob_id); |
---|
101 | PORT_WRITE(out_RETIRE_OPERATION [i],_queue[index_find]._operation); |
---|
102 | PORT_WRITE(out_RETIRE_TYPE [i],_queue[index_find]._type); |
---|
103 | PORT_WRITE(out_RETIRE_HAS_IMMEDIAT [i],_queue[index_find]._has_immediat); |
---|
104 | PORT_WRITE(out_RETIRE_IMMEDIAT [i],_queue[index_find]._immediat); |
---|
105 | PORT_WRITE(out_RETIRE_DATA_RA [i],_queue[index_find]._data_ra); |
---|
106 | PORT_WRITE(out_RETIRE_DATA_RB [i],_queue[index_find]._data_rb); |
---|
107 | PORT_WRITE(out_RETIRE_DATA_RC [i],_queue[index_find]._data_rc); |
---|
108 | PORT_WRITE(out_RETIRE_WRITE_RD [i],_queue[index_find]._write_rd); |
---|
109 | PORT_WRITE(out_RETIRE_NUM_REG_RD [i],_queue[index_find]._num_reg_rd); |
---|
110 | PORT_WRITE(out_RETIRE_WRITE_RE [i],_queue[index_find]._write_re); |
---|
111 | PORT_WRITE(out_RETIRE_NUM_REG_RE [i],_queue[index_find]._num_reg_re); |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | log_printf(FUNC,Reservation_station,FUNCTION,"End"); |
---|
116 | }; |
---|
117 | |
---|
118 | }; // end namespace reservation_station |
---|
119 | }; // end namespace read_unit |
---|
120 | }; // end namespace multi_read_unit |
---|
121 | }; // end namespace execute_loop |
---|
122 | }; // end namespace multi_execute_loop |
---|
123 | }; // end namespace core |
---|
124 | |
---|
125 | }; // end namespace behavioural |
---|
126 | }; // end namespace morpheo |
---|
127 | #endif |
---|
128 | //#endif |
---|