1 | #ifndef morpheo_behavioural_core_icache_access_Icache_Access_h |
---|
2 | #define morpheo_behavioural_core_icache_access_Icache_Access_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Icache_Access.h 88 2008-12-10 18:31:39Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | * TODO : |
---|
10 | * To implement icache special instruction (prefetch, invalidate, lock), add port here |
---|
11 | */ |
---|
12 | |
---|
13 | #ifdef SYSTEMC |
---|
14 | #include "systemc.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | |
---|
18 | #include "Behavioural/Core/Icache_Access/include/Parameters.h" |
---|
19 | #include "Behavioural/Core/Icache_Access/include/Types.h" |
---|
20 | #ifdef STATISTICS |
---|
21 | #include "Behavioural/include/Stat.h" |
---|
22 | #endif |
---|
23 | #include "Behavioural/include/Component.h" |
---|
24 | #ifdef VHDL |
---|
25 | #include "Behavioural/include/Vhdl.h" |
---|
26 | #endif |
---|
27 | #include "Behavioural/include/Usage.h" |
---|
28 | |
---|
29 | #include "Common/include/ToString.h" |
---|
30 | #include "Common/include/Debug.h" |
---|
31 | |
---|
32 | #include "Behavioural/Generic/Priority/include/Priority.h" |
---|
33 | |
---|
34 | #include <iostream> |
---|
35 | |
---|
36 | namespace morpheo { |
---|
37 | namespace behavioural { |
---|
38 | namespace core { |
---|
39 | namespace icache_access { |
---|
40 | |
---|
41 | class Icache_Access |
---|
42 | #if SYSTEMC |
---|
43 | : public sc_module |
---|
44 | #endif |
---|
45 | { |
---|
46 | // -----[ fields ]---------------------------------------------------- |
---|
47 | // Parameters |
---|
48 | protected : const std::string _name; |
---|
49 | protected : const Parameters * _param; |
---|
50 | private : const Tusage_t _usage; |
---|
51 | |
---|
52 | #ifdef STATISTICS |
---|
53 | public : Stat * _stat; |
---|
54 | |
---|
55 | private : counter_t ** _stat_nb_access; |
---|
56 | private : counter_t ** _stat_nb_access_conflit; |
---|
57 | #endif |
---|
58 | |
---|
59 | public : Component * _component; |
---|
60 | private : Interfaces * _interfaces; |
---|
61 | |
---|
62 | #ifdef SYSTEMC |
---|
63 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
64 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
65 | public : SC_CLOCK * in_CLOCK ; |
---|
66 | public : SC_IN (Tcontrol_t) * in_NRESET; |
---|
67 | |
---|
68 | // ~~~~~[ Interface "icache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
69 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_REQ_VAL ;//[nb_icache_port] |
---|
70 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_REQ_ACK ;//[nb_icache_port] |
---|
71 | public : SC_OUT(Tcontext_t ) ** out_ICACHE_REQ_THREAD_ID ;//[nb_icache_port] |
---|
72 | public : SC_OUT(Tpacket_t ) ** out_ICACHE_REQ_PACKET_ID ;//[nb_icache_port] |
---|
73 | public : SC_OUT(Ticache_address_t ) ** out_ICACHE_REQ_ADDRESS ;//[nb_icache_port] |
---|
74 | public : SC_OUT(Ticache_type_t ) ** out_ICACHE_REQ_TYPE ;//[nb_icache_port] |
---|
75 | |
---|
76 | // ~~~~~[ Interface "icache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
77 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_RSP_VAL ;//[nb_icache_port] |
---|
78 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_RSP_ACK ;//[nb_icache_port] |
---|
79 | public : SC_IN (Tcontext_t ) ** in_ICACHE_RSP_THREAD_ID ;//[nb_icache_port] |
---|
80 | public : SC_IN (Tpacket_t ) ** in_ICACHE_RSP_PACKET_ID ;//[nb_icache_port] |
---|
81 | public : SC_IN (Ticache_instruction_t) *** in_ICACHE_RSP_INSTRUCTION ;//[nb_icache_port][icache_nb_instruction] |
---|
82 | public : SC_IN (Ticache_error_t ) ** in_ICACHE_RSP_ERROR ;//[nb_icache_port] |
---|
83 | |
---|
84 | // ~~~~~[ Interface "context_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
85 | public : SC_IN (Tcontrol_t ) *** in_CONTEXT_REQ_VAL ;//[nb_front_end][nb_context] |
---|
86 | public : SC_OUT(Tcontrol_t ) *** out_CONTEXT_REQ_ACK ;//[nb_front_end][nb_context] |
---|
87 | //public : SC_IN (Tcontext_t ) *** in_CONTEXT_REQ_THREAD_ID ;//[nb_front_end][nb_context] |
---|
88 | public : SC_IN (Tpacket_t ) *** in_CONTEXT_REQ_PACKET_ID ;//[nb_front_end][nb_context] |
---|
89 | public : SC_IN (Ticache_address_t ) *** in_CONTEXT_REQ_ADDRESS ;//[nb_front_end][nb_context] |
---|
90 | public : SC_IN (Ticache_type_t ) *** in_CONTEXT_REQ_TYPE ;//[nb_front_end][nb_context] |
---|
91 | |
---|
92 | // ~~~~~[ Interface "context_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
93 | public : SC_OUT(Tcontrol_t ) *** out_CONTEXT_RSP_VAL ;//[nb_front_end][nb_context] |
---|
94 | public : SC_IN (Tcontrol_t ) *** in_CONTEXT_RSP_ACK ;//[nb_front_end][nb_context] |
---|
95 | //public : SC_OUT(Tcontext_t ) *** out_CONTEXT_RSP_THREAD_ID ;//[nb_front_end][nb_context] |
---|
96 | public : SC_OUT(Tpacket_t ) *** out_CONTEXT_RSP_PACKET_ID ;//[nb_front_end][nb_context] |
---|
97 | public : SC_OUT(Ticache_instruction_t) **** out_CONTEXT_RSP_INSTRUCTION;//[nb_front_end][nb_context][nb_instruction] |
---|
98 | public : SC_OUT(Ticache_error_t ) *** out_CONTEXT_RSP_ERROR ;//[nb_front_end][nb_context] |
---|
99 | |
---|
100 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
101 | private : generic::priority::Priority * _priority; |
---|
102 | |
---|
103 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
104 | |
---|
105 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
106 | |
---|
107 | #ifdef STATISTICS |
---|
108 | private : uint32_t * _internal_ICACHE_REQ_NB_ACCESS ; //[nb_icache_port] |
---|
109 | private : uint32_t * _internal_ICACHE_REQ_NB_ACCESS_CONFLIT; //[nb_icache_port] |
---|
110 | #endif |
---|
111 | |
---|
112 | #endif |
---|
113 | |
---|
114 | // -----[ Methods ]--------------------------------------------------- |
---|
115 | |
---|
116 | #ifdef SYSTEMC |
---|
117 | SC_HAS_PROCESS (Icache_Access); |
---|
118 | #endif |
---|
119 | public : Icache_Access |
---|
120 | ( |
---|
121 | #ifdef SYSTEMC |
---|
122 | sc_module_name name, |
---|
123 | #else |
---|
124 | std::string name, |
---|
125 | #endif |
---|
126 | #ifdef STATISTICS |
---|
127 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
128 | #endif |
---|
129 | Parameters * param, |
---|
130 | morpheo::behavioural::Tusage_t usage |
---|
131 | ); |
---|
132 | public : ~Icache_Access (void); |
---|
133 | |
---|
134 | private : void allocation ( |
---|
135 | #ifdef STATISTICS |
---|
136 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
137 | #else |
---|
138 | void |
---|
139 | #endif |
---|
140 | ); |
---|
141 | private : void deallocation (void); |
---|
142 | |
---|
143 | #ifdef SYSTEMC |
---|
144 | public : void transition (void); |
---|
145 | //public : void genMoore (void); |
---|
146 | public : void genMealy_req (void); |
---|
147 | public : void genMealy_rsp (void); |
---|
148 | #endif |
---|
149 | |
---|
150 | #if VHDL |
---|
151 | public : void vhdl (void); |
---|
152 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
153 | private : void vhdl_body (Vhdl * & vhdl); |
---|
154 | #endif |
---|
155 | |
---|
156 | #ifdef STATISTICS |
---|
157 | public : void statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
158 | public : void statistics_deallocation (void); |
---|
159 | #endif |
---|
160 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
161 | private : void end_cycle (void); |
---|
162 | #endif |
---|
163 | }; |
---|
164 | |
---|
165 | }; // end namespace icache_access |
---|
166 | }; // end namespace core |
---|
167 | |
---|
168 | }; // end namespace behavioural |
---|
169 | }; // end namespace morpheo |
---|
170 | |
---|
171 | #endif |
---|