Changeset 27 for sources/src/gen_code.cc
- Timestamp:
- May 4, 2009, 8:51:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/gen_code.cc
r17 r27 34 34 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 35 35 */ 36 #if ndef _WIN3236 #if defined(__linux__) 37 37 #include <linux/limits.h> 38 #el se38 #elif defined(WIN32) 39 39 #include <windows.h> 40 40 #endif … … 45 45 #include<fstream> 46 46 47 #include"internal.h" 48 #include"gen_code.h" 49 #include"sc_module.h" 50 #include"sc_ver.h" 51 #include"process_dependency.h" 52 53 #ifdef CHECK_FSM_RULES 54 #define fsm_check_flag "-DCHECK_FSM_RULES" 47 #include "internal.h" 48 #include "gen_code.h" 49 #include "sc_module.h" 50 #include "sc_ver.h" 51 #include "process_dependency.h" 52 #ifdef HAVE_CONFIG_H 53 #include "config.h" 54 #endif 55 56 #ifdef CONFIG_CHECK_FSM_RULES 57 #include "fsm_rules.h" 58 #define fsm_check_flag "-DCONFIG_CHECK_FSM_RULES" 55 59 #else 56 60 #define fsm_check_flag 57 61 #endif 58 62 59 #define casc_cflags CFLAGS " " fsm_check_flag 60 61 #if defined(darwin) 62 #define macosx 63 #endif 63 #define casc_cflags GENERATED_MODULE_CFLAGS " " fsm_check_flag 64 65 // Enable CPP call, this is useful for typeinfo-enabled classes 66 #define CPP_CALL 64 67 65 68 using namespace std; … … 91 94 << m.module->name() << "->" << m.name << "()\\n\");\n"; 92 95 o << " p.integer = " << func << ";\n"; 93 #if CPP_CALL96 #ifdef CPP_CALL 94 97 o << " (((sc_module*)(" << m.module << "))->*(p.pmf)) (); /* " 95 98 << m.module->name () << "->" << m.name << "() */\n"; … … 143 146 } 144 147 145 #ifdef DEBUG148 #ifdef CONFIG_DEBUG 146 149 cerr << "opened temporary filename : " << temp << "\n"; 147 150 #endif … … 268 271 269 272 o << "// generated by " << sc_version () << endl 270 << "#include <casc.h>\n\n"271 << "#include <cstdio>\n\n"272 // << "#include <iostream>\n\n"273 << "#include <casc.h>\n\n" 274 << "#include <cstdio>\n\n" 275 // << "#include <iostream>\n\n" 273 276 << "namespace sc_core {\n" 274 277 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" … … 329 332 330 333 o << "// generated by " << sc_version () << endl 331 << "#include <casc.h>\n\n"332 << "#include <cstdio>\n\n"333 // << "#include <iostream>\n\n"334 << "#include <casc.h>\n\n" 335 << "#include <cstdio>\n\n" 336 // << "#include <iostream>\n\n" 334 337 << "namespace sc_core {\n" 335 338 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" … … 377 380 // const char *target_arch = getenv ("TARGET_ARCH"); 378 381 const char *default_compiler = 379 #if CPP_CALL382 #ifdef CPP_CALL 380 383 "g++"; 381 384 #else … … 418 421 /* COMPILE */ 419 422 /* ******* */ 420 #if defined(macosx) 421 sprintf(compil_str, 422 "(cd %s ; %s %s -DSCHEDULING_BY_CASC -I%s/include -fno-common -dynamic -o %s -c %s)", 423 temporary_dir, 424 compiler, 425 casc_cflags, 426 systemc_dir, 427 target_name, 428 source_name); 429 // sprintf(compil_str,""); 430 #elif defined(linux) 431 sprintf(compil_str, 432 "(cd %s ; libtool --mode=compile %s %s -DSCHEDULING_BY_CASC -I%s/include -shared -o %s -c %s)", 433 temporary_dir, 434 compiler, 435 casc_cflags, 436 systemc_dir, 437 target_name, 438 source_name); 423 const char *commandline_template = 424 #if defined(CONFIG_OS_DARWIN) 425 "(cd %s ;" " %s %s -DSCHEDULING_BY_CASC -I%s/include -fno-common -dynamic -o %s -c %s)" 426 #elif defined(CONFIG_OS_LINUX) 427 "(cd %s ; libtool --mode=compile %s %s -DSCHEDULING_BY_CASC -I%s/include -shared -o %s -c %s)" 439 428 #else 440 sprintf(compil_str, 441 "(cd %s ; %s %s -DSCHEDULING_BY_CASC -I%s/include -dynamiclib -o %s -c %s)", 442 temporary_dir, 443 compiler, 444 casc_cflags, 445 systemc_dir, 446 target_name, 447 source_name); 448 #endif 429 "(cd %s ;" " %s %s -DSCHEDULING_BY_CASC -I%s/include -dynamiclib -o %s -c %s)" 430 #endif 431 ; 432 sprintf(compil_str, 433 commandline_template, 434 temporary_dir, 435 compiler, 436 casc_cflags, 437 systemc_dir, 438 target_name, 439 source_name); 449 440 450 441 if (dump_stage) … … 461 452 sprintf (target_name, "%s.so", base_name); 462 453 463 #if defined(linux)454 #ifdef CONFIG_OS_LINUX 464 455 sprintf (source_name, "%s.lo", base_name); 465 456 sprintf(compil_str, "(cd %s ; pwd ; libtool --mode=link %s %s -shared -rdynamic -o %s %s)", /* -L. -L%s/lib-%s */ … … 560 551 for (i = 0; i < n; ++i) 561 552 { 562 #if 0 //defined( DEBUG)553 #if 0 //defined(CONFIG_DEBUG) 563 554 sc_module *m = (sc_module*)(fc.instance[i]); 564 555 cerr << m->name () << endl; … … 575 566 void static_simulate_1_cycle (void) 576 567 { 577 #ifdef C HECK_FSM_RULES568 #ifdef CONFIG_CHECK_FSM_RULES 578 569 casc_fsm_step = TRANSITION; 579 570 #endif 580 571 call_functions (pf[0]); // transition 581 572 update (); 582 #ifdef C HECK_FSM_RULES573 #ifdef CONFIG_CHECK_FSM_RULES 583 574 casc_fsm_step = GEN_MOORE; 584 575 #endif 585 576 call_functions (pf[1]); // moore generation 586 #ifdef C HECK_FSM_RULES577 #ifdef CONFIG_CHECK_FSM_RULES 587 578 casc_fsm_step = GEN_MEALY; 588 579 #endif 589 580 call_functions (pf[2]); // mealy generation 590 #ifdef C HECK_FSM_RULES581 #ifdef CONFIG_CHECK_FSM_RULES 591 582 casc_fsm_step = STIMULI; 592 583 #endif … … 634 625 void quasistatic_simulate_1_cycle (void) 635 626 { 636 #ifdef C HECK_FSM_RULES627 #ifdef CONFIG_CHECK_FSM_RULES 637 628 casc_fsm_step = TRANSITION; 638 629 #endif … … 644 635 } 645 636 update (); 646 #ifdef C HECK_FSM_RULES637 #ifdef CONFIG_CHECK_FSM_RULES 647 638 casc_fsm_step = GEN_MOORE; 648 639 #endif … … 652 643 Call (m); 653 644 } 654 #ifdef C HECK_FSM_RULES645 #ifdef CONFIG_CHECK_FSM_RULES 655 646 casc_fsm_step = GEN_MEALY; 656 647 #endif 657 648 quasistatic_mealy_generation (); 658 #ifdef C HECK_FSM_RULES649 #ifdef CONFIG_CHECK_FSM_RULES 659 650 casc_fsm_step = STIMULI; 660 651 #endif
Note: See TracChangeset
for help on using the changeset viewer.