1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/include/Load_Store_pointer_unit.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_ooo_engine { |
---|
15 | namespace ooo_engine { |
---|
16 | namespace rename_unit { |
---|
17 | namespace load_store_pointer_unit { |
---|
18 | |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Load_Store_pointer_unit::genMealy_insert" |
---|
22 | void Load_Store_pointer_unit::genMealy_insert (void) |
---|
23 | { |
---|
24 | log_printf(FUNC,Load_Store_pointer_unit,FUNCTION,"Begin"); |
---|
25 | |
---|
26 | bool use_lsq [_param->_nb_load_store_queue]; |
---|
27 | for (uint32_t i=0; i<_param->_nb_load_store_queue; i++) |
---|
28 | use_lsq [i] = false; |
---|
29 | |
---|
30 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
31 | { |
---|
32 | Tcontrol_t ack = false; |
---|
33 | Tlsq_ptr_t store_queue_ptr_write = 0; |
---|
34 | Tlsq_ptr_t load_queue_ptr_write = 0; |
---|
35 | |
---|
36 | if ( (PORT_READ(in_INSERT_VAL [i]) == true ) and |
---|
37 | (PORT_READ(in_INSERT_TYPE [i]) == TYPE_MEMORY)) |
---|
38 | { |
---|
39 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_INSERT_FRONT_END_ID [i]):0; |
---|
40 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_INSERT_CONTEXT_ID [i]):0; |
---|
41 | |
---|
42 | uint32_t lsq = _param->_link_load_store_unit_with_thread[front_end_id][context_id]; |
---|
43 | |
---|
44 | // Test if a previous instruction use the same lsq |
---|
45 | // Authorize once memory access by load store unit |
---|
46 | if (use_lsq [lsq] == false) |
---|
47 | { |
---|
48 | use_lsq [lsq] = true; |
---|
49 | |
---|
50 | uint32_t ptr; |
---|
51 | |
---|
52 | store_queue_ptr_write = reg_STORE_QUEUE_PTR_WRITE [lsq]; |
---|
53 | load_queue_ptr_write = reg_LOAD_QUEUE_PTR_WRITE [lsq]; |
---|
54 | |
---|
55 | // operation became of decod_stage. Also operation is != store_head_ok and store_head_ko |
---|
56 | if (is_operation_memory_store(PORT_READ(in_INSERT_OPERATION [i]))) |
---|
57 | { |
---|
58 | internal_INSERT_OPERATION_USE [i] = OPERATION_USE_STORE_QUEUE; |
---|
59 | |
---|
60 | ptr = reg_STORE_QUEUE_PTR_WRITE [lsq]; |
---|
61 | |
---|
62 | ack = not reg_STORE_QUEUE_USE [lsq][ptr] and (static_cast<uint32_t>(reg_STORE_QUEUE_NB_USE [lsq]+1) < _param->_size_store_queue[lsq]); |
---|
63 | } |
---|
64 | else |
---|
65 | { |
---|
66 | internal_INSERT_OPERATION_USE [i] = OPERATION_USE_LOAD_QUEUE; |
---|
67 | |
---|
68 | ptr = reg_LOAD_QUEUE_PTR_WRITE [lsq]; |
---|
69 | |
---|
70 | ack = (not reg_LOAD_QUEUE_USE [lsq][ptr]); |
---|
71 | } |
---|
72 | |
---|
73 | internal_INSERT_LSQ [i] = lsq; |
---|
74 | internal_INSERT_PTR [i] = ptr; |
---|
75 | } |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | ack = true; |
---|
80 | |
---|
81 | internal_INSERT_OPERATION_USE [i] = OPERATION_USE_NONE; |
---|
82 | } |
---|
83 | |
---|
84 | // Write output |
---|
85 | internal_INSERT_ACK [i] = ack; |
---|
86 | PORT_WRITE(out_INSERT_ACK [i], ack); |
---|
87 | PORT_WRITE(out_INSERT_STORE_QUEUE_PTR_WRITE [i], store_queue_ptr_write); |
---|
88 | if (_param->_have_port_load_queue_ptr) |
---|
89 | PORT_WRITE(out_INSERT_LOAD_QUEUE_PTR_WRITE [i], load_queue_ptr_write ); |
---|
90 | } |
---|
91 | |
---|
92 | log_printf(FUNC,Load_Store_pointer_unit,FUNCTION,"End"); |
---|
93 | }; |
---|
94 | |
---|
95 | }; // end namespace load_store_pointer_unit |
---|
96 | }; // end namespace rename_unit |
---|
97 | }; // end namespace ooo_engine |
---|
98 | }; // end namespace multi_ooo_engine |
---|
99 | }; // end namespace core |
---|
100 | |
---|
101 | }; // end namespace behavioural |
---|
102 | }; // end namespace morpheo |
---|
103 | #endif |
---|