1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Load_Store_pointer_unit_genMealy_retire.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
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_retire" |
---|
22 | void Load_Store_pointer_unit::genMealy_retire (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_retire; i++) |
---|
31 | { |
---|
32 | Tcontrol_t ack = false; |
---|
33 | Tcontrol_t use_sq = PORT_READ(in_RETIRE_USE_STORE_QUEUE [i]); |
---|
34 | Tcontrol_t use_lq = PORT_READ(in_RETIRE_USE_LOAD_QUEUE [i]); |
---|
35 | if ( (PORT_READ(in_RETIRE_VAL [i]) == true) and (use_sq or use_lq)) |
---|
36 | // (PORT_READ(in_RETIRE_TYPE [i]) == TYPE_MEMORY)) |
---|
37 | { |
---|
38 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RETIRE_FRONT_END_ID [i]):0; |
---|
39 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RETIRE_CONTEXT_ID [i]):0; |
---|
40 | uint32_t lsq = _param->_link_load_store_unit_with_thread[front_end_id][context_id]; |
---|
41 | |
---|
42 | // Test if a previous instruction use the same lsq |
---|
43 | // Authorize once memory access by load store unit |
---|
44 | if (use_lsq [lsq] == false) |
---|
45 | { |
---|
46 | use_lsq [lsq] = true; |
---|
47 | ack = true; |
---|
48 | |
---|
49 | uint32_t ptr; |
---|
50 | |
---|
51 | // operation became of decod_stage. Also operation is != store_head_ok and store_head_ko |
---|
52 | // if (is_operation_memory_store(PORT_READ(in_RETIRE_OPERATION [i]))) |
---|
53 | if (use_sq) |
---|
54 | { |
---|
55 | internal_RETIRE_OPERATION_USE [i] = OPERATION_USE_STORE_QUEUE; |
---|
56 | |
---|
57 | ptr = PORT_READ(in_RETIRE_STORE_QUEUE_PTR_WRITE [i]); |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | internal_RETIRE_OPERATION_USE [i] = OPERATION_USE_LOAD_QUEUE; |
---|
62 | |
---|
63 | ptr = (_param->_have_port_load_queue_ptr)?PORT_READ(in_RETIRE_LOAD_QUEUE_PTR_WRITE [i]):0; |
---|
64 | } |
---|
65 | |
---|
66 | internal_RETIRE_LSQ [i] = lsq; |
---|
67 | internal_RETIRE_PTR [i] = ptr; |
---|
68 | } |
---|
69 | } |
---|
70 | else |
---|
71 | { |
---|
72 | ack = true; |
---|
73 | |
---|
74 | internal_RETIRE_OPERATION_USE [i] = OPERATION_USE_NONE; |
---|
75 | } |
---|
76 | |
---|
77 | // Write output |
---|
78 | internal_RETIRE_ACK [i] = ack; |
---|
79 | PORT_WRITE(out_RETIRE_ACK [i], ack); |
---|
80 | } |
---|
81 | |
---|
82 | log_printf(FUNC,Load_Store_pointer_unit,FUNCTION,"End"); |
---|
83 | }; |
---|
84 | |
---|
85 | }; // end namespace load_store_pointer_unit |
---|
86 | }; // end namespace rename_unit |
---|
87 | }; // end namespace ooo_engine |
---|
88 | }; // end namespace multi_ooo_engine |
---|
89 | }; // end namespace core |
---|
90 | |
---|
91 | }; // end namespace behavioural |
---|
92 | }; // end namespace morpheo |
---|
93 | #endif |
---|