1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_front_end { |
---|
15 | namespace front_end { |
---|
16 | namespace prediction_unit { |
---|
17 | namespace update_prediction_table { |
---|
18 | |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Update_Prediction_Table::genMealy_decod" |
---|
22 | void Update_Prediction_Table::genMealy_decod (void) |
---|
23 | { |
---|
24 | log_begin(Update_Prediction_Table,FUNCTION); |
---|
25 | log_function(Update_Prediction_Table,FUNCTION,_name.c_str()); |
---|
26 | |
---|
27 | // WARNING : One branch per context per cycle |
---|
28 | if (PORT_READ(in_NRESET) != 0) |
---|
29 | { |
---|
30 | // for each decod instruction |
---|
31 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
32 | { |
---|
33 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * DECOD [%d]",i); |
---|
34 | |
---|
35 | // Read information |
---|
36 | Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0; |
---|
37 | bool is_accurate = (_param->_always_accurate_decod or |
---|
38 | (_param->_can_accurate_decod and reg_IS_ACCURATE [context])); |
---|
39 | upt_event_state_t upt_event_state = reg_UPT_EVENT_STATE [context]; |
---|
40 | ufpt_event_state_t ufpt_event_state = reg_UFPT_EVENT_STATE [context]; |
---|
41 | uint32_t ptr_write = reg_UPT_TOP [context]; // One branch per context per cycle |
---|
42 | uint32_t ptr_write_next = (ptr_write+1)%_param->_size_upt_queue[context]; |
---|
43 | // Decod can continue until the next branch if next slot is empty, and no event |
---|
44 | Tcontrol_t can_continue = (reg_UPDATE_PREDICTION_TABLE [context][ptr_write_next]._state == UPDATE_PREDICTION_STATE_EMPTY); |
---|
45 | |
---|
46 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context); |
---|
47 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * is_accurate : %d",is_accurate); |
---|
48 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * ufpt_event_state : %s",toString(ufpt_event_state).c_str()); |
---|
49 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * upt_event_state : %s",toString(upt_event_state).c_str()); |
---|
50 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * ptr_write : %d - %d",ptr_write,ptr_write_next); |
---|
51 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * upt_state : %s",toString(reg_UPDATE_PREDICTION_TABLE [context][ptr_write]._state).c_str()); |
---|
52 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * can_continue : %d",can_continue); |
---|
53 | |
---|
54 | // can decod (ack) if : |
---|
55 | // * in all case (miss or hit), need empty slot |
---|
56 | // * not previous event (state = ok) |
---|
57 | // * is_accurate |
---|
58 | internal_DECOD_ACK [i] = ((reg_UPDATE_PREDICTION_TABLE [context][ptr_write]._state == UPDATE_PREDICTION_STATE_EMPTY) and |
---|
59 | (ufpt_event_state == UFPT_EVENT_STATE_OK) and |
---|
60 | (upt_event_state == UPT_EVENT_STATE_OK ) and |
---|
61 | is_accurate); |
---|
62 | internal_DECOD_UPT_PTR_WRITE [i] = ptr_write; |
---|
63 | |
---|
64 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * ack : %d",internal_DECOD_ACK [i]); |
---|
65 | |
---|
66 | PORT_WRITE(out_DECOD_ACK [i], internal_DECOD_ACK [i]); |
---|
67 | PORT_WRITE(out_DECOD_CAN_CONTINUE [i], can_continue); |
---|
68 | } |
---|
69 | } |
---|
70 | else |
---|
71 | { |
---|
72 | // RESET |
---|
73 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
74 | PORT_WRITE(out_DECOD_ACK [i], 0); |
---|
75 | } |
---|
76 | |
---|
77 | log_end(Update_Prediction_Table,FUNCTION); |
---|
78 | }; |
---|
79 | |
---|
80 | }; // end namespace update_prediction_table |
---|
81 | }; // end namespace prediction_unit |
---|
82 | }; // end namespace front_end |
---|
83 | }; // end namespace multi_front_end |
---|
84 | }; // end namespace core |
---|
85 | |
---|
86 | }; // end namespace behavioural |
---|
87 | }; // end namespace morpheo |
---|
88 | #endif |
---|