1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: RegisterFile_allocation.cpp 131 2009-07-08 18:40:08Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace generic { |
---|
15 | namespace registerfile { |
---|
16 | |
---|
17 | void RegisterFile::allocation ( |
---|
18 | #ifdef STATISTICS |
---|
19 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
20 | #else |
---|
21 | void |
---|
22 | #endif |
---|
23 | ) |
---|
24 | { |
---|
25 | std::string rename; |
---|
26 | |
---|
27 | log_printf(FUNC,RegisterFile,"allocation","Begin"); |
---|
28 | |
---|
29 | #ifdef SYSTEMCASS_SPECIFIC |
---|
30 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
31 | { |
---|
32 | __ALLOC0_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK ); |
---|
33 | __ALLOC0_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t)); |
---|
34 | } |
---|
35 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
36 | { |
---|
37 | __ALLOC1_INTERFACE_BEGIN("READ",_param->_nb_port_read); |
---|
38 | |
---|
39 | __ALLOC1_SIGNAL_IN ( in_READ_VAL ,"VAL" ,Tcontrol_t); |
---|
40 | __ALLOC1_SIGNAL_OUT(out_READ_ACK ,"ACK" ,Tcontrol_t); |
---|
41 | if (_param->_have_port_address) |
---|
42 | __ALLOC1_SIGNAL_IN ( in_READ_ADDRESS,"ADDRESS",Taddress_t); |
---|
43 | __ALLOC1_SIGNAL_OUT(out_READ_DATA ,"DATA" ,Tdata_t ); |
---|
44 | |
---|
45 | __ALLOC1_INTERFACE_END(_param->_nb_port_read); |
---|
46 | } |
---|
47 | |
---|
48 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
49 | { |
---|
50 | __ALLOC1_INTERFACE_BEGIN("WRITE",_param->_nb_port_write); |
---|
51 | |
---|
52 | __ALLOC1_SIGNAL_IN ( in_WRITE_VAL ,"VAL" ,Tcontrol_t); |
---|
53 | __ALLOC1_SIGNAL_OUT(out_WRITE_ACK ,"ACK" ,Tcontrol_t); |
---|
54 | if (_param->_have_port_address) |
---|
55 | __ALLOC1_SIGNAL_IN ( in_WRITE_ADDRESS,"ADDRESS",Taddress_t); |
---|
56 | __ALLOC1_SIGNAL_IN ( in_WRITE_DATA ,"DATA" ,Tdata_t ); |
---|
57 | |
---|
58 | __ALLOC1_INTERFACE_END(_param->_nb_port_write); |
---|
59 | } |
---|
60 | #endif |
---|
61 | |
---|
62 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
63 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
64 | // =====[ component_RegisterFile_Monolithic ]========================= |
---|
65 | { |
---|
66 | component_RegisterFile_Monolithic = new morpheo::behavioural::generic::registerfile::registerfile_monolithic ::RegisterFile_Monolithic ::RegisterFile_Monolithic (_name.c_str() |
---|
67 | #ifdef STATISTICS |
---|
68 | ,param_statistics |
---|
69 | #endif |
---|
70 | ,_param->_param_registerfile_monolithic |
---|
71 | ,_usage); |
---|
72 | |
---|
73 | } |
---|
74 | else |
---|
75 | // =====[ component_RegisterFile_Multi_Banked ]======================= |
---|
76 | { |
---|
77 | component_RegisterFile_Multi_Banked = new morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked (_name.c_str() |
---|
78 | #ifdef STATISTICS |
---|
79 | ,param_statistics |
---|
80 | #endif |
---|
81 | ,_param->_param_registerfile_multi_banked |
---|
82 | ,_usage); |
---|
83 | |
---|
84 | } |
---|
85 | // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | |
---|
87 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
88 | // =====[ Component_RegisterFile_Monolithic - Instanciation ]========= |
---|
89 | { |
---|
90 | #ifdef SYSTEMCASS_SPECIFIC |
---|
91 | (*(component_RegisterFile_Monolithic ->in_CLOCK )) (*(in_CLOCK )); |
---|
92 | (*(component_RegisterFile_Monolithic ->in_NRESET)) (*(in_NRESET)); |
---|
93 | |
---|
94 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
95 | { |
---|
96 | (*(component_RegisterFile_Monolithic -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
97 | (*(component_RegisterFile_Monolithic ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
98 | if (_param->_have_port_address == true) |
---|
99 | (*(component_RegisterFile_Monolithic -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
100 | (*(component_RegisterFile_Monolithic ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
101 | } |
---|
102 | |
---|
103 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
104 | { |
---|
105 | (*(component_RegisterFile_Monolithic -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
106 | (*(component_RegisterFile_Monolithic ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
107 | if (_param->_have_port_address == true) |
---|
108 | (*(component_RegisterFile_Monolithic -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
109 | (*(component_RegisterFile_Monolithic -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
110 | } |
---|
111 | #else |
---|
112 | in_CLOCK = component_RegisterFile_Monolithic-> in_CLOCK ; |
---|
113 | in_NRESET = component_RegisterFile_Monolithic-> in_NRESET ; |
---|
114 | |
---|
115 | in_READ_VAL = component_RegisterFile_Monolithic-> in_READ_VAL ; |
---|
116 | out_READ_ACK = component_RegisterFile_Monolithic->out_READ_ACK ; |
---|
117 | in_READ_ADDRESS = component_RegisterFile_Monolithic-> in_READ_ADDRESS ; |
---|
118 | out_READ_DATA = component_RegisterFile_Monolithic->out_READ_DATA ; |
---|
119 | |
---|
120 | in_WRITE_VAL = component_RegisterFile_Monolithic-> in_WRITE_VAL ; |
---|
121 | out_WRITE_ACK = component_RegisterFile_Monolithic->out_WRITE_ACK ; |
---|
122 | in_WRITE_ADDRESS = component_RegisterFile_Monolithic-> in_WRITE_ADDRESS; |
---|
123 | in_WRITE_DATA = component_RegisterFile_Monolithic-> in_WRITE_DATA ; |
---|
124 | #endif |
---|
125 | } |
---|
126 | else |
---|
127 | // =====[ Component_RegisterFile_Multi_Banked - Instanciation ]======= |
---|
128 | { |
---|
129 | #ifdef SYSTEMCASS_SPECIFIC |
---|
130 | (*(component_RegisterFile_Multi_Banked->in_CLOCK )) (*(in_CLOCK )); |
---|
131 | (*(component_RegisterFile_Multi_Banked->in_NRESET)) (*(in_NRESET)); |
---|
132 | |
---|
133 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
134 | { |
---|
135 | (*(component_RegisterFile_Multi_Banked-> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
136 | (*(component_RegisterFile_Multi_Banked->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
137 | if (_param->_have_port_address == true) |
---|
138 | (*(component_RegisterFile_Multi_Banked-> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
139 | (*(component_RegisterFile_Multi_Banked->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
140 | } |
---|
141 | |
---|
142 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
143 | { |
---|
144 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
145 | (*(component_RegisterFile_Multi_Banked->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
146 | if (_param->_have_port_address == true) |
---|
147 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
148 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
149 | } |
---|
150 | #else |
---|
151 | in_CLOCK = component_RegisterFile_Multi_Banked-> in_CLOCK ; |
---|
152 | in_NRESET = component_RegisterFile_Multi_Banked-> in_NRESET ; |
---|
153 | |
---|
154 | in_READ_VAL = component_RegisterFile_Multi_Banked-> in_READ_VAL ; |
---|
155 | out_READ_ACK = component_RegisterFile_Multi_Banked->out_READ_ACK ; |
---|
156 | in_READ_ADDRESS = component_RegisterFile_Multi_Banked-> in_READ_ADDRESS ; |
---|
157 | out_READ_DATA = component_RegisterFile_Multi_Banked->out_READ_DATA ; |
---|
158 | |
---|
159 | in_WRITE_VAL = component_RegisterFile_Multi_Banked-> in_WRITE_VAL ; |
---|
160 | out_WRITE_ACK = component_RegisterFile_Multi_Banked->out_WRITE_ACK ; |
---|
161 | in_WRITE_ADDRESS = component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS; |
---|
162 | in_WRITE_DATA = component_RegisterFile_Multi_Banked-> in_WRITE_DATA ; |
---|
163 | #endif |
---|
164 | |
---|
165 | } |
---|
166 | |
---|
167 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
168 | _component = component_RegisterFile_Monolithic ->_component; |
---|
169 | else |
---|
170 | _component = component_RegisterFile_Multi_Banked->_component; |
---|
171 | |
---|
172 | log_printf(FUNC,RegisterFile,"allocation","End"); |
---|
173 | }; |
---|
174 | |
---|
175 | }; // end namespace registerfile |
---|
176 | }; // end namespace generic |
---|
177 | |
---|
178 | }; // end namespace behavioural |
---|
179 | }; // end namespace morpheo |
---|
180 | #endif |
---|