source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Configuration/src/Simulator_fromFile.cpp @ 110

Last change on this file since 110 was 110, checked in by rosiere, 15 years ago

1) OOO_egine : add stat to depiste low perf source
2) Commit : add stat
3) LSU_Pointer : retire - always ack (else combinatory loop). insert - max nb_inst_memory
4) TopLevel? : add debug_idle_time to stop combinatory loop.
5) Issue_queue : add reexecute_queue, new implementation (routage after issue_queue)
6) Decod / Predictor : add "can_continue"

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1/*
2 * $Id: Simulator_fromFile.cpp 110 2009-02-19 16:31:47Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Configuration/include/Simulator.h"
9#include "Common/include/FromString.h"
10#include <fstream>
11
12namespace morpheo {
13namespace behavioural {
14namespace configuration {
15
16  using namespace XMLUtils;
17
18#undef  FUNCTION
19#define FUNCTION "Simulator::fromFile"
20  void Simulator::fromFile (std::string filename)
21  {
22    log_begin(Configuration,FUNCTION);
23
24    msg_printf(INFORMATION,_("Read file \"%s\"."),filename.c_str());
25
26    std::ifstream file (filename.c_str());
27
28    // Test the file open
29    if (!file)
30      throw ERRORMORPHEO(FUNCTION,toString(_("Error opening \"%s\" file.\n"),filename.c_str()));
31
32    XML_t * _xml = new FileXMLLight<char,ClassicReferenceCounter>(file);
33
34    // Test root node : Root name, must not a singleton, have none attribute
35    testNodeName   (_xml,"parameters");
36    testSingleton  (_xml,false);
37    testNoAttribute(_xml);
38
39    XMLLightVector<XML_t> vect = _xml->getNodes(); 
40
41//     std::cout << vect << std::endl;
42
43    for (uint32_t i=0; i<vect.size(); ++i)
44      {
45        XML_t * xml = vect[i];
46
47        std::string child_name = xml->getName();
48
49        //--------------------------------------------
50        // Child : Parameter
51        //--------------------------------------------
52        if (child_name == "parameter")
53          {
54            // testNodeName   (xml,"parameter");
55            testSingleton  (xml,true);       
56           
57            // Take attributes of this tag
58           
59            attributes_t attributes = xml->getAttributes();
60           
61            //         std::cout << "Node [" << name           << "]" << std::endl;
62            //         std::cout << "  * nb attributes : " << xml->getAttributes().size()  << std::endl;
63           
64            attribute_t value_name  = getAttribute(xml,attributes,"name" );
65            attribute_t value       = getAttribute(xml,attributes,"value");
66           
67            testAttributesEmpty(xml,attributes);
68           
69            // Insert in array
70            Parameter_affectation * param = new Parameter_affectation(value_name,
71                                                                      value     );
72           
73            insert(param);
74          }
75        //--------------------------------------------
76        // Child : Component
77        //--------------------------------------------
78        else
79          {
80            testNodeName   (xml,"component");
81            testSingleton  (xml,true);
82          }
83      }
84         
85    delete _xml;
86
87    log_end(Configuration,FUNCTION);
88  };
89
90}; // end namespace configuration
91}; // end namespace behavioural
92}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.