1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Decod_transition.cpp 87 2008-05-15 19:23:42Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/include/Decod.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_front_end { |
---|
15 | namespace front_end { |
---|
16 | namespace decod_unit { |
---|
17 | namespace decod { |
---|
18 | |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Decod::transition" |
---|
22 | void Decod::transition (void) |
---|
23 | { |
---|
24 | log_printf(FUNC,Decod,FUNCTION,"Begin"); |
---|
25 | |
---|
26 | if (PORT_READ(in_NRESET) == 0) |
---|
27 | { |
---|
28 | reg_CONTEXT_PRIORITY = 0; |
---|
29 | |
---|
30 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
31 | { |
---|
32 | reg_CONTEXT_ADDRESS_PREVIOUS [i] = 0xfc; // 0x100-4. (0x100 : reset address) |
---|
33 | reg_CONTEXT_IS_DELAY_SLOT [i] = 0; |
---|
34 | } |
---|
35 | } |
---|
36 | else |
---|
37 | { |
---|
38 | switch (_param->_priority) |
---|
39 | { |
---|
40 | // case PRIORITY_STATIC : |
---|
41 | // { |
---|
42 | // reg_CONTEXT_PRIORITY = (reg_CONTEXT_PRIORITY+_param->_nb_context_select)%_param->_nb_context; |
---|
43 | // break; |
---|
44 | // } |
---|
45 | case PRIORITY_ROUND_ROBIN : |
---|
46 | { |
---|
47 | reg_CONTEXT_PRIORITY = (reg_CONTEXT_PRIORITY+1 )%_param->_nb_context; |
---|
48 | break; |
---|
49 | } |
---|
50 | default: |
---|
51 | { |
---|
52 | break; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | // flush list |
---|
57 | select.clear(); |
---|
58 | |
---|
59 | // Compute next scan order !!! |
---|
60 | switch (_param->_load_balancing) |
---|
61 | { |
---|
62 | // case LOAD_BALANCING_BALANCE : |
---|
63 | // { |
---|
64 | // for (uint32_t j=0; j<_param->_max_nb_inst_fetch; j++) |
---|
65 | // for (uint32_t i=0; i<_param->_nb_context_select; i++) |
---|
66 | // { |
---|
67 | // uint32_t x=(reg_CONTEXT_PRIORITY+i)%_param->_nb_context; |
---|
68 | |
---|
69 | // // Test valid inst_fetch |
---|
70 | // if (j < _param->_nb_inst_fetch[x]) |
---|
71 | // select.push_back(select_t(x,j)); |
---|
72 | // } |
---|
73 | |
---|
74 | // break; |
---|
75 | // } |
---|
76 | case LOAD_BALANCING_MAXIMUM_FOR_PRIORITY : |
---|
77 | { |
---|
78 | |
---|
79 | for (uint32_t i=0; i<_param->_nb_context_select; i++) |
---|
80 | { |
---|
81 | uint32_t x=(reg_CONTEXT_PRIORITY+i)%_param->_nb_context; |
---|
82 | |
---|
83 | for (uint32_t j=0; j<_param->_nb_inst_fetch[x]; j++) |
---|
84 | select.push_back(select_t(x,j)); |
---|
85 | } |
---|
86 | |
---|
87 | break; |
---|
88 | } |
---|
89 | default : |
---|
90 | { |
---|
91 | break; |
---|
92 | } |
---|
93 | } |
---|
94 | |
---|
95 | // Compute "next previous" address |
---|
96 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
97 | if (internal_CONTEXT_HAVE_TRANSACTION[i]) |
---|
98 | { |
---|
99 | #ifdef STATISTICS |
---|
100 | (*_stat_sum_inst_decod) ++; |
---|
101 | #endif |
---|
102 | |
---|
103 | reg_CONTEXT_ADDRESS_PREVIOUS [i] = internal_CONTEXT_ADDRESS_PREVIOUS [i]; |
---|
104 | reg_CONTEXT_IS_DELAY_SLOT [i] = internal_CONTEXT_IS_DELAY_SLOT [i]; |
---|
105 | } |
---|
106 | |
---|
107 | // for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
108 | // log_printf(TRACE,Decod,FUNCTION,"[%d] %.8x %d",i,reg_CONTEXT_ADDRESS_PREVIOUS [i], reg_CONTEXT_IS_DELAY_SLOT [i]); |
---|
109 | } |
---|
110 | |
---|
111 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
112 | end_cycle (); |
---|
113 | #endif |
---|
114 | |
---|
115 | log_printf(FUNC,Decod,FUNCTION,"End"); |
---|
116 | }; |
---|
117 | |
---|
118 | }; // end namespace decod |
---|
119 | }; // end namespace decod_unit |
---|
120 | }; // end namespace front_end |
---|
121 | }; // end namespace multi_front_end |
---|
122 | }; // end namespace core |
---|
123 | |
---|
124 | }; // end namespace behavioural |
---|
125 | }; // end namespace morpheo |
---|
126 | #endif |
---|