Changeset 35 for sources/src/gen_code.cc


Ignore:
Timestamp:
Jun 29, 2009, 6:03:59 PM (15 years ago)
Author:
buchmann
Message:

Code cleanup.

Add --dynamiclink option to systemcass executable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/src/gen_code.cc

    r31 r35  
    7979ostream& operator << (ostream &o, const SC_ENTRY_FUNC &f)
    8080{
    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";
    8485}
    8586
     
    242243  o << "\nextern void mealy_generation (void)\n{\n";
    243244  o << "  register fct p;\n"
    244           << "\n\n  /* fonctions de mealy */\n";
    245         ProcessDependencyList::iterator it;
    246         for (it = mealy_func_list.begin(); it != mealy_func_list.end(); ++it)
    247         {
    248                 const method_process_t *m = *it;
    249           PrintCall (o, *m);
    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  }
    251252}
    252253
     
    260261    cerr << "Generating C code for scheduling...\n";
    261262
    262         // open temporary file
    263         ofstream o;
     263  // open temporary file
     264  ofstream o;
    264265  char base_name[PATH_MAX];
    265         open_temp (o, base_name);
     266  open_temp (o, base_name);
    266267 
    267         if (! o.good ()) {
     268  if (! o.good ()) {
    268269    perror("scheduling: open file\n");
    269270    exit(-1);
     
    271272
    272273  o << "// generated by " << sc_version () << endl
    273                 << "#include <casc.h>\n\n"
    274                 << "#include <cstdio>\n\n"
    275 //              << "#include <iostream>\n\n"
    276                 << "namespace sc_core {\n"
     274    << "#include <casc.h>\n\n"
     275    << "#include <cstdio>\n\n"
     276//  << "#include <iostream>\n\n"
     277    << "namespace sc_core {\n"
    277278    << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n"
    278                 << " typedef void (*CASC_ENTRY_FUNC)(void *);\n";
     279    << " typedef void (*CASC_ENTRY_FUNC)(void *);\n";
    279280  const char *pmf_type = (sizeof (SC_ENTRY_FUNC) == 4)?
    280281                         // G4 pointer-to-member-function style
     
    286287    << " integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n";
    287288       
    288         gen_transition (o, transition_func_list);       
    289         gen_moore      (o, moore_func_list);   
    290         gen_mealy      (o, strongcomponents);
     289  gen_transition (o, transition_func_list);     
     290  gen_moore      (o, moore_func_list); 
     291  gen_mealy      (o, strongcomponents);
    291292
    292293  o << " \n}\n";
     
    340341    << " typedef union { unsigned long long int integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;\n";
    341342       
    342         gen_transition (o, transition_func_list);       
    343         gen_moore      (o, moore_func_list);   
    344         gen_mealy      (o, mealy_func_list);
     343  gen_transition (o, transition_func_list);     
     344  gen_moore      (o, moore_func_list); 
     345  gen_mealy      (o, mealy_func_list);
    345346
    346347  o << "\n}\n";
     
    567568{
    568569#ifdef CONFIG_CHECK_FSM_RULES
    569         casc_fsm_step = TRANSITION;
     570  casc_fsm_step = TRANSITION;
    570571#endif
    571572  call_functions (pf[0]); // transition
    572573  update     ();
    573574#ifdef CONFIG_CHECK_FSM_RULES
    574         casc_fsm_step = GEN_MOORE;
     575  casc_fsm_step = GEN_MOORE;
    575576#endif
    576577  call_functions (pf[1]); // moore generation
    577578#ifdef CONFIG_CHECK_FSM_RULES
    578         casc_fsm_step = GEN_MEALY;
     579  casc_fsm_step = GEN_MEALY;
    579580#endif
    580581  call_functions (pf[2]); // mealy generation
    581582#ifdef CONFIG_CHECK_FSM_RULES
    582         casc_fsm_step = STIMULI;
     583  casc_fsm_step = STIMULI;
    583584#endif
    584585}
     
    626627{
    627628#ifdef CONFIG_CHECK_FSM_RULES
    628         casc_fsm_step = TRANSITION;
     629  casc_fsm_step = TRANSITION;
    629630#endif
    630631  method_process_list_t::iterator mm;
     
    636637  update     ();
    637638#ifdef CONFIG_CHECK_FSM_RULES
    638         casc_fsm_step = GEN_MOORE;
     639  casc_fsm_step = GEN_MOORE;
    639640#endif
    640641  for( mm = func_list[1].begin(); mm != func_list[1].end(); ++mm)
     
    644645  }
    645646#ifdef CONFIG_CHECK_FSM_RULES
    646         casc_fsm_step = GEN_MEALY;
     647  casc_fsm_step = GEN_MEALY;
    647648#endif
    648649  quasistatic_mealy_generation ();
    649650#ifdef CONFIG_CHECK_FSM_RULES
    650         casc_fsm_step = STIMULI;
     651  casc_fsm_step = STIMULI;
    651652#endif
    652653}
Note: See TracChangeset for help on using the changeset viewer.