Changeset 38 for sources


Ignore:
Timestamp:
Jul 21, 2009, 3:28:11 PM (15 years ago)
Author:
buchmann
Message:

Now detects if SystemCASS correctly handles runtime compilation with the current architecture. SystemCASS exits if runtime compilation is not supported. Use --nodynamiclink options if it exits. This may occur on 64 bits machines.

Usage help is more readable.

Code cleanup.

Add some code for the coming soon openMP feature.

Location:
sources/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sources/src/gen_code.cc

    r36 r38  
    7474typedef void (*CASC_ENTRY_FUNC) (void *);
    7575typedef union { unsigned long long int integer; SC_ENTRY_FUNC pmf; CASC_ENTRY_FUNC pf; } fct;
    76  
     76
     77const char *
     78get_pmf_type ()
     79{
     80  switch (sizeof (SC_ENTRY_FUNC)) {
     81  case 4:
     82    // G4 pointer-to-member-function style
     83    return "unsigned long int";
     84  case 8:
     85    // PC pointer-to-member-function style
     86    return "unsigned long long int";
     87  default:
     88    cerr << "Internal Error : Unsupported pointer-to-member-function"
     89            "(size: " << sizeof (SC_ENTRY_FUNC) << ").\n"
     90            "Please try --nodynamiclink option.\n";
     91    exit(21072009);
     92  };
     93}
    7794
    7895static
     
    278295    << " typedef void (sc_module::*SC_ENTRY_FUNC)();\n"
    279296    << " typedef void (*CASC_ENTRY_FUNC)(void *);\n";
    280   const char *pmf_type = (sizeof (SC_ENTRY_FUNC) == 4)?
    281                          // G4 pointer-to-member-function style
    282                          "unsigned long int":
    283                          // PC pointer-to-member-function style
    284                          "unsigned long long int";
     297
     298  const char *pmf_type = get_pmf_type ();
     299
    285300  o << " typedef union { "
    286301    << pmf_type
     
    375390{
    376391  if (dump_stage)
    377     cerr << "Compiling C code for scheduling...\n";
     392    cerr << "Compiling C/C++ code for scheduling...\n";
    378393  char compil_str[512];
    379   const char *compiler = getenv ("GCC");
     394  const char *compiler = getenv ("CXX");
    380395  const char *systemc_dir = getenv ("SYSTEMCASS");
    381396//  const char *target_arch = getenv ("TARGET_ARCH");
     
    431446#endif
    432447          ;
     448
     449  string cflags = casc_cflags;
     450  if (use_openmp)
     451    cflags += " -fopenmp";
     452
    433453  sprintf(compil_str,
    434454                  commandline_template,
    435455                  temporary_dir,
    436456                  compiler,
    437                   casc_cflags,
     457                  cflags.c_str(),
    438458                  systemc_dir,
    439459                  target_name,
  • sources/src/internal.h

    r12 r38  
    5858extern int         scheduling_method;
    5959extern bool        use_port_dependency;
     60extern bool        use_openmp;
    6061
    6162#define NO_SCHEDULING          0
  • sources/src/sc_main.cc

    r35 r38  
    8787bool        use_port_dependency     = false;
    8888
     89#ifdef _OPENMP
     90bool        use_openmp              = true;
     91#else
     92bool        use_openmp              = false;
     93#endif
     94
     95const char *HELP_STRING = \
     96"\n"
     97"--a\n"
     98"       almost static scheduling (use sensitivity list instead of port\n"
     99"       dependency information\n"
     100"\n"
     101"--c\n"
     102"       print schedule at simulation time (stderr)\n"
     103"\n"
     104"--d\n"
     105"       check port dependencies (stderr)\n"
     106"\n"
     107"--edit\n"
     108"       edit schedule before simulation (run $EDITOR or vim by default)\n"
     109"\n"
     110"--f\n"
     111"       print function list (stderr)\n"
     112"\n"
     113"--h\n"
     114"       display help screen and exit (stdout)\n"
     115"\n"
     116"--i\n"
     117"       print instances list, signals list and statistics if available (stderr)\n"
     118"\n"
     119"--k\n"   
     120"       dump generated scheduling code\n"
     121"       (generated_by_systemcass/scheduling-xx.cc)\n"
     122"\n"
     123"--m\n"
     124"       Mouchard's static scheduling (use port dependency information instead\n"
     125"       of sensitivity list)\n"
     126"\n"
     127"--modules <filename>\n"
     128"       dump module hierarchy graph into specified dot file (tons of bugs\n"
     129"       inside)\n"
     130"\n"
     131"--nobanner\n"
     132"       do not print SystemCASS splash screen\n"
     133"\n"
     134"--dynamiclink\n"
     135"       dynamically link the scheduling code\n"
     136"\n"
     137"--nosim\n"
     138"       run until elaboration stage. Don't simulate\n"
     139"\n"
     140"--notrace\n"
     141"       disable all tracing functions\n"
     142"\n"
     143"--p\n"
     144"       entirely static scheduling (use port dependency information instead of\n"
     145"       sensitivity list)\n"
     146"\n"
     147"--s\n"
     148"       print stage (stderr)\n"
     149"\n"
     150"--save_on_exit <name>\n"
     151"       save simulation state saved into <name> file when SystemCASS exits\n"
     152"       (SOCVIEW format)\n"
     153"\n"
     154            /* WARNING : we can't avoid destructors execution before saving */
     155"--t\n"
     156"       dump either module graph, or signal dependency graph, signal order,\n"
     157"       and module evalutation order into dot files\n"
     158"\n"
     159"--tracestart <n>\n"
     160"       start tracing functions at #n cycle\n"
     161"\n"
     162"--usage\n"
     163"       print user time elapsed (sec), simulation cycles done (cycles),\n"
     164"       and simulator performance (cycles/second) (stderr)\n"
     165"\n"
     166"--v\n"
     167"       print internal SystemCASS kernel options (stderr)\n"
     168"\n";
     169
     170
    89171static
    90172void
     
    93175  // Display once
    94176  if (nobanner == false)
    95         cerr << get_splash_screen ();
     177    cerr << get_splash_screen ();
    96178  nobanner = true;
    97179}
     
    173255            print_splash_screen ();
    174256            cerr << "Usage : "
    175                  << argv[0] << " [--c] [--edit] [--d] [--f] [--h] [--i] [--k] [--modules filename] [--nobanner] [--nodynamiclink] [--nosim] [--notrace] [--s] [--t] [--tracestart n] [--usage] [--v] [--p|m|a] [others parameters processed by sc_main]\n"
     257                 << argv[0] << " [--c] [--edit] [--d] [--f] [--h] [--i] [--k] [--modules filename] [--nobanner] [--[no]dynamiclink] [--nosim] [--notrace] [--s] [--t] [--tracestart n] [--usage] [--v] [--p|m|a] [others parameters processed by sc_main]\n"
    176258                 << "Thoses options are processed by SystemCASS library. All the remaining options are passed to sc_main.\n"
    177259                 << "sc_main function retrieves last parameters.\n"
    178                  << "a       : almost static scheduling (use sensitivity list instead of port dependency information)\n"
    179                  << "c       : print schedule at simulation time (stderr)\n"
    180                  << "d       : check port dependencies (stderr)\n"
    181                  << "edit    : edit schedule before simulation (run $EDITOR or vim by default)\n"
    182                  << "f       : print function list (stderr)\n"
    183                  << "h       : display help screen and exit (stdout)\n"
    184                  << "i       : print instances list, signals list and statistics if available (stderr)\n"
    185                  << "k       : dump generated scheduling code (generated_by_systemcass/scheduling-xx.cc)\n"
    186                  << "m       : Mouchard's static scheduling (use port dependency information instead of sensitivity list)\n"
    187                  << "modules filename : dump module hierarchy graph into specified dot file (tons of bugs inside)\n"
    188                  << "nobanner: do not print SystemCASS splash screen\n"
    189                  << "dynamiclink: dynamically link the scheduling code\n"
    190                  << "nosim   : run until elaboration stage. Don't simulate\n"
    191                  << "notrace : disable all tracing functions\n"
    192                  << "p       : entirely static scheduling (use port dependency information instead of sensitivity list)\n"
    193                  << "s       : print stage (stderr)\n"
    194                  << "save_on_exit <name> : save simulation state saved into <name> file when SystemCASS exits (SOCVIEW format)\n"
    195             /* WARNING : we can't avoid destructors execution before saving */
    196                  << "t       : dump either module graph, or signal dependency graph, signal order, and module evalutation order into dot files\n"
    197                  << "tracestart n : start tracing functions at #n cycle\n"
    198                  << "usage   : print user time elapsed (sec), simulation cycles done (cycles), and simulator performance (cycles/second) (stderr)\n"
    199                  << "v       : print internal SystemCASS kernel options (stderr)\n";
     260                 << HELP_STRING;
    200261            noinitialization = true;
    201262            nosimulation = true;
     
    227288            print_schedule = true;
    228289            continue;
    229           case 'd' :
     290          case 'd' :
    230291            if (strcmp (argv[i]+2, "dynamiclink") == 0)
    231292              dynamic_link_of_scheduling_code = true;
    232             else
     293            else
    233294              check_port_dependencies = true;
    234295            continue;
     
    321382  print_splash_screen ();
    322383  check_parameters ();
     384
    323385  if (noinitialization)
    324386  {
    325387    return 255;
    326388  }
     389
    327390  int ret = sc_main(argc, argv);
    328         free (pending_write_vector);
     391  free (pending_write_vector);
    329392  close_systemcass ();
     393
    330394  if (have_to_stop)
    331395  {
     
    333397    return 1;
    334398  }
     399
    335400  return ret;
    336401}
  • sources/src/sc_ver.cc

    r27 r38  
    7474        "            E-mail support:  Richard.Buchmann@asim.lip6.fr\n"
    7575        "            Contributors : Richard Buchmann, Sami Taktak,\n"
    76   "                           Paul-Jerome Kingbo, Frédéric Pétrot,\n"
     76  "                           Paul-Jerome Kingbo, Frederic Pétrot,\n"
    7777  "                           Nicolas Pouillon\n"
    7878        "\n"
  • sources/src/schedulers.cc

    r33 r38  
    201201  }
    202202
    203         SignalDependencyGraph* sig_graph = MakeSignalDependencyGraph ();
     203  SignalDependencyGraph* sig_graph = MakeSignalDependencyGraph ();
    204204
    205205  if (dump_all_graph)
    206206    SignalDependencyGraph2dot ("signal_graph",*sig_graph);
    207207
    208         if (!Check (*sig_graph))
    209         {
    210                 cerr << "The signal dependency graph is not valid.\n";
     208  if (!Check (*sig_graph))
     209  {
     210    cerr << "The signal dependency graph is not valid.\n";
    211211    exit (29092004);
    212         }
     212  }
    213213
    214214#if 1
     
    219219  }
    220220#endif
    221        
    222         // There is a cycle in the signal dependency graph ?
     221 
     222  // There is a cycle in the signal dependency graph ?
    223223  Graph *sig_knuth = makegraph (*sig_graph);
    224         strong_component_list_t *s = strong_component(sig_knuth);
     224  strong_component_list_t *s = strong_component(sig_knuth);
    225225
    226226  if (dump_all_graph)
    227227    SignalDependencyOrder2txt ("signal_order",*s);
    228228
    229         if (has_cycle (*s))
    230         {
    231                 cerr << "Error : There is a cycle in the signal dependency graph.\n";
     229  if (has_cycle (*s))
     230  {
     231    cerr << "Error : There is a cycle in the signal dependency graph.\n";
    232232#if 0
    233233    print_cycle (cerr, get_cycle (*s));
    234234#endif
    235235    exit (24092004);
    236         }
     236  }
    237237  return sig_graph;
    238238}
     
    249249
    250250  if (dump_all_graph)
    251         ProcessDependencyList2dot  ("process_order",*process_list);
    252 
    253         return process_list;
     251    ProcessDependencyList2dot  ("process_order",*process_list);
     252
     253  return process_list;
    254254}
    255255
     
    260260  SignalDependencyGraph *sig_graph = MakeAcyclicSignalDependencyGraph ();
    261261  // Create the process evaluation list
    262         ProcessDependencyList* process_list = MakeProcessDependencyList (*sig_graph);
     262  ProcessDependencyList* process_list = MakeProcessDependencyList (*sig_graph);
    263263
    264264  if (dump_all_graph)
    265         ProcessDependencyList2dot  ("process_order",*process_list);
    266 
    267         return process_list;
     265    ProcessDependencyList2dot  ("process_order",*process_list);
     266
     267  return process_list;
    268268}
    269269
     
    290290    // Uses port dependancies like Dr. Mouchard.
    291291    ProcessDependencyList* process_list = BuchmannScheduling ();
    292         if (dynamic_link_of_scheduling_code)
    293                 base_name = gen_scheduling_code_for_dynamic_link (transition_func_list, moore_func_list,*process_list);
    294         else
    295                 gen_scheduling_code_for_static_func (transition_func_list, moore_func_list, *process_list);
     292  if (dynamic_link_of_scheduling_code)
     293    base_name = gen_scheduling_code_for_dynamic_link (transition_func_list, moore_func_list,*process_list);
     294  else
     295    gen_scheduling_code_for_static_func (transition_func_list, moore_func_list, *process_list);
    296296    break;
    297297  }
     
    303303    // and does not use an event-driven scheduler.
    304304    ProcessDependencyList* process_list = MouchardScheduling ();
    305         if (dynamic_link_of_scheduling_code)
    306                 base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list,*process_list);
    307         else
    308                 gen_scheduling_code_for_static_func (transition_func_list, moore_func_list, *process_list);
     305  if (dynamic_link_of_scheduling_code)
     306    base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list,*process_list);
     307  else
     308    gen_scheduling_code_for_static_func (transition_func_list, moore_func_list, *process_list);
    309309    break;
    310310  }
     
    317317      graph2dot("module_graph", *g);
    318318    strong_component_list_t *strong_list = strong_component (g);
    319         if (dynamic_link_of_scheduling_code)
    320                 base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list,*strong_list);
    321         else
    322                 gen_scheduling_code_for_quasistatic_func (transition_func_list, moore_func_list, *strong_list);
     319  if (dynamic_link_of_scheduling_code)
     320    base_name = gen_scheduling_code_for_dynamic_link(transition_func_list, moore_func_list,*strong_list);
     321  else
     322    gen_scheduling_code_for_quasistatic_func (transition_func_list, moore_func_list, *strong_list);
    323323    break;
    324324  }
Note: See TracChangeset for help on using the changeset viewer.