1 | #ifdef SYSTEMC |
---|
2 | //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
3 | /* |
---|
4 | * $Id: Reservation_station_genMoore.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
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_begin(Reservation_station,FUNCTION); |
---|
27 | log_function(Reservation_station,FUNCTION,_name.c_str()); |
---|
28 | |
---|
29 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
30 | |
---|
31 | // accept a new instructions when reservation_station is not full |
---|
32 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
33 | for (internal_INSERT_SLOT=0; (internal_INSERT_SLOT<_param->_size_queue) and (_queue_valid[internal_INSERT_SLOT]==true); internal_INSERT_SLOT++); |
---|
34 | internal_INSERT_ACK = (internal_INSERT_SLOT<_param->_size_queue); |
---|
35 | #else |
---|
36 | internal_INSERT_ACK = not _queue_control->full(); |
---|
37 | #endif |
---|
38 | PORT_WRITE(out_INSERT_ACK, internal_INSERT_ACK); |
---|
39 | |
---|
40 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
41 | |
---|
42 | uint32_t index_queue=0; |
---|
43 | const uint32_t nb_slot_scan = _param->_size_queue-_param->_nb_inst_retire+1; |
---|
44 | |
---|
45 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
46 | { |
---|
47 | bool val = false; |
---|
48 | uint32_t index_find = 0;; |
---|
49 | |
---|
50 | for (; ( |
---|
51 | #ifndef SYSTEMC_VHDL_COMPATIBILITY |
---|
52 | (index_queue<_queue_control->nb_elt()) and |
---|
53 | #endif |
---|
54 | (index_queue>=i) and |
---|
55 | (index_queue<nb_slot_scan+i) and |
---|
56 | (val==false)); |
---|
57 | index_queue++) |
---|
58 | { |
---|
59 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
60 | index_find = index_queue; |
---|
61 | #else |
---|
62 | index_find = (*_queue_control)[index_queue]; |
---|
63 | #endif |
---|
64 | internal_RETIRE_SLOT [i] = index_queue; |
---|
65 | |
---|
66 | val = |
---|
67 | ( |
---|
68 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
69 | _queue_valid [index_queue] and |
---|
70 | #endif |
---|
71 | _queue[index_find]._data_ra_val and |
---|
72 | _queue[index_find]._data_rb_val and |
---|
73 | _queue[index_find]._data_rc_val |
---|
74 | ); |
---|
75 | |
---|
76 | // cout << "========== Moore : " << endl |
---|
77 | // << " * i : " << i << endl |
---|
78 | // << " * val : " << val << endl |
---|
79 | // << " * index_queue : " << index_queue << endl |
---|
80 | // << " * index_find : " << index_find << endl; |
---|
81 | } |
---|
82 | |
---|
83 | internal_RETIRE_VAL [i] = val; |
---|
84 | PORT_WRITE(out_RETIRE_VAL [i], val); |
---|
85 | |
---|
86 | if (val) |
---|
87 | { |
---|
88 | |
---|
89 | // #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
90 | // index_find = internal_RETIRE_SLOT [i]; |
---|
91 | // #else |
---|
92 | // index_find = (*_queue_control)[internal_RETIRE_SLOT [i]]; |
---|
93 | // #endif |
---|
94 | if (_param->_have_port_context_id) |
---|
95 | PORT_WRITE(out_RETIRE_CONTEXT_ID [i],_queue[index_find]._context_id); |
---|
96 | if (_param->_have_port_front_end_id) |
---|
97 | PORT_WRITE(out_RETIRE_FRONT_END_ID [i],_queue[index_find]._front_end_id); |
---|
98 | if (_param->_have_port_ooo_engine_id) |
---|
99 | PORT_WRITE(out_RETIRE_OOO_ENGINE_ID [i],_queue[index_find]._ooo_engine_id); |
---|
100 | if (_param->_have_port_rob_ptr) |
---|
101 | PORT_WRITE(out_RETIRE_ROB_ID [i],_queue[index_find]._rob_id); |
---|
102 | PORT_WRITE(out_RETIRE_OPERATION [i],_queue[index_find]._operation); |
---|
103 | PORT_WRITE(out_RETIRE_TYPE [i],_queue[index_find]._type); |
---|
104 | PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_WRITE [i],_queue[index_find]._store_queue_ptr_write); |
---|
105 | if (_param->_have_port_load_queue_ptr) |
---|
106 | PORT_WRITE(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i],_queue[index_find]._load_queue_ptr_write ); |
---|
107 | PORT_WRITE(out_RETIRE_HAS_IMMEDIAT [i],_queue[index_find]._has_immediat); |
---|
108 | PORT_WRITE(out_RETIRE_IMMEDIAT [i],_queue[index_find]._immediat); |
---|
109 | PORT_WRITE(out_RETIRE_DATA_RA [i],_queue[index_find]._data_ra); |
---|
110 | PORT_WRITE(out_RETIRE_DATA_RB [i],_queue[index_find]._data_rb); |
---|
111 | PORT_WRITE(out_RETIRE_DATA_RC [i],_queue[index_find]._data_rc); |
---|
112 | PORT_WRITE(out_RETIRE_WRITE_RD [i],_queue[index_find]._write_rd); |
---|
113 | PORT_WRITE(out_RETIRE_NUM_REG_RD [i],_queue[index_find]._num_reg_rd); |
---|
114 | PORT_WRITE(out_RETIRE_WRITE_RE [i],_queue[index_find]._write_re); |
---|
115 | PORT_WRITE(out_RETIRE_NUM_REG_RE [i],_queue[index_find]._num_reg_re); |
---|
116 | } |
---|
117 | } |
---|
118 | |
---|
119 | log_end(Reservation_station,FUNCTION); |
---|
120 | }; |
---|
121 | |
---|
122 | }; // end namespace reservation_station |
---|
123 | }; // end namespace read_unit |
---|
124 | }; // end namespace multi_read_unit |
---|
125 | }; // end namespace execute_loop |
---|
126 | }; // end namespace multi_execute_loop |
---|
127 | }; // end namespace core |
---|
128 | |
---|
129 | }; // end namespace behavioural |
---|
130 | }; // end namespace morpheo |
---|
131 | #endif |
---|
132 | //#endif |
---|