Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (16 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/src
Files:
11 added
2 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_generate_file.cpp

    r81 r88  
    88
    99#include "Behavioural/include/Component.h"
     10#include "Common/include/Environment.h"
    1011
    1112namespace morpheo              {
    1213namespace behavioural          {
    1314
     15#undef  FUNCTION
     16#define FUNCTION "Component::generate_file"
    1417  void Component::generate_file (void)
    1518  {
     
    1821    try
    1922      {
     23        directory();
     24
    2025        XML xml = toXML();
    2126
    22         xml.filename_extension ("pos");
     27        xml.filename_extension (".pos");
    2328       
    24         xml.generate_file("ISO-8859-1");
     29        xml.generate_file(MORPHEO_POSITION,"ISO-8859-1");
    2530
    2631      }
    2732    catch (ErrorMorpheo e)
    2833      {
    29         throw (ErrorMorpheo ("Component \""+_entity->get_name()+"\" have a bad mapping : "+e.what()));
     34        throw ERRORMORPHEO(FUNCTION,toString(_("Component \"%s\" have a bad mapping : %s\n")),_entity->get_name().c_str(),e.what().c_str());
    3035      }
    3136
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_port_map.cpp

    r82 r88  
    2020    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    2121
    22 //     log_printf(NONE,Behavioural,FUNCTION,"Map %s.%s with %s.%s",
     22//     log_printf(INFO,Behavioural,FUNCTION,"Map %s.%s with %s.%s",
    2323//             component_src.c_str(),
    2424//             port_src.c_str(),
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_test_map.cpp

    r82 r88  
    1515  bool Component::test_map (bool recursive)
    1616  {
    17     log_printf(NONE,Behavioural,FUNCTION, "Test port map and interface.");
     17    log_printf(INFO,Behavioural,FUNCTION, "Test port map and interface.");
    1818    return test_map (0, recursive);
    1919  }
     
    2323    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    2424
    25     std::string tab  = std::string(depth,'\t');
     25    std::string tab  = std::string(depth,' ');
    2626    std::string name = _entity->get_name();
    2727    bool test_ok = true;
     
    3030    if (is_behavioural)
    3131      {
    32         log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str());
     32        log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str());
    3333      }
    3434    else
    3535      {
    36         log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str());
     36        log_printf(INFO,Interface,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str());
    3737      }
    3838
    3939   
    40     //  log_printf(NONE,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str());
     40    //  log_printf(INFO,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str());
    4141   
    4242    test_ok &= _entity->test_map(depth+1,true,is_behavioural);
    4343   
    44     //  log_printf(NONE,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str());
     44    //  log_printf(INFO,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str());
    4545       
    4646    for (std::list<Tcomponent_t *>::iterator i= _list_component->begin();
     
    7272//   bool Component::test_equi (bool recursive)
    7373//   {
    74 //     log_printf(NONE,Behavioural,FUNCTION, "Test port equi and interface.");
     74//     log_printf(INFO,Behavioural,FUNCTION, "Test port equi and interface.");
    7575//     return test_equi (0, recursive);
    7676//   }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_test_map.cpp

    r82 r88  
    1818    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    1919 
    20     std::string tab  = std::string(depth,'\t');
    21     log_printf(NONE,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str());
     20    std::string tab  = std::string(depth,' ');
     21    log_printf(INFO,Interface,FUNCTION,"%s* Entity \"%s\"",tab.c_str(),_name.c_str());
    2222 
    2323    bool _return = _interfaces->test_map(depth+1,top_level, is_behavioural);
     
    4242 
    4343//     std::string tab  = std::string(depth,'\t');
    44 //     log_printf(NONE,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str());
     44//     log_printf(INFO,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str());
    4545 
    4646//     bool _return = _interfaces->test_equi(depth+1);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_test.cpp

    r81 r88  
    1313
    1414  std::string Interface_fifo::testbench_test (Vhdl * & vhdl,
    15                                         std::string   counter_name,
    16                                         std::string   reset_name  )
     15                                              std::string   counter_name,
     16                                              std::string   reset_name  )
    1717  {
    1818    log_printf(FUNC,Behavioural,"testbench_test","Begin");
     
    2727        vhdl->set_body("");
    2828
    29                test_name        = testbench_test_name        (vhdl);
     29                    test_name        = testbench_test_name        (vhdl);
    3030        std::string test_name_tmp    = test_name+"_tmp";
    3131        std::string test_name_ok     = testbench_test_ok          (vhdl);
     
    5454        vhdl->set_body(test_name + " <= '1' when ("+reset_name+" = '0') else "+test_name_tmp+";");
    5555
    56 #ifdef VHDL_TESTBENCH_ASSERT
    57         if (_list_cycle->empty()== false)
    58           {
    59             vhdl->set_body("");
    60             vhdl->set_body("-- Assert ...");
    61             vhdl->set_body("");
     56// #ifdef VHDL_TESTBENCH_ASSERT
     57//      if (_list_cycle->empty()== false)
     58//        {
     59//          vhdl->set_body("");
     60//          vhdl->set_body("-- Assert ...");
     61//          vhdl->set_body("");
    6262
    63             uint32_t                 j = 0;
    64             std::list<uint32_t>::iterator i = _list_cycle->begin();
     63//          uint32_t                 j = 0;
     64//          std::list<uint32_t>::iterator i = _list_cycle->begin();
    6565           
    66             while (i != _list_cycle->end())
    67               {
    68                 vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '1')) report \"***** <"+_name+"> Test number "+toString(j)+" is OK     *****\" severity NOTE;");
    69                 vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '0')) report \"@@@@@ <"+_name+"> Test number "+toString(j)+" is KO !!! @@@@@\" severity NOTE;");
    70                 j++;
    71                 ++i;
    72               }
     66//          while (i != _list_cycle->end())
     67//            {
     68//              vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '1')) report \"***** <"+_name+"> Test number "+toString(j)+" is OK     *****\" severity NOTE;");
     69//              vhdl->set_body("assert not (("+counter_name+" = "+toString(*i)+" and "+test_name+" = '0')) report \"@@@@@ <"+_name+"> Test number "+toString(j)+" is KO !!! @@@@@\" severity NOTE;");
     70//              j++;
     71//              ++i;
     72//            }
    7373
    74             vhdl->set_body("");
    75           }
    76 #endif
     74//          vhdl->set_body("");
     75//        }
     76// #endif
    7777      }
    7878
     
    8080
    8181    return test_name;
    82 
    8382  };
    8483
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_set_signal.cpp

    r81 r88  
    1111namespace behavioural          {
    1212
    13   Signal * Interface::set_signal (std::string          name     ,
     13  Signal * Interface::set_signal (std::string     name     ,
    1414                                  direction_t     direction,
    1515                                  uint32_t        size     ,
     
    1919
    2020    std::string signame = signal_name(_name, name, direction);
    21 
     21   
    2222    Signal * sig = new Signal       (signame, direction, size, presence_port);
    2323
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_test_map.cpp

    r82 r88  
    1818    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    1919
    20     std::string tab  = std::string(depth,'\t');
     20    std::string tab  = std::string(depth,' ');
    2121    bool _return = true;
    2222
    23     log_printf(NONE,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());
     23    log_printf(INFO,Interface,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());
    2424   
    2525    for (std::list<Signal*>::iterator i  = _list_signal->begin();
     
    4242//     bool _return = true;
    4343
    44 //     log_printf(NONE,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());
     44//     log_printf(INFO,Behavioural,FUNCTION, "%s* Interface \"%s\"",tab.c_str(),_name.c_str());
    4545   
    4646//     for (std::list<Signal*>::iterator i  = _list_signal->begin();
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_test_map.cpp

    r82 r88  
    1818    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    1919
    20     std::string tab  = std::string(depth,'\t');
     20    std::string tab  = std::string(depth,' ');
    2121
    2222    bool _return = true;
    2323
    24     log_printf(NONE,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());
     24    log_printf(INFO,Interface,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());
    2525   
    2626    for (std::list<Interface_fifo*>::iterator i  = _list_interface->begin();
     
    4444//     bool _return = true;
    4545
    46 //     log_printf(NONE,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());
     46//     log_printf(INFO,Behavioural,FUNCTION, "%s* Interfaces \"%s\"",tab.c_str(),_name.c_str());
    4747   
    4848//     for (std::list<Interface_fifo*>::iterator i  = _list_interface->begin();
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_testbench_generate_file.cpp

    r81 r88  
    1717    log_printf(FUNC,Behavioural,"generate_file","Begin");
    1818
    19     Vhdl   * vhdl        = new Vhdl(_name+"_Testbench");
    20     std::string   counter     = "counter";
    21     Signal * clock       = this->get_clock();
    22     Signal * reset       = this->get_reset();
    23     std::string   clock_name  = clock->get_name();
    24     std::string   reset_name  = reset->get_name();
    25     uint32_t cycle       = this->get_cycle();
     19    Vhdl   *    vhdl        = new Vhdl(_name+"_Testbench");
     20    std::string counter     = "counter";
     21    Signal *    clock       = this->get_clock();
     22    Signal *    reset       = this->get_reset();
     23    std::string clock_name  = clock->get_name();
     24    std::string reset_name  = reset->get_name();
     25    uint32_t    cycle       = this->get_cycle();
    2626
    2727    vhdl->set_signal    (clock_name, 1, 0);
     
    8787    vhdl->set_body("\t\t\t"+counter+" <= "+counter+"+1;");
    8888    vhdl->set_body("");
    89     vhdl->set_body("\t\t\tassert not ("+counter+" >= "+toString(cycle)+") report \"Test OK\" severity FAILURE;");
    90     vhdl->set_body("\t\t\tassert not ("+test_name+" = '0') report \"Test KO\" severity FAILURE;");
    91 
    9289#ifdef VHDL_TESTBENCH_ASSERT
    93     vhdl->set_body("\t\t\t-- Assert ...");
    9490    for (uint32_t cpt=0; cpt<=cycle; cpt++)
    9591      vhdl->set_body("\t\t\tassert not ("+counter+" = "+toString(cpt)+") report \"===== Test number "+toString(cpt)+" =====\" severity NOTE;");
     92
     93    for (std::list<Interface_fifo*>::iterator it=_list_interface->begin();
     94         it!=_list_interface->end();
     95         ++it)
     96      {
     97        Vhdl * vhdl_assert = new Vhdl("");
     98
     99        (*it)->testbench_assert (vhdl_assert,counter);
     100
     101        vhdl->set_body(vhdl_assert);
     102       
     103        delete vhdl_assert;
     104      }
    96105#endif
    97106
    98107    vhdl->set_body("");
     108    vhdl->set_body("\t\t\tassert not ("+counter+" >= "+toString(cycle)+") report \"Test OK\" severity FAILURE;");
     109    vhdl->set_body("\t\t\tassert not ("+test_name+" = '0') report \"Test KO\" severity FAILURE;");
    99110    vhdl->set_body("\t\tend if;");
    100111    vhdl->set_body("\tend if;");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Parameters_test.cpp

    r82 r88  
    2323
    2424    if (x.have_error())
    25       throw (ErrorMorpheo ("Error(s) in parameters"));
     25      throw ERRORMORPHEO (FUNCTION,_("Error(s) in parameters\n"));
    2626
    2727    log_printf(FUNC,Behavioural,FUNCTION,"End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/SPR_access_mode_implement_group.cpp

    r81 r88  
    2828            for (uint32_t i=16; i<=18; i++)
    2929            _spr_generic [GROUP_SYSTEM_AND_CONTROL ][   i]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE;
     30            _spr_generic [GROUP_SYSTEM_AND_CONTROL ][  19]._user_access_mode       = SPR_ACCESS_MODE_READ_ONLY;
     31            _spr_generic [GROUP_SYSTEM_AND_CONTROL ][  19]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE;
    3032            _spr_generic [GROUP_SYSTEM_AND_CONTROL ][  20]._user_access_mode       = SPR_ACCESS_MODE_READ_ONLY_COND;
    3133            _spr_generic [GROUP_SYSTEM_AND_CONTROL ][  20]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE;
     
    7779
    7880            _spr_generic [GROUP_DCACHE             ][   0]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE;
    79             for (uint32_t i=0; i<=5; i++)
     81            for (uint32_t i=1; i<=5; i++)
    8082                {
    8183            _spr_generic [GROUP_DCACHE             ][   i]._supervisor_access_mode = SPR_ACCESS_MODE_WRITE_ONLY;
     
    9193
    9294            _spr_generic [GROUP_ICACHE             ][   0]._supervisor_access_mode = SPR_ACCESS_MODE_READ_WRITE;
    93             for (uint32_t i=0; i<=3; i++)
     95            for (uint32_t i=1; i<=3; i++)
    9496                {
    9597            _spr_generic [GROUP_ICACHE             ][   i]._supervisor_access_mode = SPR_ACCESS_MODE_WRITE_ONLY;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/SPR_access_mode_read_write.cpp

    r81 r88  
    11#include "Behavioural/include/SPR_access_mode.h"
     2
     3#include "Common/include/Debug.h"
    24
    35namespace morpheo {
     
    1416  bool SPR_access_mode::read (spr_address_t address, Tcontrol_t SM, Tcontrol_t SUMRA)
    1517    {
    16       if (not valid(address))
     18//       log_printf(TRACE,true,"SPR_access_mode::read","address [%d][%d]",address._group,address._register);
     19//       log_printf(TRACE,true,"SPR_access_mode::read","sm        : %d",SM   );
     20//       log_printf(TRACE,true,"SPR_access_mode::read","sumra     : %d",SUMRA);
     21
     22      if (not exist(address))
    1723        return false;
    1824
    1925      spr_access_mode_t mode = _spr_generic [address._group][address._register];
     26
     27//       log_printf(TRACE,true,"SPR_access_mode::read","kernel    : %d",(int)mode._supervisor_access_mode);
     28//       log_printf(TRACE,true,"SPR_access_mode::read","user      : %d",(int)mode._supervisor_access_mode);
    2029
    2130      return (((SM == 1) and ( (mode._supervisor_access_mode == SPR_ACCESS_MODE_READ_ONLY     ) or
     
    2837  bool SPR_access_mode::write(spr_address_t address, Tcontrol_t SM, Tcontrol_t SUMRA)
    2938    {
    30       if (not valid(address))
     39      if (not exist(address))
    3140        return false;
    3241
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp

    r82 r88  
    5151//     if (destination_have_multi_producer)
    5252// //       throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : destination have multi producer."));
    53 //       log_printf(NONE,Behavioural,FUNCTION,"Signal \"%s\" can't been linked with signal \"%s\" : destination have multi producer.",_name.c_str(),signal_dest->get_name().c_str());
     53//       log_printf(INFO,Behavioural,FUNCTION,"Signal \"%s\" can't been linked with signal \"%s\" : destination have multi producer.",_name.c_str(),signal_dest->get_name().c_str());
    5454
    5555    // update info source
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_test_map.cpp

    r82 r88  
    1919
    2020    std::string str     = "";
    21     std::string tab     = std::string(depth,'\t');
     21    std::string tab     = std::string(depth,' ');
    2222    bool        _return = true;
    2323
    24 //     log_printf(NONE,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str());
    25 //     log_printf(NONE,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(),
     24//     log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\"",tab.c_str(),_name.c_str());
     25//     log_printf(INFO,Behavioural,FUNCTION, "%s%d - %d - %d",tab.c_str(),
    2626//             _is_map_as_toplevel_dest,
    2727//             _is_map_as_component_src,
    2828//             _is_map_as_component_dest);
    29 //     log_printf(NONE,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(),
     29//     log_printf(INFO,Behavioural,FUNCTION, "%stop_level %d, is_behavioural %d",tab.c_str(),
    3030//             top_level,
    3131//             is_behavioural);
     
    143143    if (_return == false)
    144144      {
    145         log_printf(NONE,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
    146        
    147145#ifndef DEBUG
    148146        std::cerr << str << std::endl;
     147#else
     148        log_printf(INFO,Interface,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
    149149#endif
    150150      }
    151151    else
    152152      {
    153 //      log_printf(NONE,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
     153//      log_printf(INFO,Interface,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
    154154      }
    155155
     
    173173//     if (_return == false)
    174174//       {
    175 //      log_printf(NONE,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
     175//      log_printf(INFO,Behavioural,FUNCTION, "%s* %s",tab.c_str(),str.c_str());
    176176       
    177177// #ifndef DEBUG
     
    181181//     else
    182182//       {
    183 // //   log_printf(NONE,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
     183// //   log_printf(INFO,Behavioural,FUNCTION, "%s* Signal \"%s\" is OK.",tab.c_str(),_name.c_str());
    184184//       }
    185185   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_binary_tree.cpp

    r81 r88  
    2121  Stat_binary_tree:: Stat_binary_tree (counter_t   cst)
    2222  {
    23     _root  = NULL;
    24     _left  = NULL;
    25     _right = NULL;
     23    _root      = NULL;
     24    _left      = NULL;
     25    _right     = NULL;
     26    _data_type = NONE;
    2627
    27     data_t data;
    28     data.cst = cst;
    29     _data_type   = CONSTANT;
    30     _data        = data;
    31 
    32 //     Stat_binary_tree(CONSTANT, data);
     28    change_type (cst);
    3329  }
    3430 
    3531  Stat_binary_tree:: Stat_binary_tree (counter_t * var)
    3632  {
    37     _root  = NULL;
    38     _left  = NULL;
    39     _right = NULL;
     33    _root      = NULL;
     34    _left      = NULL;
     35    _right     = NULL;
     36    _data_type = NONE;
    4037
    41     data_t data;
    42     data.var   = var;
    43     _data_type = VARIABLE;
    44     _data      = data;
    45 
    46 //     Stat_binary_tree(VARIABLE, data);
     38    change_type (var);
    4739  }
    4840
    4941  Stat_binary_tree:: Stat_binary_tree (operator_t  op)
    5042  {
    51     _root  = NULL;
    52     _left  = NULL;
    53     _right = NULL;
     43    _root      = NULL;
     44    _left      = NULL;
     45    _right     = NULL;
     46    _data_type = NONE;
    5447
    55     data_t data;
    56     data.op    = op;
    57     _data_type = ((op == inc) or (op == dec))?OPERATOR_UNARY:OPERATOR_BINARY;
    58     _data      = data;
     48    change_type (op);
     49  }
    5950
     51  Stat_binary_tree:: Stat_binary_tree (std::string expr,
     52                                       std::map<std::string, counter_t*> * operand)
     53  {
     54    _root      = NULL;
     55    _left      = NULL;
     56    _right     = NULL;
     57    _data_type = NONE;
     58
     59    import (expr, operand);
    6060  }
    6161
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_binary_tree_valid.cpp

    r81 r88  
    44namespace morpheo {
    55namespace behavioural {
     6
    67  bool Stat_binary_tree::valid (void)
    78  {
     9    if (_data_type == NONE)
     10      return false;
     11
    812    if ((_data_type == VARIABLE) or
    913        (_data_type == CONSTANT))
    1014      return ((_left  == NULL) and
    11               (_right == NULL) );
    12 
     15              (_right == NULL) );
     16   
    1317    if (_data_type == OPERATOR_UNARY)
    1418      return ((_right == NULL) and
    15               (_left  != NULL) and
    16               (_left->valid()));
     19              (_left  != NULL) and
     20              (_left->valid()));
    1721
    1822    if (_data_type == OPERATOR_BINARY)
    1923      return ((_left  != NULL ) and
    20               (_left ->valid()) and
    21               (_right != NULL ) and
    22               (_right->valid()));
     24              (_left ->valid()) and
     25              (_right != NULL ) and
     26              (_right->valid()));
    2327
    2428    return false;
    2529  }
     30
     31  void Stat_binary_tree::print (uint32_t depth)
     32  {
     33    std::string tab = std::string(depth,'\t');
     34    std::string sep = " ";
     35    if (_data_type == NONE)
     36      {
     37        std::cout << tab << "<node> NONE (error)" << std::endl;
     38
     39        if (_left  != NULL)
     40          _left ->print(depth+1);
     41        if (_right != NULL)
     42          _right->print(depth+1);
     43      }
     44
     45    if ((_data_type == VARIABLE) or
     46        (_data_type == CONSTANT))
     47      {
     48        std::cout << tab << "<leaf>"
     49                  << " "
     50                  << ((_left   == NULL)?"left  == NULL        ":"left  != NULL (error)")
     51                  << " "
     52                  << ((_right  == NULL)?"right == NULL        ":"right != NULL (error)")
     53                  << std::endl;
     54
     55        if (_left  != NULL)
     56          _left ->print(depth+1);
     57        if (_right != NULL)
     58          _right->print(depth+1);
     59      }
     60   
     61    if (_data_type == OPERATOR_UNARY)
     62      {
     63        std::cout << tab << "<unary>"
     64                  << " "
     65                  << ((_left   == NULL)?"left  == NULL (error)":"left  != NULL        ")
     66                  << " "
     67                  << ((_right  == NULL)?"right == NULL        ":"right != NULL (error)")
     68                  << std::endl;
     69       
     70        if (_left  != NULL)
     71          _left ->print(depth+1);
     72        if (_right != NULL)
     73          _right->print(depth+1);
     74      }
     75
     76    if (_data_type == OPERATOR_BINARY)
     77      {
     78        std::cout << tab << "<binary>"
     79                  << " "
     80                  << ((_left   == NULL)?"left  == NULL (error)":"left  != NULL        ")
     81                  << " "
     82                  << ((_right  == NULL)?"right == NULL (error)":"right != NULL        ")
     83                  << std::endl;
     84
     85        if (_left  != NULL)
     86          _left ->print(depth+1);
     87        if (_right != NULL)
     88          _right->print(depth+1);
     89      }
     90  }
     91
    2692};
    2793};
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_generate_file.cpp

    r81 r88  
    22#include "Behavioural/include/Stat.h"
    33#include "Behavioural/include/Version.h"
     4#include "Common/include/Environment.h"
    45
    56namespace morpheo {
     
    89  void Stat::generate_file (void)
    910  {
     11    directory();
     12
    1013    std::string body = print(1);
    1114
     
    2629    xml->balise_close();
    2730
    28     xml->filename_extension ("stat");
    29     xml->generate_file();
     31    xml->filename_extension (".stat");
     32    xml->generate_file(MORPHEO_STATISTICS);
    3033
    3134    delete xml;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_have_counter.cpp

    r81 r88  
    1010         i!= _list_operand->end();
    1111         ++i)
    12       if (i->second.type == TYPE_COUNTER)
    13         return true;
    14 
     12      {
     13        if (i->second.type == TYPE_COUNTER)
     14          return true;
     15      }
    1516    return false;
    1617  }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_print.cpp

    r81 r88  
    77  std::string Stat::print (uint32_t depth)
    88  {
     9//     log_printf(TRACE,Behavioural,"Stat::print","Component name : %s",_name_component.c_str());
     10//     log_printf(TRACE,Behavioural,"Stat::print","Instance  name : %s",_name_instance .c_str());
     11
    912    end_simulation();
    1013
     
    2124         stat != _list_stat->end();
    2225         stat ++)
    23       xml.text((*stat)->print(1));
    24    
     26      {
     27        xml.text((*stat)->print(1));
     28      }
    2529
    2630    // Test special case
     
    6367                     ++operand)
    6468                  {
    65                     if (operand->second.type == TYPE_COUNTER)
     69                    if (operand->second.type == TYPE_COUNTER)
    6670                      {
    6771                        xml.singleton_begin(operand->second.name);
     
    8084          }
    8185      }
     86   
    8287    xml.balise_close();
    83 
     88   
    8489    return xml.get_body(depth);
    8590  }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_string2tree.cpp

    r81 r88  
    55namespace behavioural {
    66
    7 #define string2operator(x) (x=="+")?add:((x=="-")?sub:((x=="*")?mul:((x=="/" )?div:((x=="++")?inc:dec))))
    8 
    97  Stat_binary_tree * Stat::string2tree     (std::string expr)
    108  {
    11     const std::string delims  (" ");          // délimiteur : " "
    12     const std::string numbers ("0123456789"); // délimiteur : " "
    13     std::string::size_type index_begin, index_end;
     9    std::map<std::string, counter_t*> * operand = new std::map<std::string, counter_t*>;
    1410
    15     Stat_binary_tree * tree = NULL;
     11    for (std::map<std::string, var_t>::iterator it = _list_operand->begin();
     12         it != _list_operand->end();
     13         ++ it)
     14      (*operand) [it->first] = it->second.counter;
    1615
    17     index_begin = expr.find_first_not_of(delims);
     16    Stat_binary_tree * tree = new Stat_binary_tree(expr,operand);
    1817
    19     while (index_begin != std::string::npos)
    20       {
    21         index_end = expr.find_first_of(delims, index_begin);
    22 
    23         if (index_end == std::string::npos)
    24           {
    25             index_end = expr.length();
    26           }
    27        
    28         std::string str = expr.substr(index_begin, index_end-index_begin);
    29        
    30         // 3 possibilités :
    31         //  * operator
    32         //  * constante
    33         //  * variable
    34         {
    35           // Test constantes
    36           std::string::size_type index = str.find_first_not_of(numbers);
    37           if (index  == std::string::npos)
    38             {
    39 //            std::cout << " * c'est une constante." << std::endl;
    40 
    41               if (tree==NULL)
    42                 tree = new Stat_binary_tree (atoi(str.c_str()));
    43               else
    44                 tree = tree->insert_tree (atoi(str.c_str()));
    45             }
    46           else
    47             {
    48               // Test variables
    49               std::map<std::string, var_t>::iterator it = _list_operand->find(str);
    50               if (it != _list_operand->end())
    51                 {
    52 //                std::cout << " * c'est une variable." << std::endl;
    53 
    54                   if (tree==NULL)
    55                     tree = new Stat_binary_tree (it->second.counter);
    56                   else
    57                     tree = tree->insert_tree (it->second.counter);
    58                 }
    59               else
    60                 {
    61                   if ((str == "+") or
    62                       (str == "-") or
    63                       (str == "*") or
    64                       (str == "/"))
    65                     {
    66 //                    std::cout << " * c'est un operator à 2 opérandes." << std::endl;
    67                      
    68 //                    if (tree==NULL)
    69 //                      tree = new Stat_binary_tree (morpheo::string2operator[str].second);
    70 //                    else
    71 //                      tree->insert_tree (morpheo::string2operator[str].second);
    72                       if (tree==NULL)
    73                         tree = new Stat_binary_tree (string2operator(str));
    74                       else
    75                         tree = tree->insert_tree (string2operator(str));
    76                     }
    77                   else
    78                     {
    79                       if ((str == "++") or
    80                           (str == "--"))
    81                         {
    82 //                        std::cout << " * c'est un operator à 1 opérande." << std::endl;
    83 
    84 //                        if (tree==NULL)
    85 //                          tree = new Stat_binary_tree (string2operator[str.c_str()]);
    86 //                        else
    87 //                          tree->insert_tree (string2operator[str.c_str()]);
    88 
    89                           if (tree==NULL)
    90                             tree = new Stat_binary_tree (string2operator(str));
    91                           else
    92                             tree = tree->insert_tree (string2operator(str));
    93                          
    94                         }
    95                       else
    96                         {
    97 //                        std::cout << " * c'est autre chose." << std::endl;
    98                           str = "expression '"+str+"' doesn't a constant, a declarated variable or an operator.";
    99                           throw(ERRORMORPHEO("Stat::string2tree",_(str.c_str())));
    100                         }
    101                     }
    102                 }
    103             }
    104         }
    105 
    106         index_begin = expr.find_first_not_of(delims, index_end);
    107 
    108         if (index_begin != std::string::npos)
    109           tree = tree->goto_next_root();
    110       }
    111 
    112     if (tree == NULL)
    113       throw (ERRORMORPHEO("Stat::string2tree",_("the tree generated is empty.")));
    114 
    115 //     std::cout << "<Stat::string2tree> goto_top_level" << std::endl;
    116 
    117     tree = tree->goto_top_level();
    118 
    119 //     std::cout << "<Stat::string2tree> valid" << std::endl;
    120 
    121     if (not tree->valid())
    122       throw (ERRORMORPHEO("Stat::string2tree",_("the tree generated is invalid.")));
    123 
    124 //     std::cout << "<Stat::string2tree> End" << std::endl;
     18    delete operand;
    12519
    12620    return tree;
    127 
    12821  }
    12922 
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Usage.cpp

    r81 r88  
    2020    return ((usage & flag) != 0);
    2121  }
    22 
     22#undef  FUNCTION
     23#define FUNCTION "usage_environment"
    2324  void     usage_environment (Tusage_t usage)
    2425  {
    2526#ifndef SYSTEMC
    2627    if (usage_is_set(usage,USE_SYSTEMC))
    27       throw ErrorMorpheo(_("Component use the flag \"USE_SYSTEMC\", but the macro's compiler \"SYSTEMC\" is unset."));
     28      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_SYSTEMC\", but the macro's compiler \"SYSTEMC\" is unset.\n"));
    2829#endif
    2930#ifndef VHDL
    3031    if (usage_is_set(usage,USE_VHDL))
    31       throw ErrorMorpheo(_("Component use the flag \"USE_VHDL\", but the macro's compiler \"VHDL\" is unset."));
     32      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL\", but the macro's compiler \"VHDL\" is unset.\n"));
    3233#endif
    3334#ifndef VHDL_TESTBENCH
    3435    if (usage_is_set(usage,USE_VHDL_TESTBENCH))
    35       throw ErrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH\", but the macro's compiler \"VHDL_TESTBENCH\" is unset."));
     36      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL_TESTBENCH\", but the macro's compiler \"VHDL_TESTBENCH\" is unset.\n"));
    3637#endif
    3738#ifndef VHDL_TESTBENCH_ASSERT
    3839    if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT))
    39       throw ErrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH_ASSERT\", but the macro's compiler \"VHDL_TESTBENCH_ASSERT\" is unset."));
     40      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_VHDL_TESTBENCH_ASSERT\", but the macro's compiler \"VHDL_TESTBENCH_ASSERT\" is unset.\n"));
    4041#endif
    4142#ifndef POSITION
    4243    if (usage_is_set(usage,USE_POSITION))
    43       throw ErrorMorpheo(_("Component use the flag \"USE_POSITION\", but the macro's compiler \"POSITION\" is unset."));
     44      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_POSITION\", but the macro's compiler \"POSITION\" is unset.\n"));
    4445#endif
    4546#ifndef STATISTICS
    4647    if (usage_is_set(usage,USE_STATISTICS))
    47       throw ErrorMorpheo(_("Component use the flag \"USE_STATISTICS\", but the macro's compiler \"STATISTICS\" is unset."));
     48      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_STATISTICS\", but the macro's compiler \"STATISTICS\" is unset.\n"));
    4849#endif
    4950#ifndef INFORMATION
    5051    if (usage_is_set(usage,USE_INFORMATION))
    51       throw ErrorMorpheo(_("Component use the flag \"USE_INFORMATION\", but the macro's compiler \"INFORMATION\" is unset."));
     52      throw ERRORMORPHEO(FUNCTION,_("Component use the flag \"USE_INFORMATION\", but the macro's compiler \"INFORMATION\" is unset.\n"));
    5253#endif
    5354
     
    5657
    5758    if (usage_is_set(usage,USE_STATISTICS) and not usage_is_set(usage,USE_SYSTEMC))
    58       throw ErrorMorpheo(_("Usage flags conflit : to use the statistics, you must set flag USE_SYSTEMC"));
     59      throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the statistics, you must set flag USE_SYSTEMC\n"));
    5960   
    6061    if (usage_is_set(usage,USE_INFORMATION) and not usage_is_set(usage,USE_STATISTICS))
    61       throw ErrorMorpheo(_("Usage flags conflit : to use the information, you must set flag USE_STATISTICS"));
     62      throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the information, you must set flag USE_STATISTICS\n"));
    6263   
    6364    if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_SYSTEMC))
    64       throw ErrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_SYSTEMC"));
     65      throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_SYSTEMC\n"));
    6566   
    6667    if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_VHDL))
    67       throw ErrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_VHDL"));
     68      throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_VHDL\n"));
    6869   
    6970    if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT) and not usage_is_set(usage,USE_VHDL_TESTBENCH))
    70       throw ErrorMorpheo(_("Usage flags conflit : to use an assert in vhdl's test bench, you must set flag USE_VHDL_TESTBENCH"));
     71      throw ERRORMORPHEO(FUNCTION,_("Usage flags conflit : to use an assert in vhdl's test bench, you must set flag USE_VHDL_TESTBENCH\n"));
    7172  }
    7273
     
    9697    usage = usage_set(usage,USE_INFORMATION);
    9798#endif
    98 
     99    usage = usage_set(usage,USE_HEADER);
    99100#ifdef DEBUG
    100101#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_generate_file_model.cpp

    r81 r88  
    99
    1010#include "Behavioural/include/Vhdl.h"
     11#include "Common/include/Environment.h"
    1112#include <sstream>
    1213#include <fstream>
     
    1920    log_printf(FUNC,Behavioural,"generate_file_model","Begin");
    2021
    21     std::string filename = _name + ".vhdl";
     22    directory();
     23
     24    std::string filename = MORPHEO_VHDL + "/" + _name + ".vhdl";
    2225   
    23     log_printf(TRACE,Behavioural,"generate_file_model","print %s",filename.c_str());
    24     std::cout << "Generate file \""<< filename << "\"" << std::endl;
     26    msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str());
    2527
    2628    log_printf(TRACE,Behavioural,"generate_file_model","declaration");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_generate_file_package.cpp

    r81 r88  
    99
    1010#include "Behavioural/include/Vhdl.h"
     11#include "Common/include/Environment.h"
    1112#include <sstream>
    1213#include <fstream>
     
    1920    log_printf(FUNC,Behavioural,"generate_file_package","Begin");
    2021
     22    directory();
     23
    2124    std::string name     = _name + "_Pack";
    22     std::string filename = name + ".vhdl";
     25    std::string filename = MORPHEO_VHDL + "/" + name + ".vhdl";
    2326
    24     std::cout << "Generate file \""<< filename << "\"" << std::endl;
     27    msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str());
    2528
    2629    std::ofstream file;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_header.cpp

    r85 r88  
    3232    text += "-- "+toString(_("File : "))            + filename  +"\n";
    3333    text += "-- "+toString(_("Date : "))            + ctime (&current_time );
    34     text += "-- "+toString(_("Morpheo version : ")) + MORPHEO_VERSION +"\n";
     34    text += "-- "+toString(_("Morpheo version : ")) + MORPHEO_HEADER +"\n";
    3535    text += "-- "+toString(_("Comment : "))         + _("it's a autogenerated file, don't modify") +"\n";
    3636    text += "-------------------------------------------------------------------------------\n";
     
    3838    log_printf(FUNC,Behavioural,FUNCTION,"End");
    3939
    40     return text.str();
     40    return text;
    4141  };
    4242 
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_set_body.cpp

    r81 r88  
    1717#undef  FUNCTION
    1818#define FUNCTION "Vhdl::set_body"
    19   void Vhdl::set_body (std::string      text     )
     19  void Vhdl::set_body (std::string text)
    2020  {
    2121    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    2222    set_list(_list_body, text);
     23    log_printf(FUNC,Behavioural,FUNCTION,"End");
     24  };
     25 
     26#undef  FUNCTION
     27#define FUNCTION "Vhdl::set_body"
     28  void Vhdl::set_body (Vhdl * vhdl)
     29  {
     30    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
     31   
     32    for (std::list<std::string>::iterator it=vhdl->_list_body.begin();
     33         it!=vhdl->_list_body.end();
     34         ++it)
     35      set_list(_list_body, *it);
     36
    2337    log_printf(FUNC,Behavioural,FUNCTION,"End");
    2438  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML.cpp

    r81 r88  
    1717  {
    1818    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    19     _filename_extension="xml";
     19    _filename_extension=".xml";
    2020    log_printf(FUNC,Behavioural,FUNCTION,"End");
    2121  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_generate_file.cpp

    r81 r88  
    77
    88#include "Behavioural/include/XML.h"
     9#include "Common/include/ErrorMorpheo.h"
    910#include <fstream>
    1011
     
    1415#undef  FUNCTION
    1516#define FUNCTION "XML::generate_file"
    16   void XML::generate_file (std::string encoding)
     17  void XML::generate_file (std::string dirname, std::string encoding)
    1718  {
    1819    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
     
    2021    header (encoding);
    2122
    22     std::string filename =  _name + "." + _filename_extension;
     23    std::string filename = dirname + "/" + _name + _filename_extension;
    2324
    24     std::cout << "Generate file \""<< filename << "\"" << std::endl;
     25    msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str());
    2526
    2627    std::ofstream file;
    27     file.open(filename.c_str(),std::ios::out | std::ios::trunc);
     28    file.open(filename.c_str() ,std::ios::out | std::ios::trunc);
     29
     30    if (!file)
     31      throw ERRORMORPHEO(FUNCTION,toString(_("Error opening \"%s\" file.\n"),filename.c_str()));
    2832
    2933    file << get_body();
     
    3438  };
    3539
    36   void XML::generate_file (void)
     40  void XML::generate_file (std::string dirname)
    3741  {
    3842    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    39     generate_file("UTF-8");
     43    generate_file(dirname,"UTF-8");
    4044    log_printf(FUNC,Behavioural,FUNCTION,"End");
    4145  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_get_body.cpp

    r83 r88  
    2424    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    2525
    26     std::string body       = _body;
    27     std::string tabulation = indent(depth);
     26    std::string body = _body;
     27    std::string tab  = indent(depth);
    2828
    29 //  body.insert(0,tabulation);
     29    body.insert(0,tab);
    3030    for (size_t pos=body.find('\n',0); (pos<body.length()-1); pos=body.find('\n',++pos))
    31       body.insert(++pos,tabulation);
     31      body.insert(++pos,tab);
    3232
    3333    log_printf(FUNC,Behavioural,FUNCTION,"End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_header.cpp

    r85 r88  
    2626    str += "\n";
    2727    str += "<!--\n";
    28     str += "\t"+toString(_("File : "))            + _name+"."+_filename_extension + "\n";
     28    str += "\t"+toString(_("File : "))            + _name + _filename_extension + "\n";
    2929    str += "\t"+toString(_("Date : "))            + ctime (&current_time );
    30     str += "\t"+toString(_("Morpheo version : ")) + MORPHEO_VERSION +"\n";
     30    str += "\t"+toString(_("Morpheo version : ")) + MORPHEO_HEADER +"\n";
    3131    str += "\t"+toString(_("Comment : "))         + toString(_("it's a autogenerated file, don't modify")) +"\n";
    3232    str += "-->\n";
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_insert_XML.cpp

    r81 r88  
    1313#undef  FUNCTION
    1414#define FUNCTION "XML::insert_XML"
    15   bool XML::insert_XML (XML xml)
     15  bool XML::insert_XML (XML xml, uint32_t offset_depth)
    1616  {
    1717    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    1818    //return text (xml.get_body());
    19     _body += xml.get_body(depth());
     19    _body += xml.get_body(depth()+offset_depth);
    2020    log_printf(FUNC,Behavioural,FUNCTION,"End");
    2121
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_text.cpp

    r81 r88  
    1616  {
    1717    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    18     _body += indent()+text; // +"\n";
     18    _body += text; // +"\n";
    1919    log_printf(FUNC,Behavioural,FUNCTION,"End");
    2020
Note: See TracChangeset for help on using the changeset viewer.