#ifdef VHDL_TESTBENCH

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

#include "Behavioural/include/Vhdl_Testbench.h"

#include <sstream>
using namespace std;

namespace morpheo              {
namespace behavioural          {
  
  uint32_t Vhdl_Testbench::get_test (void)
  {
    list<bool>::iterator i   = _list_test.begin();
    
    uint32_t counter = 0;

    if (i != _list_test.end())
      {
	_vhdl->set_body ("");
	_vhdl->set_body ("with testbench_counter select");
	_vhdl->set_body ("\ttestbench_must_test <=");

	while (i != _list_test.end())
	  {
	    list<bool>::iterator j = i;
	    ++i;

	    string str = (*j==true)?"1":"0";

	    if (i != _list_test.end())
	      _vhdl->set_body ("\t'"+str+"' when "+toString(counter++)+",");
	    else
	      _vhdl->set_body ("\t'"+str+"' when others;");
	  }
      }

    return counter;
  };
  
}; // end namespace behavioural          
}; // end namespace morpheo              

#endif
