/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/include/Parameters.h"
#include "Behavioural/include/XML.h"

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace register_unit {


#undef  FUNCTION
#define FUNCTION "Register_unit::print"
  std::string Parameters::print (uint32_t depth)
  {
    log_printf(FUNC,Register_unit,FUNCTION,"Begin");

    XML xml ("register_unit");

    xml.balise_open("register_unit");
    xml. singleton_begin("nb_ooo_engine            "); xml.attribut("value",toString(_nb_ooo_engine            )); xml.singleton_end();
    xml. singleton_begin("size_general_data        "); xml.attribut("value",toString(_size_general_data        )); xml.singleton_end();
    xml. singleton_begin("size_special_data        "); xml.attribut("value",toString(_size_special_data        )); xml.singleton_end();
    xml. singleton_begin("nb_gpr_read              "); xml.attribut("value",toString(_nb_gpr_read              )); xml.singleton_end();
    xml. singleton_begin("nb_gpr_write             "); xml.attribut("value",toString(_nb_gpr_write             )); xml.singleton_end();
    xml. singleton_begin("nb_gpr_bank              "); xml.attribut("value",toString(_nb_gpr_bank              )); xml.singleton_end();
    xml. singleton_begin("nb_gpr_port_read_by_bank "); xml.attribut("value",toString(_nb_gpr_port_read_by_bank )); xml.singleton_end();
    xml. singleton_begin("nb_gpr_port_write_by_bank"); xml.attribut("value",toString(_nb_gpr_port_write_by_bank)); xml.singleton_end();
    xml. singleton_begin("nb_spr_read              "); xml.attribut("value",toString(_nb_spr_read              )); xml.singleton_end();
    xml. singleton_begin("nb_spr_write             "); xml.attribut("value",toString(_nb_spr_write             )); xml.singleton_end();
    xml. singleton_begin("nb_spr_bank              "); xml.attribut("value",toString(_nb_spr_bank              )); xml.singleton_end();
    xml. singleton_begin("nb_spr_port_read_by_bank "); xml.attribut("value",toString(_nb_spr_port_read_by_bank )); xml.singleton_end();
    xml. singleton_begin("nb_spr_port_write_by_bank"); xml.attribut("value",toString(_nb_spr_port_write_by_bank)); xml.singleton_end();
    
    xml. balise_open("multi_ooo_engine");
    for (uint32_t i=0; i<_nb_ooo_engine; i++)
      {
	xml.  balise_open_begin("ooo_engine");
	xml.   attribut("id", toString(i));
	xml.  balise_open_end();
	xml.   singleton_begin("nb_general_register"); xml.attribut("value",toString(_nb_general_register [i])); xml.singleton_end();
	xml.   singleton_begin("nb_special_register"); xml.attribut("value",toString(_nb_special_register [i])); xml.singleton_end();
	xml.   singleton_begin("nb_inst_insert_rob "); xml.attribut("value",toString(_nb_inst_insert_rob  [i])); xml.singleton_end();
	xml.   singleton_begin("nb_inst_retire_rob "); xml.attribut("value",toString(_nb_inst_retire_rob  [i])); xml.singleton_end();
	xml.  balise_close();
      }
    xml. balise_close();

//     xml. text (_param_glue->print(depth+1));
//     for (uint32_t i=0; i<_nb_ooo_engine; i++)
//      {
//        xml. text (_param_gpr        [i]->print(depth+1));
//        xml. text (_param_gpr_status [i]->print(depth+1));
//        xml. text (_param_spr        [i]->print(depth+1));
//        xml. text (_param_spr_status [i]->print(depth+1));
//      }
    
    xml.balise_close();

    log_printf(FUNC,Register_unit,FUNCTION,"End");
    
    return xml.get_body(depth);
  };

#undef  FUNCTION
#define FUNCTION "Register_unit::operator<<"
  std::ostream& operator<< (std::ostream& output_stream ,
			    morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters & x)
  {
    log_printf(FUNC,Register_unit,FUNCTION,"Begin");

    output_stream << x.print(0);
    
    log_printf(FUNC,Register_unit,FUNCTION,"End");

    return output_stream;
  };

}; // end namespace register_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
