00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00037 #ifndef RC_TRANSACTION_COUNTER_H_
00038 #define RC_TRANSACTION_COUNTER_H_
00039
00040 #include "ReChannel/core/rc_reconfigurable.h"
00041
00042 namespace ReChannel {
00043
00074 class rc_transaction_counter
00075 : public sc_object
00076 {
00077 private:
00078 typedef rc_transaction_counter this_type;
00079
00080 public:
00081
00085 rc_transaction_counter();
00086
00092 explicit rc_transaction_counter(std::vector<this_type*>& children);
00093
00097 inline int count() const
00098 { return p_count; }
00099
00104 void modify(int amount);
00105
00112 void reset();
00113
00119 ~rc_transaction_counter()
00120 { this->reset(); }
00121
00125 inline rc_reconfigurable* get_reconfigurable() const
00126 { return p_reconf; }
00127
00133 inline int get_children_count() const
00134 { return (int)p_children.size(); }
00135
00139 int get_relay_factor(int index) const;
00140
00144 void set_relay_factor(int index, int factor);
00145
00149 void set_relay_factor(rc_transaction_counter& child, int factor);
00150
00151
00152
00156 inline const this_type& operator++()
00157 { this->modify(+1); return *this; }
00158
00162 inline const this_type& operator--()
00163 { this->modify(-1); return *this; }
00164
00168 inline const this_type& operator+=(int amount)
00169 { this->modify(amount); return *this; }
00170
00174 inline const this_type& operator-=(int amount)
00175 { this->modify(-amount); return *this; }
00176
00177
00178
00184 explicit rc_transaction_counter(this_type& tc1, int factor1);
00185
00186 rc_transaction_counter(
00187 this_type& tc1, int factor1, this_type& tc2, int factor2);
00188
00189 rc_transaction_counter(
00190 this_type& tc1, int factor1, this_type& tc2, int factor2,
00191 this_type& tc3, int factor3);
00192
00193 rc_transaction_counter(
00194 this_type& tc1, int factor1, this_type& tc2, int factor2,
00195 this_type& tc3, int factor3, this_type& tc4, int factor4);
00196
00197 rc_transaction_counter(
00198 this_type& tc1, int factor1, this_type& tc2, int factor2,
00199 this_type& tc3, int factor3, this_type& tc4, int factor4,
00200 this_type& tc5, int factor5);
00201
00202 rc_transaction_counter(
00203 this_type& tc1, int factor1, this_type& tc2, int factor2,
00204 this_type& tc3, int factor3, this_type& tc4, int factor4,
00205 this_type& tc5, int factor5, this_type& tc6, int factor6);
00206
00207 rc_transaction_counter(
00208 this_type& tc1, int factor1, this_type& tc2, int factor2,
00209 this_type& tc3, int factor3, this_type& tc4, int factor4,
00210 this_type& tc5, int factor5, this_type& tc6, int factor6,
00211 this_type& tc7, int factor7);
00212
00213 rc_transaction_counter(
00214 this_type& tc1, int factor1, this_type& tc2, int factor2,
00215 this_type& tc3, int factor3, this_type& tc4, int factor4,
00216 this_type& tc5, int factor5, this_type& tc6, int factor6,
00217 this_type& tc7, int factor7, this_type& tc8, int factor8);
00218
00219 rc_transaction_counter(
00220 this_type& tc1, int factor1, this_type& tc2, int factor2,
00221 this_type& tc3, int factor3, this_type& tc4, int factor4,
00222 this_type& tc5, int factor5, this_type& tc6, int factor6,
00223 this_type& tc7, int factor7, this_type& tc8, int factor8,
00224 this_type& tc9, int factor9);
00225
00226 rc_transaction_counter(
00227 this_type& tc1, int factor1, this_type& tc2, int factor2,
00228 this_type& tc3, int factor3, this_type& tc4, int factor4,
00229 this_type& tc5, int factor5, this_type& tc6, int factor6,
00230 this_type& tc7, int factor7, this_type& tc8, int factor8,
00231 this_type& tc9, int factor9, this_type& tc10, int factor10);
00232
00233 private:
00234
00238 void _rc_relay(int amount);
00239
00248 void _rc_add_child(rc_transaction_counter& child, int factor=1);
00249
00250 private:
00251
00255 rc_reconfigurable* p_reconf;
00259 int p_count;
00265 std::vector<std::pair<this_type*, int> > p_children;
00266
00267 private:
00268
00270 rc_transaction_counter(const this_type& orig);
00272 this_type& operator=(const this_type& orig);
00273 };
00274
00275 }
00276
00277 #endif //RC_TRANSACTION_COUNTER_H_
00278
00279
00280
00281
00282