#ifdef VHDL
/*
 * $Id$
 *
 * [ Description ]
 * 
 */

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

namespace morpheo                    {
namespace behavioural {
namespace core {
namespace multi_execute_loop {
namespace execute_loop {
namespace multi_read_unit {
namespace read_unit {
namespace read_queue {


  void Read_queue::vhdl_body (Vhdl * & vhdl)
  {
    log_printf(FUNC,Read_queue,"vhdl_body","Begin");
    vhdl->set_body ("");
    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- Instance queue                  ");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");

    vhdl->set_body("instance_"+_name+"_queue : "+_name+"_queue");
    vhdl->set_body("port map (");
    vhdl->set_body("\t  in_CLOCK       \t=>\t      in_CLOCK ");
    vhdl->set_body("\t, in_NRESET      \t=>\t      in_NRESET");
    vhdl->set_body("\t, in_INSERT_VAL  \t=>\tinternal_QUEUE_INSERT_VAL");
    vhdl->set_body("\t,out_INSERT_ACK  \t=>\tinternal_QUEUE_INSERT_ACK");
    vhdl->set_body("\t, in_INSERT_DATA \t=>\tinternal_QUEUE_INSERT_DATA");
    vhdl->set_body("\t,out_RETIRE_VAL  \t=>\tinternal_QUEUE_RETIRE_VAL");
    vhdl->set_body("\t, in_RETIRE_ACK  \t=>\tinternal_QUEUE_RETIRE_ACK");
    vhdl->set_body("\t,out_RETIRE_DATA \t=>\tinternal_QUEUE_RETIRE_DATA");
    vhdl->set_body(");");

    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- Queue_data                      ");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");
    
    uint32_t min = 0;
    uint32_t max;

    if(_param->_have_port_context_id   )
      {
	max = min-1+_param->_size_context_id;
	vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_CONTEXT_ID;");
	min = max+1;
      }
    if(_param->_have_port_front_end_id   )
      {
	max = min-1+_param->_size_front_end_id;
	vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_FRONT_END_ID;");
	min = max+1;
      }
    if(_param->_have_port_ooo_engine_id   )
      {
	max = min-1+_param->_size_ooo_engine_id;
	vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_OOO_ENGINE_ID;");
	min = max+1;
      }
    if(_param->_have_port_rob_id   )
      {
	max = min-1+_param->_size_rob_id;
	vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_ROB_ID;");
	min = max+1;
      }

    max = min-1+_param->_size_operation;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_OPERATION;");
    min = max+1;

    max = min-1+_param->_size_type;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_TYPE;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_HAS_IMMEDIAT;");
    min = max+1;

    max = min-1+_param->_size_general_data;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_IMMEDIAT;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_READ_RA;");
    min = max+1;

    max = min-1+_param->_size_general_register;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_NUM_REG_RA;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_READ_RB;");
    min = max+1;

    max = min-1+_param->_size_general_register;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_NUM_REG_RB;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_READ_RC;");
    min = max+1;

    max = min-1+_param->_size_special_register;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_NUM_REG_RC;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_WRITE_RD;");
    min = max+1;

    max = min-1+_param->_size_general_register;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_NUM_REG_RD;");
    min = max+1;

    max = min;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_WRITE_RE;");
    min = max+1;

    max = min-1+_param->_size_special_register;
    vhdl->set_body ("internal_QUEUE_INSERT_DATA"+std_logic_range(_param->_size_internal_queue,max,min)+" <= in_READ_QUEUE_IN_NUM_REG_RE;");
    min = max+1;

