1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Return_Address_Stack_genMealy_decod.cpp 100 2009-01-08 13:06:27Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.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 return_address_stack { |
---|
18 | |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Return_Address_Stack::genMealy_decod" |
---|
22 | void Return_Address_Stack::genMealy_decod (void) |
---|
23 | { |
---|
24 | log_begin(Return_Address_Stack,FUNCTION); |
---|
25 | log_function(Return_Address_Stack,FUNCTION,_name.c_str()); |
---|
26 | |
---|
27 | #ifdef DEBUG_TEST |
---|
28 | // just to test if have many transaction on a same context |
---|
29 | bool context_valid [_param->_nb_context]; |
---|
30 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
31 | context_valid [i] = true; |
---|
32 | #endif |
---|
33 | |
---|
34 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
35 | { |
---|
36 | // Read context number |
---|
37 | Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0; |
---|
38 | |
---|
39 | #ifdef DEBUG_TEST |
---|
40 | if (PORT_READ(in_DECOD_VAL [i])) |
---|
41 | { |
---|
42 | if (context_valid[context] == false) |
---|
43 | ERRORMORPHEO(FUNCTION,"Can't have 2 transactions with the same context_id"); |
---|
44 | context_valid[context] = false; |
---|
45 | } |
---|
46 | #endif |
---|
47 | |
---|
48 | Tptr_t top = reg_TOP[context]; |
---|
49 | Tcontrol_t push = PORT_READ(in_DECOD_PUSH [i]); |
---|
50 | |
---|
51 | // if push : value is hit |
---|
52 | // if pop : val and not miss |
---|
53 | // when the predictor : if hit = 0, wait (is not accurate) |
---|
54 | internal_DECOD_HIT [i] = (push or (reg_NB_ELT[context]>0)); |
---|
55 | PORT_WRITE(out_DECOD_HIT [i], internal_DECOD_HIT [i]); |
---|
56 | |
---|
57 | // if pop : address_pop = stack [top] |
---|
58 | // if push : stock [top+1] = address_push; also stock [top+1] is erase ! give the old value at the update table |
---|
59 | if (push) |
---|
60 | top = (top+1)%_param->_size_queue[context]; |
---|
61 | |
---|
62 | PORT_WRITE(out_DECOD_ADDRESS_POP [i], reg_stack[context][top]._address); |
---|
63 | PORT_WRITE(out_DECOD_INDEX [i], top); |
---|
64 | } |
---|
65 | |
---|
66 | log_end(Return_Address_Stack,FUNCTION); |
---|
67 | }; |
---|
68 | |
---|
69 | }; // end namespace return_address_stack |
---|
70 | }; // end namespace prediction_unit |
---|
71 | }; // end namespace front_end |
---|
72 | }; // end namespace multi_front_end |
---|
73 | }; // end namespace core |
---|
74 | }; // end namespace behavioural |
---|
75 | }; // end namespace morpheo |
---|
76 | #endif |
---|