#ifdef VHDL_TESTBENCH

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

#include "Behavioural/include/Vhdl_Testbench.h"

#include <sstream>
using namespace std;

namespace morpheo              {
namespace behavioural          {
  
  void Vhdl_Testbench::set_port (string      name     ,
				 direction_t direction,
				 uint32_t    size     )
  {
    string   name2;
    uint32_t size_old;
    if (direction == IN)
      {
	_list_input_size.push_back(size);
	size_old      = _size_input;
	_size_input  += size;
	name2         = "testbench_input";
      }
    else
      {
	_list_output_size.push_back(size);
	size_old      = _size_output;
	_size_output += size;
	name2         = "testbench_output";
      }

    string range;
    if (size == 1)
      range = "("+toString(size_old)+")";
    else
      range = "("+toString(size_old+size-1)+" downto "+toString(size_old)+")";
    
    _vhdl->set_alias (name, std_logic(size), name2, range);

    _list_port.push_back(name);
  };
  
}; // end namespace behavioural          
}; // end namespace morpheo              

#endif