    vhdl->set_body ("internal_QUEUE_RETIRE_ACK <= internal_READ_QUEUE_OUT_VAL and in_READ_QUEUE_OUT_ACK;");

    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- Interface read");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");
    vhdl->set_body("-- GPR");
    vhdl->set_body ("out_GPR_READ_0_VAL           <= internal_QUEUE_RETIRE_VAL and internal_READ_RA_VAL;");
    vhdl->set_body ("out_GPR_READ_1_VAL           <= internal_QUEUE_RETIRE_VAL and internal_READ_RB_VAL;");
    if(_param->_have_port_ooo_engine_id)
      {
	vhdl->set_body ("out_GPR_READ_0_OOO_ENGINE_ID <= internal_OOO_ENGINE_ID;");
	vhdl->set_body ("out_GPR_READ_1_OOO_ENGINE_ID <= internal_OOO_ENGINE_ID;");
      }
    vhdl->set_body ("out_GPR_READ_0_NUM_REG       <= internal_NUM_REG_RA;");
    vhdl->set_body ("out_GPR_READ_1_NUM_REG       <= internal_NUM_REG_RB;");
    vhdl->set_body("");
    
    vhdl->set_body("-- SPR");
    vhdl->set_body ("out_SPR_READ_0_VAL           <= internal_QUEUE_RETIRE_VAL and internal_READ_RC_VAL;");
    if(_param->_have_port_ooo_engine_id)
      {
	vhdl->set_body ("out_SPR_READ_0_OOO_ENGINE_ID <= internal_OOO_ENGINE_ID;");
      }
    vhdl->set_body ("out_SPR_READ_0_NUM_REG       <= internal_NUM_REG_RC;");

    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- Interface read_queue_out");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");
    
