www.pudn.com > noc.rar > oqueue.h


/*
 *  TU Eindhoven
 *  Eindhoven, The Netherlands
 *
 *  Name            :   oqueue.h
 *
 *  Author          :   A.S.Slusarczyk@tue.nl
 *
 *  Date            :   13-09-2003
 *
 *  Function        :   Output queue of the e-cube router
 *
 *
 */


#ifndef OQUEUE_H_INCLUDED
#define OQUEUE_H_INCLUDED

#include 
#include "net_dim.h"


SC_MODULE(OUTPUT_QUEUE)
{
  sc_in clk, rst;
  
  // signals to the outside (network)
  sc_in< bool > ack;
  sc_out< bool > req;
  sc_out< sc_bv > data;
  
  // signals to/from crossbar
  sc_in< bool > req_in;
  sc_out< bool > ack_in;
  sc_in< sc_bv > data_in;
  
  // control FSM
  enum state { EMPTY, BUFFERING };
#ifdef VERILOG
  sc_signal current_state, next_state;
#else
  sc_signal current_state, next_state;
#endif
  
  void control_logic();
  void control_change_state();
  
  // buffer for a flit
  sc_signal< sc_bv > buffer;
  sc_signal< bool > buffer_write;
  sc_signal< bool > buffer_clear;
  
  void buffer_process();
  
  void data_out();
    
  SC_CTOR(OUTPUT_QUEUE)
	{
	  SC_METHOD(control_logic);
	  sensitive << current_state << req_in << ack;
	  
	  SC_METHOD(control_change_state);
	  sensitive_pos << clk << rst;
	  
	  SC_METHOD(buffer_process);
	  sensitive_pos << clk;
	  
	  SC_METHOD(data_out);
	  sensitive << buffer;
	}
  
};


#endif