Changeset 59 for sources/src
- Timestamp:
- Feb 6, 2017, 11:35:42 AM (8 years ago)
- Location:
- sources/src
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/alias.cc
r52 r59 41 41 42 42 const char * alias () { 43 44 char * buf = new char[4]; 45 46 47 48 49 i++; 50 43 static int i = 0; 44 char * buf = new char[4]; 45 buf[3] = '\0'; 46 buf[2] = 'a' + i % 26; 47 buf[1] = 'a' + (i / 26) % 26; 48 buf[0] = 'a' + ((i / 26) / 26) % 26; 49 i++; 50 return buf; 51 51 } 52 52 -
sources/src/casc.h
r52 r59 21 21 22 22 #include <cstdio> 23 #include <stdint.h>23 //#include <stdint.h> 24 24 25 25 EXTERN char unstable; 26 EXTERN int32 _tpending_write_vector_nb;26 EXTERN int32 pending_write_vector_nb; 27 27 28 28 namespace sc_core { -
sources/src/entity.cc
r52 r59 122 122 } 123 123 124 static sc_port_base * get_localvar(equi_t & eq) {124 static sc_port_base * get_localvar(equi_t & eq) { 125 125 equi_t::iterator i; 126 126 for (i = eq.begin(); i != eq.end(); ++i) { … … 134 134 135 135 136 static sc_port_base * get_signal(equi_t & eq) {136 static sc_port_base * get_signal(equi_t & eq) { 137 137 equi_t::iterator i; 138 138 for (i = eq.begin(); i != eq.end(); ++i) { … … 167 167 assert(pointer != NULL); 168 168 169 // boost170 169 tab_t2equi_it_t:: /*const_ */ iterator it = tab2equi_map.find(pointer); 171 170 if (it != tab2equi_map.end()) { … … 274 273 275 274 template < typename T > static equi_list_t::iterator get_equi(T & e) { 275 // QM debug 276 //cout << "equi_map : " << equi_map << endl; 277 276 278 entity2equi_it_t::iterator it = equi_map.find(entity(e)); 277 279 if (it == equi_map.end()) { -
sources/src/gen_code.cc
r57 r59 582 582 SC_ENTRY_FUNC func = m.func; 583 583 // CASC_ENTRY_FUNC func = reinterpret_cast<CASC_ENTRY_FUNC> (m.func); 584 // QM 585 //cerr << "Exec " << mod->name() << "->" << m.name << endl; 584 586 (mod->*func) (); 585 587 } -
sources/src/gen_code.h
r52 r59 93 93 inline void internal_sc_cycle1(int number_of_cycles) { 94 94 //while ((! have_to_stop) && (number_of_cycles != 0)) { 95 while (!((have_to_stop) | (number_of_cycles == 0))) {95 while (!((have_to_stop) || (number_of_cycles == 0))) { 96 96 trace_all(false); 97 97 internal_sc_cycle2(); 98 98 trace_all(true); 99 number_of_cycles = (number_of_cycles <0) ? number_of_cycles:number_of_cycles - 1;99 number_of_cycles = (number_of_cycles < 0) ? number_of_cycles : number_of_cycles - 1; 100 100 } 101 101 } … … 116 116 #endif 117 117 118 if (is_posted_write 119 // update posted value to external signals 120 update 121 func_combinationals 118 if (is_posted_write()) { 119 // update posted value to external signals 120 update(); 121 func_combinationals(); 122 122 } 123 123 124 internal_sc_cycle1 124 internal_sc_cycle1((int) duration); 125 125 126 126 // don't need to do func_combinationals since 'unstable' flag is now false -
sources/src/global_functions.cc
r52 r59 38 38 #include <iostream> 39 39 #include <dlfcn.h> 40 #include <signal.h> 40 41 41 42 #include "schedulers.h" // get_scheduling & run_schedule_editor … … 326 327 check_and_initialize(); 327 328 sc_core::internal_sc_cycle0(duration); 329 if (have_to_stop) { 330 std::vector<method_process_t *>::iterator i; 331 for (i = sc_core::method_process_list.begin(); i != sc_core::method_process_list.end(); i++) { 332 delete *i; 333 } 334 std::vector<const char *>::iterator j; 335 for (j = sc_core::allocated_names.begin(); j != sc_core::allocated_names.end(); j++) { 336 free((char *) *j); 337 } 338 } 328 339 } 329 340 … … 332 343 check_and_initialize(); 333 344 sc_core::internal_sc_cycle0(duration); 345 if (have_to_stop) { 346 std::vector<method_process_t *>::iterator i; 347 for (i = sc_core::method_process_list.begin(); i != sc_core::method_process_list.end(); i++) { 348 delete *i; 349 } 350 std::vector<const char *>::iterator j; 351 for (j = sc_core::allocated_names.begin(); j != sc_core::allocated_names.end(); j++) { 352 free((char *) *j); 353 } 354 } 334 355 } 335 356 -
sources/src/internal.h
r52 r59 17 17 #include <string> 18 18 #include <vector> 19 //#include <stdint.h> 19 20 20 21 namespace sc_core { … … 27 28 typedef std::vector<std::string> module_name_stack_t; 28 29 extern module_name_stack_t module_name_stack; 30 extern std::vector<const char *> allocated_names; 29 31 30 32 // Hash Table Port -> Module -
sources/src/internal_ext.h
r52 r59 38 38 39 39 #include <list> 40 //#include <stdint.h> 40 41 41 42 #include "sc_fwd.h" … … 71 72 #else 72 73 typedef uint32 tab_t; 73 //typedef smallest_uint tab_t; // signals of 64 bits are wrong in trace file74 //typedef smallest_uint tab_t; // signals of 64 bits are wrong in trace file 74 75 #endif 75 76 typedef tab_t * equi_table_t; -
sources/src/module_hierarchy2dot.cc
r27 r59 1 1 /*------------------------------------------------------------\ 2 | |3 | Tool : systemcass |4 | |5 | File : module_hierarchy2dot.cc |6 | |7 | Author : Buchmann Richard |8 | |9 | Date : 26_01_2006 |10 | |11 \------------------------------------------------------------*/2 | | 3 | Tool : systemcass | 4 | | 5 | File : module_hierarchy2dot.cc | 6 | | 7 | Author : Buchmann Richard | 8 | | 9 | Date : 26_01_2006 | 10 | | 11 \------------------------------------------------------------*/ 12 12 13 13 /* … … 53 53 namespace sc_core { 54 54 55 /*56 static57 const char*58 get_parent_name (const sc_object &obj)59 {60 const sc_object *parent = NULL;//get_parent_object (obj);61 if (parent == NULL)62 return "";63 return parent->basename ();64 }65 */66 67 55 typedef set<const char*> node_set_t; 68 56 node_set_t node_set; 69 57 70 static 71 void 72 print_edge (ostream &o) 58 static void print_edge (ostream &o) 73 59 { 74 typedef map<const char*, const char*> edge_t; 75 edge_t edges; 76 const equi_list_t &eq_list = get_equi_list (); 77 equi_list_t::const_iterator jt; 78 for (jt = eq_list.begin (); jt != eq_list.end (); ++jt) 79 { 80 const equi_t &eq = (*jt); 81 sc_port_base *out = get_out_port (eq); 82 if (out == NULL) 83 continue; 84 if (is_clock (*out)) 85 continue; 86 const sc_module &out_mod = out->get_module (); 87 const char *out_mod_name = out_mod.basename (); 88 equi_t::const_iterator it; 89 for (it = eq.begin (); it != eq.end (); ++it) 60 typedef map<const char*, const char*> edge_t; 61 edge_t edges; 62 const equi_list_t &eq_list = get_equi_list (); 63 equi_list_t::const_iterator jt; 64 for (jt = eq_list.begin (); jt != eq_list.end (); ++jt) 90 65 { 91 const entity &in_entity = *it; 92 sc_object *in_obj = in_entity.object; 93 assert(in_obj != NULL); 94 const sc_module *in_parent = NULL; 95 switch (in_entity.type) { 96 case entity::PORT : 97 in_parent = &(in_entity.port->get_module ()); 98 if (&out_mod == in_parent) 99 continue; 100 break; 101 case entity::SIGNAL : 102 default : 103 continue; 104 } 105 edges[out_mod_name] = in_parent->basename (); 106 node_set.insert(out_mod_name); 107 node_set.insert(in_parent->basename ()); 66 const equi_t & eq = (*jt); 67 sc_port_base * out = get_out_port (eq); 68 if (out == NULL) { 69 continue; 70 } 71 if (is_clock(*out)) { 72 continue; 73 } 74 const sc_module &out_mod = out->get_module (); 75 const char *out_mod_name = out_mod.basename (); 76 equi_t::const_iterator it; 77 for (it = eq.begin (); it != eq.end (); ++it) 78 { 79 const entity &in_entity = *it; 80 sc_object *in_obj = in_entity.object; 81 assert(in_obj != NULL); 82 const sc_module *in_parent = NULL; 83 switch (in_entity.type) { 84 case entity::PORT : 85 in_parent = &(in_entity.port->get_module ()); 86 if (&out_mod == in_parent) { 87 continue; 88 } 89 break; 90 case entity::SIGNAL : 91 default : 92 continue; 93 } 94 edges[out_mod_name] = in_parent->basename (); 95 node_set.insert(out_mod_name); 96 node_set.insert(in_parent->basename ()); 97 } 108 98 } 109 }110 99 #if 0 111 const equi_t &signal_eq = *(eq_list.begin ());112 const char *signal_name = get_name (signal_eq);113 o << "edge [label=\"" << signal_name << "\"]\n";100 const equi_t &signal_eq = *(eq_list.begin ()); 101 const char *signal_name = get_name (signal_eq); 102 o << "edge [label=\"" << signal_name << "\"]\n"; 114 103 #endif 115 edge_t::const_iterator i;116 for (i = edges.begin (); i != edges.end (); ++i)117 {118 o << i->first119 << " -> "120 << i->second121 << ";\n";122 }104 edge_t::const_iterator i; 105 for (i = edges.begin (); i != edges.end (); ++i) 106 { 107 o << i->first 108 << " -> " 109 << i->second 110 << ";\n"; 111 } 123 112 } 124 113 … … 126 115 127 116 static 128 void117 void 129 118 print_node (ostream &o, 130 119 const sc_object &obj) 131 120 { 132 const vector<sc_object*> &obj_list = get_child_objects (obj); 133 bool subgraph = (obj_list.empty() == false); 134 // && (get_parent_object (obj) != NULL); 135 if (subgraph) { 136 const char *name = obj.basename (); 137 o << "subgraph \"cluster" << name << "\" {\n" 138 << "label=\"" << name << "\";\n"; 139 print_node (o, obj_list); 140 o << "}\n"; 141 } /*else*/ { 142 // if (obj.kind () == sc_module::kind_string) 143 if (node_set.find (obj.basename ()) != node_set.end()) 144 o << obj.basename () << endl; 145 } 121 const vector<sc_object*> &obj_list = get_child_objects (obj); 122 bool subgraph = (obj_list.empty() == false); 123 // && (get_parent_object (obj) != NULL); 124 if (subgraph) { 125 const char *name = obj.basename (); 126 o << "subgraph \"cluster" << name << "\" {\n" 127 << "label=\"" << name << "\";\n"; 128 print_node (o, obj_list); 129 o << "}\n"; 130 } /*else*/ { 131 // if (obj.kind () == sc_module::kind_string) 132 if (node_set.find (obj.basename ()) != node_set.end()) { 133 o << obj.basename () << endl; 134 } 135 } 146 136 } 147 137 148 138 static 149 void139 void 150 140 print_node (ostream &o, 151 141 const vector<sc_object*> &obj_list) 152 142 { 153 vector<sc_object*>::const_iterator it;154 for (it = obj_list.begin(); it != obj_list.end(); ++it)155 {156 sc_object *obj = *it;157 print_node (o, *obj);158 }143 vector<sc_object*>::const_iterator it; 144 for (it = obj_list.begin(); it != obj_list.end(); ++it) 145 { 146 sc_object *obj = *it; 147 print_node (o, *obj); 148 } 159 149 } 160 150 161 bool151 bool 162 152 module_hierarchy2dot (const char *name) 163 153 { 164 if (!name) 165 return false; 166 string filename; 167 filename = name; 168 filename += ".dot"; 169 ofstream o; 170 o.open (filename.c_str(),ios::out | ios::trunc); 171 if (o.is_open () == false) 172 return false; 173 o << "strict digraph " << name << " {\n"; 174 o << "node [shape=box];\n"; 175 print_edge (o); 176 print_node (o,sc_get_top_level_objects ()); 177 o << "}\n"; 178 o.close (); 179 return true; 154 if (!name) { 155 return false; 156 } 157 string filename; 158 filename = name; 159 filename += ".dot"; 160 ofstream o; 161 o.open (filename.c_str(),ios::out | ios::trunc); 162 if (o.is_open () == false) { 163 return false; 164 } 165 o << "strict digraph " << name << " {\n"; 166 o << "node [shape=box];\n"; 167 print_edge (o); 168 print_node (o,sc_get_top_level_objects ()); 169 o << "}\n"; 170 o.close (); 171 return true; 180 172 } 181 173 -
sources/src/mouchard_scheduling.cc
r52 r59 46 46 #include "sc_module.h" 47 47 #include "sc_ver.h" 48 48 49 49 50 #ifdef HAVE_CONFIG_H -
sources/src/sc_bigint.h
r52 r59 16 16 #include <sc_logic.h> 17 17 #include <sc_bv.h> 18 //#include <stdint.h> 18 19 19 20 // ---------------------------------------------------------------------------- -
sources/src/sc_biguint.h
r52 r59 19 19 20 20 #include "sc_nbdefs.h" 21 //#include <stdint.h> 21 22 22 23 namespace sc_dt { -
sources/src/sc_bv.h
r52 r59 17 17 // 18 18 // ---------------------------------------------------------------------------- 19 20 //#include <stdint.h> 19 21 20 22 #include "sc_nbdefs.h" … … 41 43 sc_bv_base & operator = (const sc_unsigned & a); 42 44 sc_bv_base & operator = (const sc_signed & a); 45 sc_bv_base & operator = (unsigned int a); 43 46 sc_bv_base & operator = (unsigned long a); 44 47 sc_bv_base & operator = (long a); 45 sc_bv_base & operator = (unsigned int a);46 48 sc_bv_base & operator = (int a); 47 49 sc_bv_base & operator = (uint64 a); … … 66 68 sc_bv (const sc_unsigned & a); 67 69 sc_bv (const sc_signed & a); 70 sc_bv (unsigned int a); 68 71 sc_bv (unsigned long a); 69 72 sc_bv (long a); 70 sc_bv (unsigned int a);71 73 sc_bv (int a); 72 74 sc_bv (uint64 a); … … 82 84 sc_bv < W > & operator = (const sc_unsigned & a); 83 85 sc_bv < W > & operator = (const sc_signed & a); 86 sc_bv < W > & operator = (unsigned int a); 84 87 sc_bv < W > & operator = (unsigned long a); 85 88 sc_bv < W > & operator = (long a); 86 sc_bv < W > & operator = (unsigned int a);87 89 sc_bv < W > & operator = (int a); 88 90 sc_bv < W > & operator = (uint64 a); -
sources/src/sc_clock_ext.h
r52 r59 73 73 bool posedge_first_ = true); 74 74 75 sc_clock(const char * name_,75 sc_clock(const char * name_, 76 76 double period_, 77 77 double duty_cycle_ = 0.5, -
sources/src/sc_int.h
r52 r59 19 19 #include <sc_bv.h> 20 20 #include <cstdlib> 21 //#include <stdint.h> 21 22 22 23 // ---------------------------------------------------------------------------- … … 37 38 38 39 39 #define MASK32(W) ((~ (const uint32) 0) >> (sizeof (uint32) * 8 - W))40 #define MASK64(W) ((~ (const uint64) 0) >> (sizeof (uint64) * 8 - W))40 #define MASK32(W) ((~ (const uint32) 0) >> (sizeof (uint32) * 8 - W)) 41 #define MASK64(W) ((~ (const uint64) 0) >> (sizeof (uint64) * 8 - W)) 41 42 42 43 template<int W> struct s_int_type { typedef int64 int_type; }; 43 44 44 #define DECLAR_INT_TYPE(W) template<> struct s_int_type<W> { typedef smallest_int int_type; } // not declared as in 8 because << operator threats like a character45 #define DECLAR_INT_TYPE(W) template<> struct s_int_type<W> { typedef smallest_int int_type; } // not declared as int8 because << operator threats like a character 45 46 DECLAR_INT_TYPE(1); 46 47 DECLAR_INT_TYPE(2); … … 54 55 55 56 #define DECLAR_INT_TYPE(W) template<> struct s_int_type<W> { typedef int16 int_type; } 56 DECLAR_INT_TYPE( 57 DECLAR_INT_TYPE(9); 57 58 DECLAR_INT_TYPE(10); 58 59 DECLAR_INT_TYPE(11); … … 96 97 int64 val; 97 98 sc_int_subref_r(int64 val_, int left_, int right_) { 98 val = val_; left = left_; right = right_; 99 val = val_; 100 left = left_; 101 right = right_; 99 102 } 100 103 101 inline int64 read 102 inline const sc_int_subref_r & operator | (const sc_int_subref_r &v) const {103 print_warning 104 inline int64 read() const { return val; } 105 inline const sc_int_subref_r & operator | (const sc_int_subref_r & v) const { 106 print_warning(); 104 107 return *this; 105 108 } 106 109 107 110 private : 108 void print_warning 111 void print_warning() const; 109 112 110 113 }; … … 116 119 class sc_int_subref_r; 117 120 118 template < int W /* = SC_INTWIDTH */>121 template < int W /* = SC_INTWIDTH */> 119 122 class sc_int { 120 123 … … 123 126 /***********************/ 124 127 typedef sc_int<W> this_type; 128 public: 125 129 typedef typename s_int_type<W>::int_type data_type; 126 130 private: 127 131 typedef data_type sc_int_subref; 128 132 129 133 // internal 130 134 union { 131 val_field<W, (sizeof 135 val_field<W, (sizeof(data_type) * 8) - W,data_type> vf; /* To compute */ 132 136 data_type val; /* To return an int reference (read function) */ 133 137 }; … … 138 142 /***********************/ 139 143 public: 140 sc_int() 141 sc_int (const char * a) { val = 0; write (std::atoi(a)); }142 sc_int (unsigned short a) { val = 0; write(a); }143 sc_int (short a) { val = 0; write(a); }144 sc_int (unsigned long a) { val = 0; write(a); }145 sc_int (long a) { val = 0; write(a); }146 sc_int (unsigned int a) { val = 0; write(a); }147 sc_int (int a) { val = 0; write(a); }148 sc_int (int64 a) { val = 0; write(a); }149 sc_int (uint64 a) { val = 0; write(a); }150 sc_int (double a) { val = 0; write(a); }144 sc_int() { val = 0; } 145 sc_int(const char * a) { val = 0; write(std::atoi(a)); } 146 sc_int(unsigned short a) { val = 0; write(a); } 147 sc_int(short a) { val = 0; write(a); } 148 sc_int(unsigned long a) { val = 0; write(a); } 149 sc_int(long a) { val = 0; write(a); } 150 sc_int(unsigned int a) { val = 0; write(a); } 151 sc_int(int a) { val = 0; write(a); } 152 sc_int(int64 a) { val = 0; write(a); } 153 sc_int(uint64 a) { val = 0; write(a); } 154 sc_int(double a) { val = 0; write(a); } 151 155 152 156 template <int W2> sc_int (const sc_int<W2> &val_) { val = 0; write (val_.read());} … … 155 159 */ 156 160 157 sc_int (const sc_int &val_) { val = val_.val; }158 sc_int (const sc_int_subref_r & a) { val = 0; write(a); }161 sc_int(const sc_int & val_) { val = val_.val; } 162 sc_int(const sc_int_subref_r & a) { val = 0; write(a); } 159 163 /* the user needs to cast explicitly result of range () method. */ 160 164 … … 165 169 166 170 // read/write 167 inline const data_type& read() const { return val; } 168 inline void write(data_type val_) { vf.valW = val_; } 169 template <int W2> inline void write (const sc_int<W2> val_) { write (val_.read ()); } 170 inline void write (const sc_int_subref_r& s) { write (s.read()); } 171 inline const data_type & read() const { return val; } 172 inline void write(data_type val_) { vf.valW = val_; } 173 template <int W2> void write(const sc_int<W2> val_) { write (val_.read ()); } 174 inline void write(const sc_int_subref_r & s) { 175 write (s.read()); 176 } 171 177 172 178 /***********************/ … … 176 182 // operators 177 183 inline operator const data_type & () const { 178 return read 179 } 180 181 template < typename T> inline sc_int& operator = (const T& val_) {182 write 184 return read(); 185 } 186 187 template < typename T > inline sc_int & operator = (const T & val_) { 188 write(val_); 183 189 return *this; 184 190 } 185 191 186 inline sc_int & operator = (const sc_int_subref_r & a) {187 write 192 inline sc_int & operator = (const sc_int_subref_r & a) { 193 write(a); 188 194 return *this; 189 195 } … … 199 205 return sc_dt::to_string (val, W, numrep); 200 206 } 201 const sc_string to_dec() const { return to_string 202 const sc_string to_bin() const { return to_string 203 const sc_string to_oct() const { return to_string 204 const sc_string to_hex() const { return to_string 207 const sc_string to_dec() const { return to_string(SC_DEC); } 208 const sc_string to_bin() const { return to_string(SC_BIN); } 209 const sc_string to_oct() const { return to_string(SC_OCT); } 210 const sc_string to_hex() const { return to_string(SC_HEX); } 205 211 206 212 // arithmetic … … 231 237 template <int W2> 232 238 inline sc_int<W + W2> operator , (const sc_int<W2> & b) const { 233 sc_int<W + W2> res = read() << W2; res += b.read(); 239 sc_int<W + W2> res = read() << W2; 240 res += b.read(); 234 241 return res; 235 242 } … … 241 248 242 249 template <int W2> 243 inline sc_int<W2> operator , (const sc_int_subref_r & v) const {250 inline sc_int<W2> operator , (const sc_int_subref_r & v) const { 244 251 std::cerr << "Warning : \n"; 245 252 return sc_int<W2> (v.read()); 246 253 } 247 254 248 inline sc_int_subref range 255 inline sc_int_subref range(int left, int right) { 249 256 return (data_type)((data_type) (((data_type)~(0)) >> (sizeof (data_type) * 8 - left - 1)) & val) >> right; 250 257 } 251 258 252 inline sc_int_subref_r range (int left, int right) const { 253 return sc_int_subref_r (((data_type) (((data_type)~(0)) >> (sizeof (data_type) * 8 - left - 1)) & val) >> right, left, right); 254 } 259 inline sc_int_subref_r range(int left, int right) const { 260 return sc_int_subref_r(((data_type) (((data_type)~(0)) >> (sizeof (data_type) * 8 - left - 1)) & val) >> right, left, right); 261 } 262 255 263 #if 0 256 264 std::cerr << "range(" << left << "," << right << ")\n"; … … 263 271 }; 264 272 265 inline std::ostream & operator << (std::ostream & o, const sc_int_subref_r & s) {273 inline std::ostream & operator << (std::ostream & o, const sc_int_subref_r & s) { 266 274 return o << s.val; 267 275 } -
sources/src/sc_lv.h
r52 r59 18 18 // 19 19 // ---------------------------------------------------------------------------- 20 21 //#include <stdint.h> 20 22 21 23 #include "sc_nbdefs.h" … … 122 124 sc_lv(const sc_unsigned & a) { val = 0; write(a); } 123 125 sc_lv(const sc_signed & a) { val = 0; write(a); } 124 sc_lv(unsigned long a) { val = 0; write(a); } 126 sc_lv(unsigned int a) { val = 0; write(a); } 127 sc_lv(unsigned long a) { val = 0; write(a); } 125 128 sc_lv(long a) { val = 0; write(a); } 126 sc_lv(unsigned int a) { val = 0; write(a); }127 129 sc_lv(int a) { val = 0; write(a); } 128 130 sc_lv(uint64 a) { val = 0; write(a); } … … 142 144 #endif // LRM 143 145 144 template < typename T> inline sc_lv& operator = (const T& val_) {146 template < typename T > inline sc_lv& operator = (const T& val_) { 145 147 write (val_); 146 148 return *this; -
sources/src/sc_module.cc
r52 r59 67 67 instances_list_t temp_list; 68 68 method_process_list_t method_process_list; 69 std::vector<const char *> allocated_names; 69 70 module_name_stack_t module_name_stack; 70 71 modules_stack_t modules_stack; … … 73 74 void declare_method_process(const char * name, SC_ENTRY_FUNC func, sc_module & module) { 74 75 method = create_method_process(name, func, module); 75 method_process_list.push_back(method); 76 method_process_list.push_back(method); 76 77 } 77 78 -
sources/src/sc_nbdefs.h
r52 r59 14 14 #define __SC_DEFS_H__ 15 15 16 #ifndef WIN32 16 //#include <stdint.h> 17 17 18 typedef signed long long int64; 18 19 typedef unsigned long long uint64; 19 #else20 typedef signed __int64 int64;21 typedef unsigned __int64 uint64;22 #endif23 20 24 21 typedef long int32; … … 28 25 typedef unsigned short uint16; 29 26 typedef unsigned char uint8; 27 28 29 //typedef uint16_t smallest_uint; 30 //typedef int16_t smallest_int; 30 31 31 32 typedef uint16 smallest_uint; -
sources/src/sc_numrep.h
r52 r59 55 55 char t[64]; 56 56 char format[64]; 57 sprintf(format, "0x0%%0%dx", nbits / 4);57 sprintf(format, "0x0%%0%dx", (int) nbits / 4); 58 58 sprintf(t, format, val); 59 59 s = t; -
sources/src/sc_object.cc
r52 r59 107 107 string s; 108 108 gen_name(basename_,s); 109 return strdup (s.c_str()); 109 const char * ret = strdup(s.c_str()); 110 sc_core::allocated_names.push_back(ret); 111 return ret; 110 112 } 111 113 -
sources/src/sc_object.h
r52 r59 26 26 27 27 class sc_object { 28 28 29 29 /////////// 30 30 // Internal 31 31 // //////// 32 32 protected: 33 33 void init(); 34 34 void set_kind(const char *); -
sources/src/sc_pat_trace.cc
r52 r59 70 70 //création d'1 instance de la structure Sc_trace_file: 71 71 sc_trace_file * traceFic = new sc_trace_file(); 72 traceFic->flag = PAT_FORMAT; 72 traceFic->flag = PAT_FORMAT; 73 73 74 74 trace_file_list.push_back(traceFic); … … 83 83 //************************************************************************* 84 84 85 void sc_close_pat_trace_file(sc_trace_file * traceFic ) { 85 void sc_close_pat_trace_file(sc_trace_file * traceFic ) { 86 86 if (notrace) { 87 87 return; -
sources/src/sc_port.cc
r58 r59 53 53 extern char unstable; 54 54 char unstable = 0; // not in sc_core namespace because dynamic link support C linkage only 55 unsigned intpending_write_vector_nb = 0;55 int32 pending_write_vector_nb = 0; 56 56 } 57 57 … … 67 67 extern equi_list_t equi_list; 68 68 69 const char * get_module_name 70 const equi_t & eq = get_equi(pointer);71 return get_module_name 69 const char * get_module_name(const tab_t * pointer) { 70 const equi_t & eq = get_equi(pointer); 71 return get_module_name(eq); 72 72 } 73 73 … … 87 87 88 88 sc_port_base::sc_port_base() { 89 89 init (); 90 90 } 91 91 … … 216 216 // stl vectors are too slow 217 217 // memcopy is not better 218 // signal table sorting doesn't give any better performance 218 // signal table sorting doesn't give any better performance 219 219 #if defined(DUMP_STAGE) 220 220 cerr << "(" << pending_write_vector_nb … … 229 229 exit (8); 230 230 } 231 #endif 231 #endif 232 232 #ifdef DUMP_SIGNAL_STATS 233 233 if (*(iter.pointer) == iter.value) { … … 236 236 counter[iter.pointer]++; 237 237 #endif 238 *(iter.pointer) = iter.value; 238 *(iter.pointer) = iter.value; 239 239 #undef iter 240 240 } … … 277 277 for (k = counter.begin(); k != counter.end(); ++k) { 278 278 string module_name = get_module_name (k->first); 279 counter_by_module[module_name] += k->second; 279 counter_by_module[module_name] += k->second; 280 280 } 281 281 o << "module name / usage\n"; … … 290 290 #endif 291 291 } 292 292 293 293 294 static bool is_bound(/*const*/ sc_port_base & port) { … … 297 298 return false; // case : sc_in not bound 298 299 } 299 return has_equi (port); 300 } 300 return has_equi(port); 301 } 302 301 303 302 304 static void check_port(/*const*/ sc_port_base & port) { 303 if (!is_bound 305 if (!is_bound(port)) { 304 306 cerr << "Error : '" << port.name() << "' port" 305 307 " (" << port.kind() << ")" … … 316 318 port2module_t::/*const_*/iterator i; 317 319 for (i = port2module.begin(); i != port2module.end(); ++i) { 318 /*const*/ sc_port_base * port = i->first;320 /*const*/ sc_port_base * port = i->first; 319 321 assert(port != NULL); 320 322 check_port(*port); -
sources/src/sc_signal.h
r52 r59 18 18 #include <iostream> 19 19 #include <cstdlib> 20 #include <typeinfo> // for typeid 20 21 21 22 #include "sc_fwd.h" … … 53 54 base_type * pointer; 54 55 base_type value; 55 //pending_write_t(base_type * const pointer_, const base_type value_) {56 // pointer = pointer_;57 // value = value_;58 //}59 56 60 57 friend std::ostream & operator << (std::ostream & o, const pending_write_t & p) { … … 76 73 77 74 template < typename T > 78 inline void post_write(base_type * const pointer_, const T value_) /*INLINE*/;79 80 template < typename T > 81 inline void post_multiwrite(base_type * const pointer_, const T value_) {75 inline void post_write(base_type * const pointer_, const T & value_) /*INLINE*/; 76 77 template < typename T > 78 inline void post_multiwrite(base_type * const pointer_, const T & value_) { 82 79 size_t size = (sizeof(T) - 1) / sizeof(base_type); 83 80 size_t i = 0; 84 const base_type * pvalue = (const base_type *) (void *) (& 81 const base_type * pvalue = (const base_type *) (void *) (&value_); 85 82 do { 86 83 post_write(pointer_ + i, pvalue[i]); … … 89 86 90 87 template < typename T > 91 inline void post_write(base_type * const pointer_, const T value_) {88 inline void post_write(base_type * const pointer_, const T & value_) { 92 89 if (sizeof(T) > sizeof(base_type)) { 93 post_multiwrite(pointer_, value_);90 post_multiwrite(pointer_, value_); 94 91 } 95 92 else { … … 166 163 167 164 private: 165 168 166 T val; 167 169 168 typedef T data_type; 170 169 typedef sc_signal < T > this_type; … … 182 181 // constructors, destructor 183 182 sc_signal() { 183 if (typeid(data_type) == typeid(double) || typeid(data_type) == typeid(float)) { 184 std::cerr << "Error: SystemCASS does not support sc_signal<T> with T of type " << typeid(data_type).name() << std::endl; 185 exit(1); 186 } 184 187 init(); 185 188 } … … 215 218 } 216 219 217 const data_type & get_new_value() const; 220 const data_type & get_new_value() const { 221 // Warning: untested and doesn't support variable size 222 unsigned int i = 0; 223 for (i = 0; i < pending_write_vector_capacity; i++) { 224 if (pending_write_vector[i].pointer == get_pointer()) { 225 return pending_write_vector[i].value; 226 } 227 } 228 return val; 229 } 218 230 219 231 // void trace (sc_trace_file * tf) const; … … 235 247 set_kind(kind_string); 236 248 sc_interface::init(sizeof(data_type)); 237 val = 0; /* The simulator initializes the signal/register to 0. */249 val = (T) 0; /* The simulator initializes the signal/register to 0. */ 238 250 /* However, hardware initialization still has to be done. */ 239 251 /* This kind of initialization is for trace diffing. */ … … 245 257 /*virtual*/ inline const T & sc_signal< T >::read() const { 246 258 #ifdef DUMP_READ 247 std::cerr << "read " << READ_SIGNAL(const T, get_pointer()) << " on signal " << name() << "\n"; 248 #endif 249 return READ_SIGNAL(const T, get_pointer()); 259 std::cerr << "read " << READ_SIGNAL(const data_type, get_pointer()) << " on signal " << name() << "\n"; 260 #endif 261 // QM 262 return READ_SIGNAL(T, get_pointer()); 250 263 } 251 264 … … 266 279 std::cerr << "write (posted) " << value_ << " on sc_signal (writing into register) '" << name() << "'\n"; 267 280 #endif 281 268 282 post_write(/*(tab_t*)&val*/ get_pointer(), value_); 269 283 } -
sources/src/sc_time.cc
r52 r59 51 51 52 52 static const char *const unit_repr_string[6] = { 53 53 "FS", "PS", "NS", "US", "MS", "SEC" 54 54 }; 55 55 56 uint64 _tnb_cycles = 0;56 uint64 nb_cycles = 0; 57 57 58 58 const sc_time SC_ZERO_TIME(0, SC_NS); … … 66 66 67 67 sc_time::sc_time (double val, sc_time_unit tu) { 68 time = (uint64 _t) val;68 time = (uint64) val; 69 69 unit = tu; 70 70 } -
sources/src/sc_time.h
r52 r59 15 15 16 16 #include <string> 17 #include <stdint.h> 17 //#include <stdint.h> 18 19 #include "sc_nbdefs.h" 18 20 19 21 namespace sc_core { … … 40 42 extern sc_time SC_CURRENT_TIME; 41 43 42 extern uint64 _tnb_cycles;44 extern uint64 nb_cycles; 43 45 44 46 inline double sc_simulation_time() { … … 55 57 56 58 friend const sc_time & sc_time_stamp(); 57 uint64 _ttime;59 uint64 time; 58 60 enum sc_time_unit unit; 59 61 … … 64 66 sc_time & operator= (const sc_time &); 65 67 66 uint64 _tvalue() const {68 uint64 value() const { 67 69 return time; 68 70 } -
sources/src/sc_trace.cc
r52 r59 40 40 #include <iostream> 41 41 #include <cstring> //strlen 42 //#include <stdint.h> 42 43 43 44 #include "sc_port.h" -
sources/src/sc_trace.h
r52 r59 38 38 39 39 #include <vector> 40 //#include <stdint.h> 40 41 41 42 #include "sc_trace_ext.h" … … 60 61 61 62 struct sc_trace_file { 62 63 64 65 63 TRACE_FORMAT flag; 64 FILE * pfic; 65 std::vector<signal2trace> sig_list; 66 std::vector<signal2trace> clk_list; 66 67 }; 67 68 -
sources/src/sc_trace_ext.h
r52 r59 42 42 #include <string> 43 43 #include <sstream> 44 //#include <stdint.h> 44 45 45 46 #include "sc_fwd.h" … … 90 91 BITS_NUMBER_GETTER_DEF(, sc_signed , 8 * sizeof(int)); 91 92 BITS_NUMBER_GETTER_DEF(, double , 8 * sizeof(val_t)); 92 BITS_NUMBER_GETTER_DEF(, uint64 93 BITS_NUMBER_GETTER_DEF(, int64 93 BITS_NUMBER_GETTER_DEF(, uint64 , 8 * sizeof(val_t)); 94 BITS_NUMBER_GETTER_DEF(, int64 , 8 * sizeof(val_t)); 94 95 BITS_NUMBER_GETTER_DEF(typename inval_t, sc_in<inval_t> , bits_number_getter<inval_t>::get()); 95 96 BITS_NUMBER_GETTER_DEF(typename inval_t, sc_out<inval_t> , bits_number_getter<inval_t>::get()); -
sources/src/sc_uint.h
r52 r59 20 20 #include <sc_bv.h> 21 21 #include <cstdlib> 22 //#include <stdint.h> 22 23 23 24 // ---------------------------------------------------------------------------- … … 75 76 }; 76 77 77 #define DECLAR_UINT_TYPE(W) template<> struct s_uint_type<W> { typedef smallest_uint uint_type; }// not declared as uint 16because << operator threats like a character78 #define DECLAR_UINT_TYPE(W) template<> struct s_uint_type<W> { typedef smallest_uint uint_type; }// not declared as uint8 because << operator threats like a character 78 79 DECLAR_UINT_TYPE(1); 79 80 DECLAR_UINT_TYPE(2); … … 280 281 template <int W2> 281 282 inline sc_uint<W2> operator , (const sc_uint_subref_r & v) const { 282 std::cerr << "Warning : \n"; // ??283 283 return sc_uint<W2> (v.read()); 284 284 } -
sources/src/schedulers.cc
r52 r59 215 215 } 216 216 217 /* Schedule */ 217 /* Schedule */ 218 218 string base_name; 219 219 switch (scheduling_method) { -
sources/src/serialization.cc
r52 r59 37 37 #include <map> 38 38 #include <fstream> 39 //#include <stdint.h> 39 40 40 41 #include "internal_ext.h" // tab_t
Note: See TracChangeset
for help on using the changeset viewer.