Changeset 24 for branches/with_autoconf
- Timestamp:
- Apr 18, 2009, 4:36:12 PM (16 years ago)
- Location:
- branches/with_autoconf/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/with_autoconf/src/sc_int.h
r8 r24 18 18 #include <sc_logic.h> 19 19 #include <sc_bv.h> 20 #include <cstdlib> 20 21 21 22 // ---------------------------------------------------------------------------- … … 135 136 sc_int() { val = 0; } 136 137 // sc_int(data_type val_) { val = 0; write (val_); } 137 sc_int (const char *a) { val = 0; write ( atoi (a)); }138 sc_int (const char *a) { val = 0; write (std::atoi (a)); } 138 139 sc_int (unsigned short a){ val = 0; write (a); } 139 140 sc_int (short a) { val = 0; write (a); } … … 197 198 198 199 // arithmetic 199 template <typename T> 200 inline sc_int& operator <<= (T v) 201 { vf.valW <<= v; return *this; } 202 template <typename T> 203 inline sc_int& operator >>= (T v) 204 { vf.valW >>= v; return *this; } 205 template <typename T> 206 inline sc_int& operator += (T v) 207 { vf.valW += v; return *this; } 208 template <typename T> 209 inline sc_int& operator -= (T v) 210 { vf.valW -= v; return *this; } 211 template <typename T> 212 inline sc_int& operator *= (T v) 213 { vf.valW *= v; return *this; } 214 template <typename T> 215 inline sc_int& operator /= (T v) 216 { vf.valW /= v; return *this; } 217 template <typename T> 218 inline sc_int& operator %= (T v) 219 { vf.valW %= v; return *this; } 220 template <typename T> 221 inline sc_int& operator &= (T v) 222 { vf.valW &= v; return *this; } 223 template <typename T> 224 inline sc_int& operator |= (T v) 225 { vf.valW |= v; return *this; } 226 template <typename T> 227 inline sc_int& operator ^= (T v) 228 { vf.valW ^= v; return *this; } 200 #define DEFINE_OPERATOR(OPER) \ 201 template <typename T> \ 202 inline sc_int& operator OPER (T v) \ 203 { vf.valW OPER v; return *this; } 204 205 DEFINE_OPERATOR(<<=) 206 DEFINE_OPERATOR(>>=) 207 DEFINE_OPERATOR(+=) 208 DEFINE_OPERATOR(-=) 209 DEFINE_OPERATOR(*=) 210 DEFINE_OPERATOR(/=) 211 DEFINE_OPERATOR(%=) 212 DEFINE_OPERATOR(&=) 213 DEFINE_OPERATOR(|=) 214 DEFINE_OPERATOR(^=) 215 #undef DEFINE_OPERATOR 216 229 217 inline sc_int_bit_ref& operator [] (int v) 230 218 { return (vf.valW >> v) & 1; } -
branches/with_autoconf/src/sc_signal.h
r20 r24 82 82 size_t size = (sizeof (T)-1) / sizeof (base_type); 83 83 size_t i = 0; 84 const base_type *pvalue = (const base_type*)( &value_);84 const base_type *pvalue = (const base_type*)(void*)(&value_); 85 85 do { 86 86 #if 0 … … 96 96 if (sizeof (T) > sizeof (base_type)) { 97 97 #if 0 98 cout << "sizeof (T) = " << sizeof (T) << " (base_type = " << sizeof99 (base_type) << "\n";98 std::cout << "sizeof (T) = " << sizeof (T) 99 << " (base_type = " << sizeof (base_type) << "\n"; 100 100 #endif 101 101 post_multiwrite (pointer_,value_); … … 171 171 typedef T data_type; 172 172 typedef sc_signal < T > this_type; 173 173 174 /////////// 174 175 // Internal 175 176 public: void init (); 176 177 /////////// 178 177 179 // virtual void update (); 178 180 void check_writer (); -
branches/with_autoconf/src/sc_uint.h
r20 r24 183 183 184 184 // arithmetic 185 template <typename T> 186 inline sc_uint& operator <<= (T v) 187 { vf.valW <<= v; return *this; } 188 template <typename T> 189 inline sc_uint& operator >>= (T v) 190 { vf.valW >>= v; return *this; } 191 template <typename T> 192 inline sc_uint& operator += (T v) 193 { vf.valW += v; return *this; } 194 template <typename T> 195 inline sc_uint& operator -= (T v) 196 { vf.valW -= v; return *this; } 197 template <typename T> 198 inline sc_uint& operator *= (T v) 199 { vf.valW *= v; return *this; } 200 template <typename T> 201 inline sc_uint& operator /= (T v) 202 { vf.valW /= v; return *this; } 203 template <typename T> 204 inline sc_uint& operator %= (T v) 205 { vf.valW %= v; return *this; } 206 template <typename T> 207 inline sc_uint& operator &= (T v) 208 { vf.valW &= v; return *this; } 209 template <typename T> 210 inline sc_uint& operator |= (T v) 211 { vf.valW |= v; return *this; } 212 template <typename T> 213 inline sc_uint& operator ^= (T v) 214 { vf.valW ^= v; return *this; } 185 #define DEFINE_OPERATOR(OPER) \ 186 template <typename T> \ 187 inline sc_uint& operator OPER (T v)\ 188 { vf.valW OPER v; return *this; } 189 190 DEFINE_OPERATOR(<<=) 191 DEFINE_OPERATOR(>>=) 192 DEFINE_OPERATOR(+=) 193 DEFINE_OPERATOR(-=) 194 DEFINE_OPERATOR(*=) 195 DEFINE_OPERATOR(/=) 196 DEFINE_OPERATOR(%=) 197 DEFINE_OPERATOR(&=) 198 DEFINE_OPERATOR(|=) 199 DEFINE_OPERATOR(^=) 200 #undef DEFINE_OPERATOR 201 202 #if 0 203 #define DEFINE_OPERATOR(OPER) \ 204 friend bool operator OPER (const data_type& a, const data_type& b); 205 // { return (a.valW) OPER (b.valW); } 206 207 DEFINE_OPERATOR(==) 208 DEFINE_OPERATOR(!=) 209 DEFINE_OPERATOR(>=) 210 DEFINE_OPERATOR(<=) 211 #undef DEFINE_OPERATOR 212 #endif 215 213 inline sc_uint_bit_ref operator [] (int v) 216 214 { return (vf.valW >> v) & 1; }
Note: See TracChangeset
for help on using the changeset viewer.