[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Front_end_Glue_genMealy_event.cpp 119 2009-05-25 17:40:26Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Front_end_Glue/include/Front_end_Glue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace front_end_glue { |
---|
| 17 | |
---|
| 18 | #undef FUNCTION |
---|
| 19 | #define FUNCTION "Front_end_Glue::genMealy_event" |
---|
| 20 | void Front_end_Glue::genMealy_event (void) |
---|
| 21 | { |
---|
| 22 | log_begin(Front_end_Glue,FUNCTION); |
---|
| 23 | log_function(Front_end_Glue,FUNCTION,_name.c_str()); |
---|
| 24 | |
---|
| 25 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
| 26 | { |
---|
[97] | 27 | Taddress_t address = PORT_READ(in_EVENT_CONTEXT_STATE_ADDRESS [i]); |
---|
[88] | 28 | PORT_WRITE(out_EVENT_ADDRESS [i],address); |
---|
| 29 | PORT_WRITE(out_EVENT_IFETCH_UNIT_ADDRESS [i],address); |
---|
| 30 | |
---|
[97] | 31 | Taddress_t address_next = PORT_READ(in_EVENT_CONTEXT_STATE_ADDRESS_NEXT [i]); |
---|
[88] | 32 | PORT_WRITE(out_EVENT_ADDRESS_NEXT [i],address_next); |
---|
| 33 | PORT_WRITE(out_EVENT_IFETCH_UNIT_ADDRESS_NEXT [i],address_next); |
---|
| 34 | |
---|
[97] | 35 | Tcontrol_t address_next_val = PORT_READ(in_EVENT_CONTEXT_STATE_ADDRESS_NEXT_VAL [i]); |
---|
[88] | 36 | PORT_WRITE(out_EVENT_ADDRESS_NEXT_VAL [i],address_next_val); |
---|
| 37 | PORT_WRITE(out_EVENT_IFETCH_UNIT_ADDRESS_NEXT_VAL [i],address_next_val); |
---|
| 38 | |
---|
[97] | 39 | Tcontrol_t is_ds_take = PORT_READ(in_EVENT_CONTEXT_STATE_IS_DS_TAKE [i]); |
---|
[88] | 40 | PORT_WRITE(out_EVENT_IS_DS_TAKE [i],is_ds_take); |
---|
| 41 | PORT_WRITE(out_EVENT_IFETCH_UNIT_IS_DS_TAKE [i],is_ds_take); |
---|
| 42 | |
---|
[97] | 43 | Tevent_type_t event_type = PORT_READ(in_EVENT_CONTEXT_STATE_TYPE [i]); |
---|
| 44 | PORT_WRITE(out_EVENT_PREDICTION_UNIT_TYPE [i],event_type); |
---|
| 45 | |
---|
| 46 | if (_param->_have_port_depth) |
---|
| 47 | { |
---|
| 48 | Tdepth_t depth = PORT_READ(in_EVENT_CONTEXT_STATE_DEPTH [i]); |
---|
| 49 | PORT_WRITE(out_EVENT_PREDICTION_UNIT_DEPTH [i],depth); |
---|
| 50 | } |
---|
[119] | 51 | Tcontrol_t flush_only = PORT_READ(in_EVENT_CONTEXT_STATE_FLUSH_ONLY [i]); |
---|
[97] | 52 | |
---|
[88] | 53 | |
---|
[97] | 54 | Tcontrol_t ack = PORT_READ(in_EVENT_ACK [i]); |
---|
| 55 | Tcontrol_t ifetch_unit_ack = PORT_READ(in_EVENT_IFETCH_UNIT_ACK [i]); |
---|
| 56 | Tcontrol_t prediction_unit_ack = PORT_READ(in_EVENT_PREDICTION_UNIT_ACK [i]); |
---|
| 57 | Tcontrol_t context_state_val = PORT_READ(in_EVENT_CONTEXT_STATE_VAL [i]); |
---|
[88] | 58 | |
---|
[119] | 59 | Tcontrol_t val = ( not flush_only and |
---|
| 60 | //ack and |
---|
[97] | 61 | ifetch_unit_ack and |
---|
| 62 | prediction_unit_ack and |
---|
[119] | 63 | context_state_val |
---|
| 64 | |
---|
[97] | 65 | ); |
---|
[119] | 66 | // Tcontrol_t ifetch_unit_val = ( ack and |
---|
| 67 | // //ifetch_unit_ack and |
---|
| 68 | // prediction_unit_ack and |
---|
| 69 | // context_state_val |
---|
| 70 | // ); |
---|
| 71 | Tcontrol_t ifetch_unit_val = ( ( |
---|
| 72 | flush_only or |
---|
| 73 | ack ) and |
---|
[97] | 74 | //ifetch_unit_ack and |
---|
| 75 | prediction_unit_ack and |
---|
[119] | 76 | context_state_val |
---|
[97] | 77 | ); |
---|
[119] | 78 | |
---|
| 79 | // Tcontrol_t prediction_unit_val = ( ack and |
---|
| 80 | // ifetch_unit_ack and |
---|
| 81 | // //prediction_unit_ack and |
---|
| 82 | // context_state_val |
---|
| 83 | // ); |
---|
| 84 | |
---|
| 85 | Tcontrol_t prediction_unit_val = ( ( |
---|
| 86 | flush_only or |
---|
| 87 | ack ) and |
---|
[97] | 88 | ifetch_unit_ack and |
---|
| 89 | //prediction_unit_ack and |
---|
[119] | 90 | context_state_val |
---|
[97] | 91 | ); |
---|
[119] | 92 | |
---|
| 93 | |
---|
[97] | 94 | Tcontrol_t context_state_ack = ( ack and |
---|
| 95 | ifetch_unit_ack and |
---|
| 96 | prediction_unit_ack // and |
---|
| 97 | //context_state_val |
---|
| 98 | ); |
---|
| 99 | |
---|
| 100 | log_printf(TRACE,Front_end_Glue,FUNCTION," * val %d, ack %d",val ,ack ); |
---|
| 101 | log_printf(TRACE,Front_end_Glue,FUNCTION," * ifetch_unit_val %d, ifetch_unit_ack %d",ifetch_unit_val ,ifetch_unit_ack ); |
---|
| 102 | log_printf(TRACE,Front_end_Glue,FUNCTION," * prediction_unit_val %d, prediction_unit_ack %d",prediction_unit_val,prediction_unit_ack); |
---|
| 103 | log_printf(TRACE,Front_end_Glue,FUNCTION," * context_state_val %d, context_state_ack %d",context_state_val ,context_state_ack ); |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | PORT_WRITE(out_EVENT_VAL [i], val ); |
---|
| 107 | PORT_WRITE(out_EVENT_IFETCH_UNIT_VAL [i], ifetch_unit_val ); |
---|
| 108 | PORT_WRITE(out_EVENT_PREDICTION_UNIT_VAL [i], prediction_unit_val); |
---|
| 109 | PORT_WRITE(out_EVENT_CONTEXT_STATE_ACK [i], context_state_ack ); |
---|
| 110 | |
---|
[88] | 111 | #ifdef DEBUG |
---|
| 112 | log_printf(TRACE,Front_end_Glue,FUNCTION," * EVENT Context [%d]",i); |
---|
| 113 | if (val and ack) |
---|
| 114 | { |
---|
| 115 | log_printf(TRACE,Front_end_Glue,FUNCTION," * have event"); |
---|
| 116 | log_printf(TRACE,Front_end_Glue,FUNCTION," * address : %.8x (%.8x)",address ,address <<2); |
---|
| 117 | log_printf(TRACE,Front_end_Glue,FUNCTION," * address_next : %.8x (%.8x)",address_next,address_next<<2); |
---|
| 118 | log_printf(TRACE,Front_end_Glue,FUNCTION," * address_next_val : %d",address_next_val); |
---|
| 119 | log_printf(TRACE,Front_end_Glue,FUNCTION," * is_ds_take : %d",is_ds_take ); |
---|
[119] | 120 | log_printf(TRACE,Front_end_Glue,FUNCTION," * flush_only : %d",flush_only ); |
---|
[88] | 121 | } |
---|
| 122 | else |
---|
| 123 | log_printf(TRACE,Front_end_Glue,FUNCTION," * have not event"); |
---|
| 124 | #endif |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | log_end(Front_end_Glue,FUNCTION); |
---|
| 128 | }; |
---|
| 129 | |
---|
| 130 | }; // end namespace front_end_glue |
---|
| 131 | }; // end namespace front_end |
---|
| 132 | }; // end namespace multi_front_end |
---|
| 133 | }; // end namespace core |
---|
| 134 | |
---|
| 135 | }; // end namespace behavioural |
---|
| 136 | }; // end namespace morpheo |
---|
| 137 | #endif |
---|