Ignore:
Timestamp:
Apr 14, 2009, 8:39:12 PM (15 years ago)
Author:
rosiere
Message:

1) Add modelsim simulation systemC
2) Modelsim cosimulation systemC / VHDL is not finish !!!! (cf execute_queue and write_unit)
3) Add multi architecture
5) Add template for comparator, multiplier and divider
6) Change Message
Warning) Various test macro have change, many selftest can't compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Test.h

    r88 r113  
    1616#include "Common/include/ErrorMorpheo.h"
    1717#include "Common/include/ToString.h"
    18 
     18#include "Common/include/Systemc.h"
    1919namespace morpheo {
    2020
     
    2626inline void test_ko_error (void)
    2727{
    28   std::string msg = "Test ko : error in test \""+morpheo::toString(num_test)+"\"";
     28  std::string msg = morpheo::toString(_("Test ko : error in test \"%d\""),num_test);
    2929  throw (morpheo::ErrorMorpheo (msg));
    3030}
     
    3333inline void test_ko (char * file, uint32_t line, T exp1, T exp2)
    3434{
    35   fflush (stdout);
    36   fflush (stderr);
    37 
    38   std::cerr << "[" << num_test << "] : " << STR_KO
    39        << "\tline " << line                      << std::endl
    40        << " * Localisation"                      << std::endl
    41        << "   - File : " << file                 << std::endl
    42        << "   - Line : " << line                 << std::endl
    43        << " * Expression is different"           << std::endl
    44        << "   - exp1 : "+morpheo::toString(exp1) << std::endl
    45        << "   - exp2 : "+morpheo::toString(exp2) << std::endl;
     35  msgError(_("[%d] : %s\n"),num_test,STR_KO);
     36  msgError(_(" * Localisation\n"));
     37  msgError(_("   - File  : %s\n"),file);
     38  msgError(_("   - Line  : %d\n"),line);
     39  msgError(_(" * Expression is different\n"));
     40  msgError(_("   - exp1  : %s\n"),morpheo::toString(exp1).c_str());
     41  msgError(_("   - exp2  : %s\n"),morpheo::toString(exp2).c_str());
    4642
    4743  test_ko_error ();
     
    5046inline void test_ko (char * file, uint32_t line)
    5147{
    52   fflush (stdout);
    53   fflush (stderr);
    54 
    55   std::cerr << "[" << num_test << "] : " << STR_KO
    56        << "\tline " << line                           << std::endl
    57        << " * Localisation"                           << std::endl
    58        << "   - File : " << file                      << std::endl
    59        << "   - Line : " << line                      << std::endl;
     48  msgError(_("[%d] : %s\n"),num_test,STR_KO);
     49  msgError(_(" * Localisation\n"));
     50  msgError(_("   - File  : %s\n"),file);
     51  msgError(_("   - Line  : %d\n"),line);
    6052 
    6153  test_ko_error ();
     
    6456inline void test_ok ()
    6557{
    66   fflush (stdout);
    67   fflush (stderr);
    68 
    69   msg (_("[%d] : %s\n"), num_test,STR_OK);
     58  msgInformation (_("[%d] : %s\n"), num_test,STR_OK);
    7059
    7160  num_test ++;
     
    7463inline void test_ok (char * file, uint32_t line)
    7564{
    76   fflush (stdout);
    77   fflush (stderr);
    78 
    79   msg (_("[%d] : %s\n"), num_test,STR_OK);
    80   msg (_("\tline %d\n"), line);
     65  msgInformation (_("[%d] : %s (line %d)\n"), num_test,STR_OK,line);
     66  msgInformation (_("   - Line  : %d\n"), line);
    8167
    8268  num_test ++;
     
    8672inline void test_ok (char * file, uint32_t line, T exp)
    8773{
    88   fflush (stdout);
    89   fflush (stderr);
    90 
    91   msg (_("[%d] : %s\n"), num_test, STR_OK);
    92   msg (_("\tline %d\n"), line);
    93   msg (_("\tvalue %s\n"), (morpheo::toString(exp)).c_str());
     74  msgInformation (_("[%d] : %s\n"), num_test, STR_OK);
     75  msgInformation (_("   - Line  : %d\n"), line);
     76  msgInformation (_("   - Value : %s\n"), (morpheo::toString(exp)).c_str());
    9477
    9578  num_test ++;
     
    11295#define LABEL(str...)                                                   \
    11396  {                                                                     \
    114     msg (_("{%d} "),static_cast<uint32_t>(sc_simulation_time()));       \
    115     msg (str);                                                          \
    116     msg (_("\n"));                                                      \
    117     fflush (stdout);                                                    \
     97    msgInformation (_("{%.0f} "),simulation_cycle());                \
     98    msg            (str);                                               \
     99    msg            (_("\n"));                                           \
    118100  } while(0)
    119101
     
    122104#endif
    123105
    124 #define SC_START(cycle_offset)                                          \
     106#define SC_CYCLE(cycle_offset)                                          \
    125107  do                                                                    \
    126108    {                                                                   \
    127       /*cout << "SC_START (begin)" << endl;*/                           \
     109      /*cout << "SC_CYCLE (begin)" << endl;*/                           \
    128110                                                                        \
    129       uint32_t cycle_current = static_cast<uint32_t>(sc_simulation_time()); \
     111      double cycle_current = simulation_cycle();                        \
    130112      if (cycle_offset != 0)                                            \
    131113        {                                                               \
    132           cout << "##########[ cycle "<< cycle_current+cycle_offset << " ] (" << __LINE__ << ")" << endl; \
     114          msgInformation(_("##########[ cycle %.0f ] (%d)\n"),cycle_current+cycle_offset,__LINE__); \
    133115        }                                                               \
    134116                                                                        \
     
    138120        }                                                               \
    139121                                                                        \
    140       sc_start(cycle_offset);                                           \
     122      simulation_run(cycle_offset);                                     \
    141123                                                                        \
    142       /*cout << "SC_START (end  )" << endl;*/                           \
     124      /*cout << "SC_CYCLE (end  )" << endl;*/                           \
    143125    } while(0)
    144126
    145 
     127// old support
     128#ifndef MTI_SYSTEMC
     129# define SC_START(x) SC_CYCLE(x)
     130#endif
    146131
    147132};
Note: See TracChangeset for help on using the changeset viewer.