    if(_param->_have_port_context_id   )
      vhdl->set_body ("out_READ_QUEUE_OUT_CONTEXT_ID    <= internal_CONTEXT_ID   ;");
    if(_param->_have_port_front_end_id   )
      vhdl->set_body ("out_READ_QUEUE_OUT_FRONT_END_ID  <= internal_FRONT_END_ID ;");
    if(_param->_have_port_ooo_engine_id   )
      vhdl->set_body ("out_READ_QUEUE_OUT_OOO_ENGINE_ID <= internal_OOO_ENGINE_ID;");
    if(_param->_have_port_rob_id   )
      vhdl->set_body ("out_READ_QUEUE_OUT_ROB_ID        <= internal_ROB_ID       ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_OPERATION     <= internal_OPERATION    ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_TYPE          <= internal_TYPE         ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_HAS_IMMEDIAT  <= internal_HAS_IMMEDIAT ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_IMMEDIAT      <= internal_IMMEDIAT     ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_READ_RA       <= internal_READ_RA      ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_NUM_REG_RA    <= internal_NUM_REG_RA   ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RA_VAL   <= internal_NEXT_DATA_RA_VAL;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RA       <= internal_NEXT_DATA_RA ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_READ_RB       <= internal_READ_RB      ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_NUM_REG_RB    <= internal_NUM_REG_RB   ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RB_VAL   <= internal_NEXT_DATA_RB_VAL;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RB       <= internal_NEXT_DATA_RB ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_READ_RC       <= internal_READ_RC      ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_NUM_REG_RC    <= internal_NUM_REG_RC   ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RC_VAL   <= internal_NEXT_DATA_RC_VAL;");
    vhdl->set_body ("out_READ_QUEUE_OUT_DATA_RC       <= internal_NEXT_DATA_RC ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_WRITE_RD      <= internal_WRITE_RD     ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_NUM_REG_RD    <= internal_NUM_REG_RD   ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_WRITE_RE      <= internal_WRITE_RE     ;");
    vhdl->set_body ("out_READ_QUEUE_OUT_NUM_REG_RE    <= internal_NUM_REG_RE   ;");
    
    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- next reg update");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");
    vhdl->set_body("-- read_rx_val - 1 : must access at the registerFile (after access, is set at 0)");
    
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_READ_RA_VAL <=");
      vhdl->set_body("\t'0' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	  
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\t\t((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RA=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_READ_RA_VAL and not in_GPR_READ_0_ACK;");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_READ_RB_VAL <=");
      vhdl->set_body("\t'0' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	  
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\t\t((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RB=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_READ_RB_VAL and not in_GPR_READ_1_ACK;");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_READ_RC_VAL <=");
      vhdl->set_body("\t'0' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_spr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	  
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_SPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\t\t((in_SPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RC=in_SPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_READ_RC_VAL and not in_SPR_READ_0_ACK;");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_READ_QUEUE_OUT_VAL <= not internal_NEXT_READ_RA_VAL and not internal_NEXT_READ_RB_VAL and not internal_NEXT_READ_RC_VAL;");
      vhdl->set_body("     out_READ_QUEUE_OUT_VAL <= internal_READ_QUEUE_OUT_VAL and internal_QUEUE_RETIRE_VAL;");
      
    }
    
    vhdl->set_body("");
    vhdl->set_body("-- data_rx_val - 1 : the read of registerFile is valid");
    
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RA_VAL <=");
      vhdl->set_body("\t'1' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\t\t((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RA=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_DATA_RA_VAL or (internal_READ_RA_VAL and in_GPR_READ_0_ACK and in_GPR_READ_0_DATA_VAL);");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RB_VAL <=");
      vhdl->set_body("\t'1' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	  
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	else
	  cmp = "";
	  
	  vhdl->set_body("\t\t((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RB=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_DATA_RB_VAL or (internal_READ_RB_VAL and in_GPR_READ_1_ACK and in_GPR_READ_1_DATA_VAL);");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RC_VAL <=");
      vhdl->set_body("\t'1' when");
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_spr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	  
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_SPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\t\t((in_SPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RC=in_SPR_WRITE_"+toString(i)+"_NUM_REG)) or");
	}
      vhdl->set_body("\t\tfalse else");
      vhdl->set_body("\tinternal_DATA_RC_VAL or (internal_READ_RC_VAL and in_SPR_READ_0_ACK and in_SPR_READ_0_DATA_VAL);");
    }
    
    vhdl->set_body("");
    vhdl->set_body("-- data_rx - data read");
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RA <=");
#ifdef SYSTEMC_VHDL_COMPATIBILITY
      vhdl->set_body("\t"+std_logic_others(_param->_size_general_data,0)+" when internal_READ_RA='0' else");
#endif
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\tin_GPR_WRITE_"+toString(i)+"_DATA when ((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RA=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) else");
	}
      vhdl->set_body("\treg_DATA_RA when (internal_DATA_RA_VAL='1') else");
      vhdl->set_body("\tin_GPR_READ_0_DATA;");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RB <=");
#ifdef SYSTEMC_VHDL_COMPATIBILITY
      vhdl->set_body("\t"+std_logic_others(_param->_size_general_data,0)+" when internal_READ_RB='0' else");
#endif
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_gpr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_GPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\tin_GPR_WRITE_"+toString(i)+"_DATA when ((in_GPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (internal_NUM_REG_RB=in_GPR_WRITE_"+toString(i)+"_NUM_REG)) else");
	}
      vhdl->set_body("\treg_DATA_RB when (internal_DATA_RB_VAL='1') else");
      vhdl->set_body("\tin_GPR_READ_1_DATA;");
    }
    {
      vhdl->set_body("");
      vhdl->set_body("internal_NEXT_DATA_RC <=");
#ifdef SYSTEMC_VHDL_COMPATIBILITY
      vhdl->set_body("\t"+std_logic_others(_param->_size_special_data,0)+" when internal_READ_RC='0' else");
#endif
      // bypass
      vhdl->set_body("\t\t-- check bypass");
      for (int32_t i=_param->_nb_spr_write-1; i>=0 ; i--)
	{
	  std::string cmp;
	
	  if (_param->_have_port_ooo_engine_id)
	    cmp = "and (in_SPR_WRITE_"+toString(i)+"_OOO_ENGINE_ID=internal_OOO_ENGINE_ID) ";
	  else
	    cmp = "";
	  
	  vhdl->set_body("\tin_SPR_WRITE_"+toString(i)+"_DATA when ((in_SPR_WRITE_"+toString(i)+"_VAL='1') "+cmp+"and (in_SPR_WRITE_"+toString(i)+"_NUM_REG=internal_NUM_REG_RC)) else");
	}
      vhdl->set_body("\treg_DATA_RC when (internal_DATA_RC_VAL='1') else");
      vhdl->set_body("\tin_SPR_READ_0_DATA;");

    vhdl->set_body("");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("-- transition");
    vhdl->set_body("-----------------------------------");
    vhdl->set_body("");
    vhdl->set_body("-- need a new head if :");
    vhdl->set_body("--   * queue is empty");
    vhdl->set_body("--   * pop with queue");
    vhdl->set_body ("internal_NEXT_NEED_NEW_HEAD <= not internal_QUEUE_RETIRE_VAL or (internal_QUEUE_RETIRE_VAL and internal_QUEUE_RETIRE_ACK);");

    vhdl->set_body ("internal_READ_RA_VAL   <=     internal_READ_RA when reg_NEED_NEW_HEAD='1' else reg_READ_RA_VAL;");
    vhdl->set_body ("internal_READ_RB_VAL   <=     internal_READ_RB when reg_NEED_NEW_HEAD='1' else reg_READ_RB_VAL;");
    vhdl->set_body ("internal_READ_RC_VAL   <=     internal_READ_RC when reg_NEED_NEW_HEAD='1' else reg_READ_RC_VAL;");
    vhdl->set_body ("internal_DATA_RA_VAL   <= not internal_READ_RA when reg_NEED_NEW_HEAD='1' else reg_DATA_RA_VAL;");
    vhdl->set_body ("internal_DATA_RB_VAL   <= not internal_READ_RB when reg_NEED_NEW_HEAD='1' else reg_DATA_RB_VAL;");
    vhdl->set_body ("internal_DATA_RC_VAL   <= not internal_READ_RC when reg_NEED_NEW_HEAD='1' else reg_DATA_RC_VAL;");


    vhdl->set_body ("");
    vhdl->set_body ("transition: process (in_CLOCK)");
    vhdl->set_body ("begin  -- process transition");
    vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
    vhdl->set_body ("");
    vhdl->set_body ("\t\tif (in_NRESET = '0') then");    
    vhdl->set_body ("\t\t\treg_NEED_NEW_HEAD <= '1';");
    vhdl->set_body ("\t\telse");
    vhdl->set_body ("\t\t\treg_NEED_NEW_HEAD <= internal_NEXT_NEED_NEW_HEAD;");
    vhdl->set_body ("\t\t\treg_READ_RA_VAL   <= internal_NEXT_READ_RA_VAL;");
    vhdl->set_body ("\t\t\treg_READ_RB_VAL   <= internal_NEXT_READ_RB_VAL;");
    vhdl->set_body ("\t\t\treg_READ_RC_VAL   <= internal_NEXT_READ_RC_VAL;");
    vhdl->set_body ("\t\t\treg_DATA_RA_VAL   <= internal_NEXT_DATA_RA_VAL;");
    vhdl->set_body ("\t\t\treg_DATA_RB_VAL   <= internal_NEXT_DATA_RB_VAL;");
    vhdl->set_body ("\t\t\treg_DATA_RC_VAL   <= internal_NEXT_DATA_RC_VAL;");
    vhdl->set_body ("\t\t\treg_DATA_RA       <= internal_NEXT_DATA_RA    ;");
    vhdl->set_body ("\t\t\treg_DATA_RB       <= internal_NEXT_DATA_RB    ;");
    vhdl->set_body ("\t\t\treg_DATA_RC       <= internal_NEXT_DATA_RC    ;");

    vhdl->set_body ("\t\tend if;");
    vhdl->set_body ("");
    vhdl->set_body ("\tend if;");
    vhdl->set_body ("end process transition;");

    }


    log_printf(FUNC,Read_queue,"vhdl_body","End");
  };

}; // end namespace read_queue
}; // end namespace read_unit
}; // end namespace multi_read_unit
}; // end namespace execute_loop
}; // end namespace multi_execute_loop
}; // end namespace core

}; // end namespace behavioural
}; // end namespace morpheo              
#endif
