Changeset 35 for sources/src
- Timestamp:
- Jun 29, 2009, 6:03:59 PM (15 years ago)
- Location:
- sources/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/casc.h
r27 r35 49 49 { 50 50 #ifdef CONFIG_CHECK_FSM_RULES 51 51 casc_fsm_step = TRANSITION; 52 52 #endif 53 53 transition (); 54 54 update (); 55 55 #ifdef CONFIG_CHECK_FSM_RULES 56 56 casc_fsm_step = GEN_MOORE; 57 57 #endif 58 58 moore_generation (); 59 59 #ifdef CONFIG_CHECK_FSM_RULES 60 60 casc_fsm_step = GEN_MEALY; 61 61 #endif 62 62 mealy_generation (); 63 63 #ifdef CONFIG_CHECK_FSM_RULES 64 64 casc_fsm_step = STIMULI; 65 65 #endif 66 66 } -
sources/src/gen_code.cc
r31 r35 79 79 ostream& operator << (ostream &o, const SC_ENTRY_FUNC &f) 80 80 { 81 register fct p; 82 p.pmf = f; 83 return o << "0x" << hex << p.integer << "ULL"; 81 register fct p; 82 p.integer = 0; 83 p.pmf = f; 84 return o << "0x" << hex << p.integer << "ULL"; 84 85 } 85 86 … … 242 243 o << "\nextern void mealy_generation (void)\n{\n"; 243 244 o << " register fct p;\n" 244 245 246 247 248 249 250 245 << "\n\n /* fonctions de mealy */\n"; 246 ProcessDependencyList::iterator it; 247 for (it = mealy_func_list.begin(); it != mealy_func_list.end(); ++it) 248 { 249 const method_process_t *m = *it; 250 PrintCall (o, *m); 251 } 251 252 } 252 253 … … 260 261 cerr << "Generating C code for scheduling...\n"; 261 262 262 263 263 // open temporary file 264 ofstream o; 264 265 char base_name[PATH_MAX]; 265 266 open_temp (o, base_name); 266 267 267 268 if (! o.good ()) { 268 269 perror("scheduling: open file\n"); 269 270 exit(-1); … … 271 272 272 273 o << "// generated by " << sc_version () << endl 273 274 275 // 276 274 << "#include <casc.h>\n\n" 275 << "#include <cstdio>\n\n" 276 // << "#include <iostream>\n\n" 277 << "namespace sc_core {\n" 277 278 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" 278 279 << " typedef void (*CASC_ENTRY_FUNC)(void *);\n"; 279 280 const char *pmf_type = (sizeof (SC_ENTRY_FUNC) == 4)? 280 281 // G4 pointer-to-member-function style … … 286 287 << " integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n"; 287 288 288 289 290 289 gen_transition (o, transition_func_list); 290 gen_moore (o, moore_func_list); 291 gen_mealy (o, strongcomponents); 291 292 292 293 o << " \n}\n"; … … 340 341 << " typedef union { unsigned long long int integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n"; 341 342 342 343 344 343 gen_transition (o, transition_func_list); 344 gen_moore (o, moore_func_list); 345 gen_mealy (o, mealy_func_list); 345 346 346 347 o << "\n}\n"; … … 567 568 { 568 569 #ifdef CONFIG_CHECK_FSM_RULES 569 570 casc_fsm_step = TRANSITION; 570 571 #endif 571 572 call_functions (pf[0]); // transition 572 573 update (); 573 574 #ifdef CONFIG_CHECK_FSM_RULES 574 575 casc_fsm_step = GEN_MOORE; 575 576 #endif 576 577 call_functions (pf[1]); // moore generation 577 578 #ifdef CONFIG_CHECK_FSM_RULES 578 579 casc_fsm_step = GEN_MEALY; 579 580 #endif 580 581 call_functions (pf[2]); // mealy generation 581 582 #ifdef CONFIG_CHECK_FSM_RULES 582 583 casc_fsm_step = STIMULI; 583 584 #endif 584 585 } … … 626 627 { 627 628 #ifdef CONFIG_CHECK_FSM_RULES 628 629 casc_fsm_step = TRANSITION; 629 630 #endif 630 631 method_process_list_t::iterator mm; … … 636 637 update (); 637 638 #ifdef CONFIG_CHECK_FSM_RULES 638 639 casc_fsm_step = GEN_MOORE; 639 640 #endif 640 641 for( mm = func_list[1].begin(); mm != func_list[1].end(); ++mm) … … 644 645 } 645 646 #ifdef CONFIG_CHECK_FSM_RULES 646 647 casc_fsm_step = GEN_MEALY; 647 648 #endif 648 649 quasistatic_mealy_generation (); 649 650 #ifdef CONFIG_CHECK_FSM_RULES 650 651 casc_fsm_step = STIMULI; 651 652 #endif 652 653 } -
sources/src/port_dependency.h
r1 r35 22 22 // Port Dependency Graph 23 23 struct PortDependency { 24 25 26 24 const method_process_t *method; 25 const sc_port_base *source; 26 const sc_port_base *destination; 27 27 }; 28 28 typedef std::list<PortDependency> PortDependencyGraph; -
sources/src/process_dependency.h
r1 r35 19 19 // Signal Dependency Graph 20 20 struct ProcessDependency { 21 22 23 21 const method_process_t *source; 22 const method_process_t *destination; 23 bool operator < (const ProcessDependency &) const; 24 24 }; 25 25 -
sources/src/sc_main.cc
r27 r35 187 187 << "modules filename : dump module hierarchy graph into specified dot file (tons of bugs inside)\n" 188 188 << "nobanner: do not print SystemCASS splash screen\n" 189 << " nodynamiclink: do not link dynamicallyscheduling code\n"189 << "dynamiclink: dynamically link the scheduling code\n" 190 190 << "nosim : run until elaboration stage. Don't simulate\n" 191 191 << "notrace : disable all tracing functions\n" … … 226 226 case 'c' : 227 227 print_schedule = true; 228 continue; 229 case 'd' : 230 if (strcmp (argv[i]+2, "dynamiclink") == 0) 231 dynamic_link_of_scheduling_code = true; 232 else 233 check_port_dependencies = true; 228 234 continue; 229 235 case 'e' : … … 279 285 scheduling_method = BUCHMANN_SCHEDULING; 280 286 continue; 281 case 'd' :282 check_port_dependencies = true;283 continue;284 287 default : 285 288 break; -
sources/src/sc_module.cc
r27 r35 139 139 { 140 140 name = nm; 141 141 func = fn; 142 142 module = &mod; 143 143 dont_initialize = false; -
sources/src/sc_module.h
r27 r35 14 14 #define __SC_MODULE_H__ 15 15 16 #include "sc_module_ext.h"17 18 16 #include <list> 19 17 #include <set> 20 18 #include <stack> 19 20 #include "internal.h" 21 21 22 #include "sc_fwd.h" 22 #include " internal.h"23 #include "sc_module_ext.h" 23 24 #include "sc_object.h" 24 25 #include "sc_sensitive.h" … … 56 57 public: const char *name; // function name 57 58 #ifdef DUMP_SCHEDULE_STATS 58 59 long long int number_of_calls; 59 60 #endif 60 61 public: -
sources/src/sc_port.cc
r27 r35 138 138 } 139 139 140 static bool check_multiwriting2port_error_message = 1;140 static bool check_multiwriting2port_error_message = true; 141 141 void 142 142 sc_port_base::check_multiwriting2port () const -
sources/src/sc_port_ext.h
r27 r35 17 17 #include <iostream> 18 18 #include <cstdlib> 19 #include "sc_fwd.h" 20 #i nclude "sc_nbdefs.h"21 //#include "sc_event_finder.h"22 # include "sc_event.h"23 #include "sc_object.h" 24 #include " sc_interface.h"19 20 #ifdef HAVE_CONFIG_H 21 #include "config.h" 22 #endif 23 24 #include "fsm_rules.h" 25 25 #include "internal_ext.h" 26 26 #include "port_dependency_ext.h" 27 #include "fsm_rules.h" 27 #include "sc_event.h" 28 #include "sc_fwd.h" 29 #include "sc_interface.h" 30 #include "sc_nbdefs.h" 31 #include "sc_object.h" 28 32 29 33 … … 45 49 // 46 50 47 51 using namespace sc_dt; 48 52 49 53 const char *get_name (const tab_t *pointer); 50 54 51 55 #define READ_SIGNAL(value_type_,pointer_) \ 52 53 54 56 ((value_type_&) (*((value_type_*) (pointer_)))) 57 58 ///////////////////// DEPRECATED 55 59 // C ANSI-only since it is needed to link with extern "C" 56 60 // this declaration is not in casc.h since the CONFIG_CHECK_FSM_RULES macro … … 74 78 typedef sc_port_base base_type; 75 79 public: 76 77 78 79 80 /////////// 81 // Internal 82 const sc_module &get_module () const; 83 void init (); 80 84 void check_multiwriting2port () const; 81 ///////////85 /////////// 82 86 83 87 friend std::ostream& operator << (std::ostream &, const sc_port_base &); … … 114 118 typedef sc_signal<data_type> signal_type; 115 119 116 117 120 /////////// 121 // Internal 118 122 void init (); 119 120 121 122 123 123 /* 124 public: virtual size_t data_size () const 125 { return sizeof (data_type); } 126 */ 127 /////////// 124 128 public: 125 129 // constructors … … 130 134 explicit sc_in(const base_type& parent_ ): base_type( parent_ ) { init (); } 131 135 132 136 /* 133 137 // LRM error ! 134 138 //static const char *const kind_string; this is a template ! 135 139 */ 136 140 // virtual const char *kind () const 137 141 // { return "sc_in"; }; … … 171 175 sc_in<T>::init() 172 176 { 173 174 177 set_kind (sc_in_string); 178 sc_interface::init (sizeof (data_type)); 175 179 } 176 180 … … 182 186 #ifdef DUMP_READ 183 187 std::cerr << "read " << READ_SIGNAL(const T&, get_pointer()) 184 188 << " on signal " << name () << "\n"; 185 189 #endif 186 190 #ifdef CONFIG_CHECK_FSM_RULES 187 188 189 190 191 192 } 191 if (casc_fsm_step == GEN_MOORE) { 192 std::cerr << "FSM rules error : trying to read on input port '" 193 << name () 194 << "' from " << get_step_name () << " function.\n"; 195 exit (-1); 196 } 193 197 #endif 194 198 return READ_SIGNAL(const T, get_pointer()); … … 212 216 class sc_inout : public sc_port_base 213 217 { 214 215 218 /////////// 219 // Internal 216 220 protected: 217 221 void init (); 218 222 T val; 219 223 private: 220 224 typedef T data_type; … … 223 227 typedef sc_signal<data_type> signal_type; 224 228 225 226 227 228 229 229 /* 230 public: virtual size_t data_size () const 231 { return sizeof (data_type); } 232 */ 233 /////////// 230 234 public: 231 235 // contructeurs … … 234 238 explicit sc_inout(const char* name_): base_type(name_) { init (); }; 235 239 236 240 /* 237 241 // LRM error ! 238 242 //static const char *const kind_string; this is a template ! 239 243 */ 240 244 //virtual const char *kind () const 241 245 //{ return "sc_inout"; }; … … 273 277 sc_inout<T>::init () 274 278 { 275 276 277 279 set_pointer ((tab_t*)(void*)&val); 280 sc_object::set_kind (sc_inout_string); 281 sc_interface::init (sizeof (data_type)); 278 282 /*ref*/ val = (0); 279 283 //sc_inout::write (0); … … 292 296 #ifdef DUMP_READ 293 297 std::cerr << "read " << READ_SIGNAL(const T, get_pointer()) // val 294 298 << " on signal " << name () << "\n"; 295 299 #endif 296 300 #ifdef CONFIG_CHECK_FSM_RULES 297 298 299 300 301 302 } 301 if (casc_fsm_step == GEN_MOORE) { 302 std::cerr << "FSM rules error : trying to read on input/output port " 303 << name () //get_name (get_pointer()) 304 << " from " << get_step_name () << " function.\n"; 305 exit (-1); 306 } 303 307 #endif 304 308 // return val; … … 317 321 #endif 318 322 #ifdef CONFIG_CHECK_FSM_RULES 319 320 321 322 323 324 } 325 #endif 326 // 323 if ((casc_fsm_step != GEN_MOORE) && ( casc_fsm_step != GEN_MEALY)) { 324 std::cerr << "FSM rules error : trying to write on output port " 325 << name () 326 << " from an " << get_step_name () << " function.\n"; 327 exit (-1); 328 } 329 #endif 330 // T& ref = *(T*)(get_pointer()); 327 331 #if defined(CONFIG_CHECK_MULTIWRITING2PORT) 328 332 check_multiwriting2port (); … … 369 373 class sc_out : public sc_inout<T> 370 374 { 371 372 375 /////////// 376 // Internal 373 377 void init (); 374 378 /////////// 375 379 public: 376 380 // typedefs … … 386 390 sc_out (const char *name_, this_type & parent_); 387 391 388 392 /* 389 393 // LRM error ! 390 394 //static const char *const kind_string; this is a template ! 391 395 */ 392 396 //virtual const char *kind () const 393 397 //{ return "sc_out"; }; … … 404 408 { bind (*this,parent_); } 405 409 406 407 410 ////////////////////// 411 // Systemcass specific 408 412 void operator () (sc_port_base &o) 409 413 { set_port_dependency (&o, (sc_port_base&)(*this)); } … … 412 416 { set_port_dependency (NULL, (sc_port_base&)(*this)); } 413 417 */ 414 418 ////////////////////// 415 419 416 420 … … 428 432 { 429 433 sc_inout<T>::init (); 430 // 431 // 432 433 // 434 // tab_t *t = &(sc_inout<T>::val); 435 // sc_interface::set_pointer (t); 436 sc_object::set_kind (sc_out_string); 437 // sc_interface::init (sizeof (data_type)); 434 438 // /*ref*/ sc_inout<T>::val = 0; 435 439 //sc_inout<T>::write (0); -
sources/src/signal_dependency.h
r1 r35 24 24 // Signal Dependency Graph 25 25 struct SignalDependency { 26 27 28 29 30 // 26 const method_process_t *method; 27 const equi_t *source; 28 const equi_t *destination; 29 bool operator < (const SignalDependency &a) const; 30 // friend int operator < (const SignalDependency &a, const SignalDependency &b); 31 31 }; 32 32
Note: See TracChangeset
for help on using the changeset viewer.