Changeset 8 for branches/with_autoconf/src/gen_code.cc
- Timestamp:
- Jun 25, 2008, 1:08:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/with_autoconf/src/gen_code.cc
r1 r8 35 35 */ 36 36 37 #include<stdio.h> 38 #include<stdlib.h> 39 #include<iostream> 40 #include<fstream> 41 42 #include"internal.h" 43 #include"gen_code.h" 44 #include"sc_module.h" 45 #include"sc_ver.h" 46 #include"process_dependency.h" 47 48 #ifdef CHECK_FSM_RULES 49 #define fsm_check_flag "-DCHECK_FSM_RULES" 37 #include <stdio.h> 38 #include <stdlib.h> 39 #include <iostream> 40 #include <fstream> 41 42 #include "internal.h" 43 #include "gen_code.h" 44 #include "sc_module.h" 45 #include "sc_ver.h" 46 #include "process_dependency.h" 47 #ifdef HAVE_CONFIG_H 48 #include "config.h" 49 #endif 50 51 #ifdef CONFIG_CHECK_FSM_RULES 52 #include "fsm_rules.h" 53 #define fsm_check_flag "-DCONFIG_CHECK_FSM_RULES" 50 54 #else 51 55 #define fsm_check_flag 52 56 #endif 53 57 54 #define casc_cflags CFLAGS " " fsm_check_flag 55 56 #if defined(darwin) 57 #define macosx 58 #endif 58 #define casc_cflags GENERATED_MODULE_CFLAGS " " fsm_check_flag 59 59 60 60 using namespace std; … … 86 86 << m.module->name() << "->" << m.name << "()\\n\");\n"; 87 87 o << " p.integer = " << func << ";\n"; 88 #if CPP_CALL88 #ifdef CPP_CALL 89 89 o << " (((sc_module*)(" << m.module << "))->*(p.pmf)) (); /* " 90 90 << m.module->name () << "->" << m.name << "() */\n"; … … 138 138 } 139 139 140 #ifdef DEBUG140 #ifdef CONFIG_DEBUG 141 141 cerr << "opened temporary filename : " << temp << "\n"; 142 142 #endif … … 263 263 264 264 o << "// generated by " << sc_version () << endl 265 << "#include <casc.h>\n\n"266 << "#include <stdio.h>\n\n"267 // << "#include <iostream>\n\n"265 << "#include <casc.h>\n\n" 266 << "#include <stdio.h>\n\n" 267 // << "#include <iostream>\n\n" 268 268 << "namespace sc_core {\n" 269 269 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" … … 324 324 325 325 o << "// generated by " << sc_version () << endl 326 << "#include <casc.h>\n\n"327 << "#include <stdio.h>\n\n"328 // << "#include <iostream>\n\n"326 << "#include <casc.h>\n\n" 327 << "#include <stdio.h>\n\n" 328 // << "#include <iostream>\n\n" 329 329 << "namespace sc_core {\n" 330 330 << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n" … … 372 372 // const char *target_arch = getenv ("TARGET_ARCH"); 373 373 const char *default_compiler = 374 #if CPP_CALL374 #ifdef CPP_CALL 375 375 "g++"; 376 376 #else … … 413 413 /* COMPILE */ 414 414 /* ******* */ 415 #if defined(macosx) 416 sprintf(compil_str, 417 "(cd %s ; %s %s -DSCHEDULING_BY_CASC -I%s/include -fno-common -dynamic -o %s -c %s)", 418 temporary_dir, 419 compiler, 420 casc_cflags, 421 systemc_dir, 422 target_name, 423 source_name); 424 // sprintf(compil_str,""); 425 #elif defined(linux) 426 sprintf(compil_str, 427 "(cd %s ; libtool --mode=compile %s %s -DSCHEDULING_BY_CASC -I%s/include -shared -o %s -c %s)", 428 temporary_dir, 429 compiler, 430 casc_cflags, 431 systemc_dir, 432 target_name, 433 source_name); 415 const char *commandline_template = 416 #if defined(CONFIG_OS_DARWIN) 417 "(cd %s ;" " %s %s -DSCHEDULING_BY_CASC -I%s/include -fno-common -dynamic -o %s -c %s)" 418 #elif defined(CONFIG_OS_LINUX) 419 "(cd %s ; libtool --mode=compile %s %s -DSCHEDULING_BY_CASC -I%s/include -shared -o %s -c %s)" 434 420 #else 435 sprintf(compil_str, 436 "(cd %s ; %s %s -DSCHEDULING_BY_CASC -I%s/include -dynamiclib -o %s -c %s)", 437 temporary_dir, 438 compiler, 439 casc_cflags, 440 systemc_dir, 441 target_name, 442 source_name); 443 #endif 421 "(cd %s ;" " %s %s -DSCHEDULING_BY_CASC -I%s/include -dynamiclib -o %s -c %s)" 422 #endif 423 ; 424 sprintf(compil_str, 425 commandline_template, 426 temporary_dir, 427 compiler, 428 casc_cflags, 429 systemc_dir, 430 target_name, 431 source_name); 444 432 445 433 if (dump_stage) … … 456 444 sprintf (target_name, "%s.so", base_name); 457 445 458 #if defined(linux)446 #ifdef CONFIG_OS_LINUX 459 447 sprintf (source_name, "%s.lo", base_name); 460 448 sprintf(compil_str, "(cd %s ; pwd ; libtool --mode=link %s %s -shared -rdynamic -o %s %s)", /* -L. -L%s/lib-%s */ … … 555 543 for (i = 0; i < n; ++i) 556 544 { 557 #if 0 //defined( DEBUG)545 #if 0 //defined(CONFIG_DEBUG) 558 546 sc_module *m = (sc_module*)(fc.instance[i]); 559 547 cerr << m->name () << endl; … … 570 558 void static_simulate_1_cycle (void) 571 559 { 572 #ifdef C HECK_FSM_RULES560 #ifdef CONFIG_CHECK_FSM_RULES 573 561 casc_fsm_step = TRANSITION; 574 562 #endif 575 563 call_functions (pf[0]); // transition 576 564 update (); 577 #ifdef C HECK_FSM_RULES565 #ifdef CONFIG_CHECK_FSM_RULES 578 566 casc_fsm_step = GEN_MOORE; 579 567 #endif 580 568 call_functions (pf[1]); // moore generation 581 #ifdef C HECK_FSM_RULES569 #ifdef CONFIG_CHECK_FSM_RULES 582 570 casc_fsm_step = GEN_MEALY; 583 571 #endif 584 572 call_functions (pf[2]); // mealy generation 585 #ifdef C HECK_FSM_RULES573 #ifdef CONFIG_CHECK_FSM_RULES 586 574 casc_fsm_step = STIMULI; 587 575 #endif … … 629 617 void quasistatic_simulate_1_cycle (void) 630 618 { 631 #ifdef C HECK_FSM_RULES619 #ifdef CONFIG_CHECK_FSM_RULES 632 620 casc_fsm_step = TRANSITION; 633 621 #endif … … 639 627 } 640 628 update (); 641 #ifdef C HECK_FSM_RULES629 #ifdef CONFIG_CHECK_FSM_RULES 642 630 casc_fsm_step = GEN_MOORE; 643 631 #endif … … 647 635 Call (m); 648 636 } 649 #ifdef C HECK_FSM_RULES637 #ifdef CONFIG_CHECK_FSM_RULES 650 638 casc_fsm_step = GEN_MEALY; 651 639 #endif 652 640 quasistatic_mealy_generation (); 653 #ifdef C HECK_FSM_RULES641 #ifdef CONFIG_CHECK_FSM_RULES 654 642 casc_fsm_step = STIMULI; 655 643 #endif
Note: See TracChangeset
for help on using the changeset viewer.