/*
 * SecBus - This file is part of SecBus
 * Copyright (C) 2012 - Telecom ParisTech
 * 
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at    
 * http://www.cecill.info/licences/Licence_CeCILL_V1.1-US.txt
 *
 */

#ifndef _GEN_CMD_FIFO_H
#define _GEN_CMD_FIFO_H

#include <systemc>

#include "my_interfaces.h"

template<typename in, typename out, typename signal>
SC_MODULE(GenericCmdFifo)
{
protected:
  SC_HAS_PROCESS(GenericCmdFifo);

public:
  sc_in<bool> p_clk;
  sc_in<bool> p_resetn;

  in input;
  out output;

  GenericCmdFifo(sc_module_name name);
  ~GenericCmdFifo();

private:
  signal signals;

  enum fsm_state_e
  {
    FSM_IDLE,
    FSM_CMD,
    FSM_WAIT
  };

  sc_signal<int> fsm_s;

  void transition();
  void genMoore();
};

#endif
