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

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/SelfTest/include/test.h"

#define NB_PARAMS 0

void usage (int argc, char * argv[])
{
  cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl
       << "list_params is :" << endl
       << " - size_queue          (unsigned int)" << endl
       << " - nb_context          (unsigned int)" << endl
       << " - nb_packet           (unsigned int)" << endl
       << " - size_general_data   (unsigned int)" << endl
       << " - size_special_data   (unsigned int)" << endl
       << " - nb_general_register (unsigned int)" << endl
       << " - nb_special_register (unsigned int)" << endl
       << " - nb_operation        (unsigned int)" << endl
       << " - nb_type             (unsigned int)" << endl
       << " - nb_gpr_write        (unsigned int)" << endl
       << " - nb_spr_write        (unsigned int)" << endl
       << "" << endl;

  for (int i=0; i<argc; i++)
    cerr << argv[i] << " ";
  cerr << endl;

  exit (1);
}

#ifndef SYSTEMC
int main    (int argc, char * argv[])
#else
int sc_main (int argc, char * argv[])
#endif
{
  if (argc < 2+NB_PARAMS)
    usage (argc, argv);

  const string   name                = argv[1];
  const uint32_t size_queue          = atoi(argv[ 2]);
  const uint32_t nb_context          = atoi(argv[ 3]);
  const uint32_t nb_packet           = atoi(argv[ 4]);
  const uint32_t size_general_data   = atoi(argv[ 5]);
  const uint32_t size_special_data   = atoi(argv[ 6]);
  const uint32_t nb_general_register = atoi(argv[ 7]);
  const uint32_t nb_special_register = atoi(argv[ 8]);
  const uint32_t nb_operation        = atoi(argv[ 9]);
  const uint32_t nb_type             = atoi(argv[10]);
  const uint32_t nb_gpr_write        = atoi(argv[11]);
  const uint32_t nb_spr_write        = atoi(argv[12]);

  try 
    {
      morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::read_queue::Parameters * param = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::read_queue::Parameters
	( size_queue    
	 ,nb_context         
	 ,nb_packet          
	 ,size_general_data  
	 ,size_special_data  
	 ,nb_general_register
	 ,nb_special_register
	 ,nb_operation       
	 ,nb_type            
	 ,nb_gpr_write
	 ,nb_spr_write
	  );
      
      cout << param->print(1);
      
      test (name,param);
    }
  catch (morpheo::ErrorMorpheo & error)
    {
      cout << "<" << name << "> : " <<  error.what ();
      exit (EXIT_FAILURE);
    }
  catch (...)
    {
      cerr << "<" << name << "> : This test must generate a error" << endl;
      exit (EXIT_FAILURE);
    }

  return (EXIT_SUCCESS);
}

