Changeset 38 for sources/src/gen_code.cc


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.

File:
1 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,
Note: See TracChangeset for help on using the changeset viewer.