Ignore:
Timestamp:
Dec 4, 2007, 2:31:54 PM (17 years ago)
Author:
rosiere
Message:

Modification en profondeur de Component-port_map.
Compilation ok pour Register_unit ... a tester (systemC et vhdl)

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/src
Files:
8 added
2 deleted
6 edited

Legend:

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

    r44 r62  
    5151               ,signal_dest->get_name().c_str());
    5252
    53     signal_src ->link   (signal_dest, entity_dest == _entity);
    54     //signal_dest->mapping(signal_src );
     53    // need an internal signal ?
     54    bool src_is_port  = entity_src  == _entity;
     55    bool dest_is_port = entity_dest == _entity;
     56
     57    if (src_is_port == true)
     58      throw (ErrorMorpheo ("<Component::port_map> src can't be an interface's port of the top level."));
    5559   
     60    // 2 cases :
     61    //  a) dest is a top level port -> direct connection
     62    //  b) dest is a component port -> need internal signal
     63    if (dest_is_port == false)
     64      {
     65        // 1) find productor of signal
     66        //       
     67        // Interface      Component
     68        //    |          |         
     69        //  ----> (IN)     --X-> (IN)
     70        //    |          |         
     71        //  <-X-- (OUT)    <---- (OUT)
     72        //    |              |       
     73       
     74        Signal * signal_productor;
     75        Entity * entity_productor;
     76
     77        bool     src_is_productor = (signal_src->get_direction() == OUT);
     78
     79        if (src_is_productor == true)
     80          {
     81            signal_productor = signal_src;
     82            entity_productor = entity_src;
     83          }
     84        else
     85          {
     86            signal_productor = signal_dest;
     87            entity_productor = entity_dest;
     88          }
     89
     90        signal_dest  = signal_internal (entity_productor, signal_productor);
     91        dest_is_port = false;
     92      }
     93   
     94    try
     95      {
     96        signal_src->link(signal_dest,
     97                         dest_is_port);
     98      }
     99    catch (morpheo::ErrorMorpheo & error)
     100      {
     101        throw (ErrorMorpheo ("<Component::port_map> Error in mapping between "+entity_src ->get_name()+"."+signal_src ->get_name()+" and "+entity_dest->get_name()+"."+signal_dest->get_name()+" :\n"+error.what ()));
     102      }
     103    //catch (...)
     104    //  {
     105    //  }
     106
     107    log_printf(FUNC,Behavioural,FUNCTION,"End");
     108  };
     109
     110
     111  void Component::port_map (string component_src ,
     112                            string port_src      )
     113  {
     114    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
     115   
     116    Entity * entity_src = find_entity(component_src);
     117   
     118    if (entity_src == NULL)
     119      throw (ErrorMorpheo ("<Component::port_map> in component \""+_entity->get_name()+"\", port map with unknow component \""+component_src+"\"."));
     120   
     121    Signal * signal_src = entity_src->find_signal (port_src);
     122   
     123    if (signal_src == NULL)
     124      throw (ErrorMorpheo ("<Component::port_map> in component \""+_entity->get_name()+"\", port map with component \""+component_src+"\" and a unknow signal \""+port_src+"\"."));
     125   
     126    // need an internal signal ?
     127   
     128    if (entity_src == _entity)
     129      throw (ErrorMorpheo ("<Component::port_map> src can't be an interface's port of the top level."));
     130   
     131    if (signal_src->get_direction() != OUT)
     132      throw (ErrorMorpheo ("<Component::port_map> the direction of the signal '"+signal_src->get_name()+"' must be OUT."));
     133   
     134    try
     135      {
     136        signal_src->link(signal_internal (entity_src, signal_src),
     137                         false);
     138      }
     139    catch (morpheo::ErrorMorpheo & error)
     140      {
     141        throw (ErrorMorpheo ("<Component::port_map> Error in mapping "+entity_src ->get_name()+"."+signal_src ->get_name()+" :\n"+error.what ()));
     142      }
     143    //catch (...)
     144    //  {
     145    //  }
     146
    56147    log_printf(FUNC,Behavioural,FUNCTION,"End");
    57148  };
     
    59150}; // end namespace behavioural         
    60151}; // end namespace morpheo             
     152
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_test.cpp

    r42 r62  
    6666            while (i != _list_cycle->end())
    6767              {
    68                 vhdl->set_body("assert not ( ("+counter_name+" = "+toString(*i)+")) report \"***** <"+_name+"> interface's test number "+toString(j)+" *****\" severity NOTE;");
     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;");
    6970                j++;
    7071                ++i;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_signal_name.cpp

    r44 r62  
    77
    88#include "Behavioural/include/Interface.h"
    9 #include "Common/include/ChangeCase.h"
    109
    1110namespace morpheo              {
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal.cpp

    r44 r62  
    2222    log_printf(FUNC,Behavioural,"Signal","Begin");
    2323    _is_allocate   = false;
    24     _is_map        = false;
     24    _is_map_as_src = false;
     25    _is_map_as_dest= false;
    2526    _connect_from_signal = NULL;
    2627    _connect_to_signal   = NULL;
     
    4142  {
    4243    log_printf(FUNC,Behavioural,"Signal (copy)","Begin");
    43     _is_allocate= signal._is_allocate;
    44     _is_map     = signal._is_map    ;
     44    _is_allocate    = signal._is_allocate;
     45    _is_map_as_src  = signal._is_map_as_src ;
     46    _is_map_as_dest = signal._is_map_as_dest;
    4547    _connect_from_signal = signal._connect_from_signal;
    4648    _connect_to_signal   = signal._connect_to_signal;
    47     _sc_signal     = signal._sc_signal    ;
    48     _sc_signal_map = signal._sc_signal_map;
    49     _type_info  = signal._type_info ;
     49    _sc_signal      = signal._sc_signal    ;
     50    _sc_signal_map  = signal._sc_signal_map;
     51    _type_info      = signal._type_info ;
    5052#ifdef VHDL_TESTBENCH
    51     _list_value = signal._list_value;
     53    _list_value     = signal._list_value;
    5254#endif
    5355    log_printf(FUNC,Behavioural,"Signal (copy)","End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp

    r44 r62  
    1414#undef  FUNCTION
    1515#define FUNCTION "Signal::link"
    16   void Signal::link (Signal * signal,
    17                      bool     is_port_component)
     16  void Signal::link (Signal * signal_dest,
     17                     bool     signal_dest_is_port)
    1818  {
    1919    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    2020
    21     if (        _is_allocate == false)
    22       throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+        get_name()+"\", because it's not already allocate."));
    23     if (signal->_is_allocate == false)
    24       throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+signal->get_name()+"\", because it's not already allocate."));
    25     if (_is_map == true)
    26       throw (ErrorMorpheo ("<Signal::mapping> Can't mapping signal \""+_name+"\" with \""+signal->get_name()+"\", because it's already map."));
    27    
     21    Signal * signal_src = this;
     22
     23    // Test
     24    if (signal_src ->_is_allocate == false)
     25      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+        get_name()+"\", because the first signal is not already allocate."));
     26    if (signal_dest->_is_allocate == false)
     27      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+signal_dest->get_name()+"\", because the second signal is not already allocate."));
     28    if (signal_src ->_is_map_as_src  == true)
     29      throw (ErrorMorpheo ("<Signal::mapping> Can't mapping signal \""+_name+"\" with \""+signal_dest->get_name()+"\", because the first signal is already mapped."));
     30
     31    //     log_printf(TRACE,Behavioural,FUNCTION, " * sc_signal (before) %.8x - %.8x", (uint32_t)(_sc_signal_map), (uint32_t)(signal_dest->_sc_signal_map));
    2832
    2933    // List of all case
    3034    //
    31     //       dest        src             dest        src
    32     // PORT {IN } ----- {SIG} COMBI
    33     // PORT {OUT} ----- {SIG} COMBI
     35    //            src         dest
     36    // COMPONENT {IN } ----- {SIG} SIGNAL
     37    // COMPONENT {OUT} ----- {SIG} SIGNAL
    3438    //
    35     // PORT {IN } --X-- {OUT} COMPONENT {IN } ----- {OUT} COMPONENT
    36     // PORT {IN } ----- {IN } COMPONENT {IN } --X-- {IN } COMPONENT
    37     // PORT {OUT} ----- {OUT} COMPONENT {OUT} --X-- {OUT} COMPONENT
    38     // PORT {OUT} --X-- {IN } COMPONENT {OUT} ----- {IN } COMPONENT
     39    // COMPONENT {IN } ----- {IN } PORT
     40    // COMPONENT {OUT} ----- {OUT} PORT
    3941
    40 //  log_printf(TRACE,Behavioural,FUNCTION, "Signal \"%s\"\tlink with \"%s\"", _name.c_str(), signal->get_name().c_str());
     42    // list valid case
     43    if (not (    signal_dest_is_port and (((signal_src->_direction == IN ) and (signal_dest->_direction == IN      )) or
     44                                          ((signal_src->_direction == OUT) and (signal_dest->_direction == OUT     )))) and
     45        not (not signal_dest_is_port and (((signal_src->_direction == IN ) and (signal_dest->_direction == INTERNAL)) or
     46                                          ((signal_src->_direction == OUT) and (signal_dest->_direction == INTERNAL)))))
     47      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : illegal direction ("+toString(signal_src->_direction)+" with "+toString(signal_dest->_direction)+")."));
    4148
    42     log_printf(TRACE,Behavioural,FUNCTION, " * sc_signal (before) %.8x - %.8x", (uint32_t)(_sc_signal_map), (uint32_t)(signal->_sc_signal_map));
     49    // update info source
     50    signal_src ->_connect_to_signal   = signal_dest;
     51    signal_src ->_is_map_as_src       = true;
     52   
     53    // update info destination
     54    signal_dest->_connect_from_signal = signal_src;
     55    signal_dest->_is_map_as_dest      = true;
    4356
    44     _connect_to_signal = signal;
    45     signal->_connect_from_signal = this;
     57    // vhdl_testbench : to read an output producte by a internal component
     58    // TODO : à vérifier !!!!!!!!!!!!
     59    if ((signal_dest_is_port == true) and
     60        (signal_src ->_direction == OUT))
     61      signal_dest->_sc_signal_map = signal_src ->_sc_signal_map;
     62   
     63    connect (signal_dest);
    4664
    47     if (is_port_component == true)
    48       {
    49         if ((_direction == IN ) and (signal->_direction == IN ))
    50           {
    51             switch (_type_info)
    52               {
    53               case BOOL     : {(*(static_cast<sc_in  <bool    > *>(_sc_signal))) (*(static_cast<sc_in  <bool    > *>(signal->_sc_signal))); break;}
    54               case UINT8_T  : {(*(static_cast<sc_in  <uint8_t > *>(_sc_signal))) (*(static_cast<sc_in  <uint8_t > *>(signal->_sc_signal))); break;}
    55               case UINT16_T : {(*(static_cast<sc_in  <uint16_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint16_t> *>(signal->_sc_signal))); break;}
    56               case UINT32_T : {(*(static_cast<sc_in  <uint32_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint32_t> *>(signal->_sc_signal))); break;}
    57               case UINT64_T : {(*(static_cast<sc_in  <uint64_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint64_t> *>(signal->_sc_signal))); break;}
    58               default       : {throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" : type unknow.")); break;}
    59               }
    60           }
    61         else
    62           {
    63             if ((_direction == OUT) and (signal->_direction == OUT))
    64               {
    65                 _is_map = true;
    66                 signal->_sc_signal_map = _sc_signal_map;
    67                
    68                 switch (_type_info)
    69                   {
    70                   case BOOL     : {(*(static_cast<sc_out <bool    > *>(_sc_signal))) (*(static_cast<sc_out <bool    > *>(signal->_sc_signal))); break;}
    71                   case UINT8_T  : {(*(static_cast<sc_out <uint8_t > *>(_sc_signal))) (*(static_cast<sc_out <uint8_t > *>(signal->_sc_signal))); break;}
    72                   case UINT16_T : {(*(static_cast<sc_out <uint16_t> *>(_sc_signal))) (*(static_cast<sc_out <uint16_t> *>(signal->_sc_signal))); break;}
    73                   case UINT32_T : {(*(static_cast<sc_out <uint32_t> *>(_sc_signal))) (*(static_cast<sc_out <uint32_t> *>(signal->_sc_signal))); break;}
    74                   case UINT64_T : {(*(static_cast<sc_out <uint64_t> *>(_sc_signal))) (*(static_cast<sc_out <uint64_t> *>(signal->_sc_signal))); break;}
    75                   default       : {throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" : type unknow.")); break;}
    76                   }
    77               }
    78             else
    79               {
    80                 throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" can't been linked with signal \""+signal->get_name()+"\" : between two components, illegal direction ("+toString(_direction)+" with "+toString(signal->_direction)+")."));
    81               }
    82           }
    83       }
    84     else
    85       {
    86         if ((_direction == IN ) and (signal->_direction == OUT))
    87           {
    88             switch (_type_info)
    89               {
    90               case BOOL     : {(*(static_cast<sc_in  <bool    > *>(_sc_signal))) (*(static_cast<sc_out <bool    > *>(signal->_sc_signal))); break;}
    91               case UINT8_T  : {(*(static_cast<sc_in  <uint8_t > *>(_sc_signal))) (*(static_cast<sc_out <uint8_t > *>(signal->_sc_signal))); break;}
    92               case UINT16_T : {(*(static_cast<sc_in  <uint16_t> *>(_sc_signal))) (*(static_cast<sc_out <uint16_t> *>(signal->_sc_signal))); break;}
    93               case UINT32_T : {(*(static_cast<sc_in  <uint32_t> *>(_sc_signal))) (*(static_cast<sc_out <uint32_t> *>(signal->_sc_signal))); break;}
    94               case UINT64_T : {(*(static_cast<sc_in  <uint64_t> *>(_sc_signal))) (*(static_cast<sc_out <uint64_t> *>(signal->_sc_signal))); break;}
    95               default       : {throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" : type unknow.")); break;}
    96               }
    97           }
    98         else
    99           {
    100             if ((_direction == OUT) and (signal->_direction == IN ))
    101               {
    102                 _is_map = true;
    103                 switch (_type_info)
    104                   {
    105                   case BOOL     : {(*(static_cast<sc_out <bool    > *>(_sc_signal))) (*(static_cast<sc_in  <bool    > *>(signal->_sc_signal))); break;}
    106                   case UINT8_T  : {(*(static_cast<sc_out <uint8_t > *>(_sc_signal))) (*(static_cast<sc_in  <uint8_t > *>(signal->_sc_signal))); break;}
    107                   case UINT16_T : {(*(static_cast<sc_out <uint16_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint16_t> *>(signal->_sc_signal))); break;}
    108                   case UINT32_T : {(*(static_cast<sc_out <uint32_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint32_t> *>(signal->_sc_signal))); break;}
    109                   case UINT64_T : {(*(static_cast<sc_out <uint64_t> *>(_sc_signal))) (*(static_cast<sc_in  <uint64_t> *>(signal->_sc_signal))); break;}
    110                   default       : {throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" : type unknow.")); break;}
    111                   }
    112               }
    113             else
    114               {
    115                 throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" can't been linked with signal \""+signal->get_name()+"\" : between a interface's port and one component, illegal direction ("+toString(_direction)+" with "+toString(signal->_direction)+")."));
    116               }
    117           }
    118       }
    119 
    120     log_printf(TRACE,Behavioural,FUNCTION, " * sc_signal (after ) %.8x - %.8x", (uint32_t)(_sc_signal_map), (uint32_t)(signal->_sc_signal_map));
     65    //  log_printf(TRACE,Behavioural,FUNCTION, " * sc_signal (after ) %.8x - %.8x", (uint32_t)(_sc_signal_map), (uint32_t)(signal_dest->_sc_signal_map));
     66   
    12167    log_printf(FUNC,Behavioural,FUNCTION,"End");
    12268  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_print.cpp

    r42 r62  
    1919    output_stream << "\t{" << x._size << "}\t"
    2020                  << toString(x._direction)    << "\t"
    21                   << toString(x._presence_port);
     21                  << toString(x._presence_port)
     22                  << "sc_signal : " << hex << x._sc_signal << " - " << x._sc_signal_map << dec;
    2223
    2324    log_printf(FUNC,Behavioural,"operator<<","End");
Note: See TracChangeset for help on using the changeset viewer.