source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_print.cpp

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

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

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.3 KB
RevLine 
[71]1#ifdef STATISTICS
2#include "Behavioural/include/Stat.h"
[113]3#include "Common/include/Systemc.h"
[71]4
5namespace morpheo {
6namespace behavioural { 
7
8  std::string Stat::print (uint32_t depth)
9  {
[88]10//     log_printf(TRACE,Behavioural,"Stat::print","Component name : %s",_name_component.c_str());
11//     log_printf(TRACE,Behavioural,"Stat::print","Instance  name : %s",_name_instance .c_str());
12
[71]13    end_simulation(); 
14
[113]15    cycle_t _cycle_sum = simulation_cycle();
[71]16
17    morpheo::behavioural::XML xml (_name_instance);
18
19    xml.balise_open_begin(_name_component);
20    xml.attribut("name",_name_instance);
21    xml.balise_open_end();
22
[74]23    // Print component
24    for (std::list<Stat *>::iterator stat=_list_stat->begin();
25         stat != _list_stat->end();
26         stat ++)
[88]27      {
28        xml.text((*stat)->print(1));
29      }
[74]30
[71]31    // Test special case
[75]32
33    if (have_counter())
[71]34      {
[75]35        if (_cycle_sum < _nb_cycle_before_begin)
[71]36          {
[75]37            xml.comment(_("Number of cycle is less than the number minimal"));
38          }
39        else
40          {
41            bool stop = false;
42            cycle_t nb_cycle_min;
43            cycle_t nb_cycle_max = _nb_cycle_before_begin-1;
44            for (cycle_t period=0; stop==false; period++)
45              {
46                std::map<std::string, var_t>::iterator operand=_list_operand->begin();
47               
48                if (operand->second.save_counter.size()==0)
49                  throw(ERRORMORPHEO("Stat::generate_file",_("Queue 'save_counter' is empty.")));
50               
51                bool last = operand->second.save_counter.size()==1;
52               
53                nb_cycle_min  = nb_cycle_max+1;
54               
55                if (last)
56                  nb_cycle_max = static_cast<cycle_t>(_cycle_sum);
57                else
58                  nb_cycle_max += _period;
[71]59
[75]60                xml.balise_open_begin("period");
61                xml.attribut("number",toString(period));
62                xml.attribut("nb_cycle_min",toString(nb_cycle_min));
63                xml.attribut("nb_cycle_max",toString(nb_cycle_max));
64                xml.balise_open_end();
65               
66                for (;
67                     operand!= _list_operand->end();
68                     ++operand)
[71]69                  {
[88]70                    if (operand->second.type == TYPE_COUNTER)
[75]71                      {
72                        xml.singleton_begin(operand->second.name);
73                        xml.attribut("value",toString(operand->second.save_counter.front()));
74                        xml.attribut("unit",operand->second.unit);
75                        xml.attribut("description",operand->second.description);
76                        xml.singleton_end();
77                      }
78                    operand->second.save_counter.pop_front();
[71]79                  }
[75]80               
81                xml.balise_close();
82               
83                stop = last;
[71]84              }
85          }
86      }
[88]87   
[71]88    xml.balise_close();
[88]89   
[71]90    return xml.get_body(depth);
91  }
92}; 
93};
94#endif
Note: See TracBrowser for help on using the repository browser.