Ignore:
Timestamp:
Feb 16, 2009, 9:28:31 PM (15 years ago)
Author:
rosiere
Message:

1) Configuration : instance configuration file : regroup similar instance
2) Configuration : timing default = 0
3) Debug/Commit_unit : Add watch dog timer
4) Issue_queue : Test parameters : add test if type is optionnal
5) Cor_glue : Fix insert index
6) Free_list : remove bank_by_pop (else deadlock)
7) Update Free List : add register to source event

File:
1 edited

Legend:

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

    r88 r109  
    2626
    2727    XMLLightVector<XML_t> vect = xml->getNodes();
    28    
     28
    2929    for (uint32_t i=0; i<vect.size(); ++i)
    3030      {
     
    3333        std::string child_name = child->getName();
    3434
     35//         log_printf(TRACE,Configuration,FUNCTION,"  * child_name : %s",child_name.c_str());
     36
    3537        //--------------------------------------------
    3638        // Child : Parameter
     
    4446            attribute_t  value_name = getAttribute(child,attributes,"name" );
    4547            attribute_t  value      = getAttribute(child,attributes,"value");
     48
     49//             log_printf(TRACE,Configuration,FUNCTION,"    * parameter \"%s\" = %s",value_name.c_str(), value.c_str());
    4650           
    4751            testAttributesEmpty(child,attributes);
     
    7074            attributes_t attributes = child->getAttributes();
    7175            attribute_t  value_name = getAttribute(child,attributes,"name");
     76
     77//             log_printf(TRACE,Configuration,FUNCTION,"    * link  \"%s\"",value_name.c_str());
    7278           
    7379            // Test, must have src or dest (or twice)
     
    8086            attribute_t  value_src  = (have_src )?getAttribute(child,attributes,"src" ):id;
    8187            attribute_t  value_dest = (have_dest)?getAttribute(child,attributes,"dest"):id;
     88
    8289
    8390            testAttributesEmpty(child,attributes);
     
    111118        if (child_name == "timing")
    112119          {
     120//             log_printf(TRACE,Configuration,FUNCTION,"    * timing");
     121
    113122            // Notation :
    114123            //     <timing type="5" operation="8" latence="2"  delay="1" />
     
    183192          }
    184193        //--------------------------------------------
    185         // Child : Other (node)
     194        // Child : Other (component)
    186195        //--------------------------------------------
    187196        else
    188197          {
     198//             log_printf(TRACE,Configuration,FUNCTION,"    * component");
     199
    189200            testSingleton  (child,false);       
    190201           
    191202            attributes_t attributes = child->getAttributes();
    192             attribute_t  value_id   = getAttribute(child,attributes,"id");
     203            attribute_t  value_ids  = getAttribute(child,attributes,"id");
    193204            attribute_t  value_type = child->getName();
    194            
    195             testAttributesEmpty(child,attributes);
    196            
    197             // Create a new component
     205
     206            testAttributesEmpty(child,attributes);
     207
     208            // Test if counter is an parameters
     209            std::string name_counter = "nb_"+value_type;
     210           
    198211            {
    199               Instance_component * param = new Instance_component(value_type, // type
    200                                                                   value_id);
    201              
    202 //            log_printf(TRACE,Configuration,FUNCTION,"%s.%s",value_type.c_str(),value_id.c_str());
    203 //            log_printf(TRACE,Configuration,FUNCTION,"  * %d",((*list_components)[value_type]).size());
    204              
    205               // Test if this id is previously used
    206               if (((*list_components)[value_type]).find(value_id) != ((*list_components)[value_type]).end())
    207                 throw ERRORMORPHEO(FUNCTION,toString(_("A Component \"%s\" with id \"%s\" is previously declared.\n"),value_type.c_str(),value_id.c_str()));
    208              
    209               ((*list_components)[value_type])[value_id] = param;
    210             }
    211            
    212             // Test if counter is an parameters
    213             {
    214               std::string name_counter = "nb_"+value_type;
    215 //            std::cout << name_counter << std::endl;
    216              
    217212              if (list_parameters->find(name_counter) == list_parameters->end())
    218213                {
    219                   // Scearch all occurante of this type
    220                   uint32_t nb_counter = xml->getNodes(value_type).size();
    221 //                std::cout << "  * " << nb_counter << std::endl;
    222                  
    223214                  // Insert in array
    224215                  Parameter_affectation * param = new Parameter_affectation(name_counter, // type
    225                                                                             toString(nb_counter));
    226                  
     216                                                                            "0");
    227217                  // insert parameter
    228218                  (*list_parameters)[name_counter] = param;
     
    230220            }
    231221           
    232             // Recursive function
    233             fromXMLLight (child,
    234                           ((id=="")?value_id:(id+"."+value_id)), // construction of identificator
    235                           ((*list_components)[value_type])[value_id]->_list_parameters,
    236 //                        ((*list_components)[value_type])[value_id]->_list_links,
    237                           list_links,
    238                           ((*list_components)[value_type])[value_id]->_list_components);
     222            size_t index_begin = 0;
     223            while (index_begin != std::string::npos)
     224              {
     225                size_t index_end = value_ids.find_first_of(",",index_begin+1);
     226               
     227                size_t      index_min = (index_begin==0)?index_begin:(index_begin+1);
     228                size_t      index_max = index_end-index_min;
     229                attribute_t value_id  = value_ids.substr(index_min, index_max);
     230
     231//                 log_printf(TRACE,Configuration,FUNCTION,"    * component \"%s\" - %s",value_type.c_str(), value_id.c_str());
     232
     233                index_begin = index_end;
     234
     235                // Create a new component
     236                {
     237                  Instance_component * param = new Instance_component(value_type, // type
     238                                                                      value_id);
     239             
     240//                log_printf(TRACE,Configuration,FUNCTION,"%s.%s",value_type.c_str(),value_id.c_str());
     241//                log_printf(TRACE,Configuration,FUNCTION,"  * %d",((*list_components)[value_type]).size());
     242             
     243                  // Test if this id is previously used
     244                  if (((*list_components)[value_type]).find(value_id) != ((*list_components)[value_type]).end())
     245                    throw ERRORMORPHEO(FUNCTION,toString(_("A Component \"%s\" with id \"%s\" is previously declared.\n"),value_type.c_str(),value_id.c_str()));
     246                 
     247                  ((*list_components)[value_type])[value_id] = param;
     248                }
     249
     250                // Increase occurence counter
     251                {
     252                  (*list_parameters)[name_counter]->_value = toString(fromString<uint32_t>((*list_parameters)[name_counter]->_value)+1);
     253                }
     254               
     255                // Recursive function
     256                fromXMLLight (child,
     257                              ((id=="")?value_id:(id+"."+value_id)), // construction of identificator
     258                              ((*list_components)[value_type])[value_id]->_list_parameters,
     259//                            ((*list_components)[value_type])[value_id]->_list_links,
     260                              list_links,
     261                              ((*list_components)[value_type])[value_id]->_list_components);
     262              }
    239263          }
    240264      }
Note: See TracChangeset for help on using the changeset viewer.