/*
 * 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 IRQ_HANDLER_H
#define IRQ_HANDLER_H

#include <systemc>
#include "my_interfaces.h"

SC_MODULE(IrqHandler)
{
protected:
  SC_HAS_PROCESS(IrqHandler);
  
public:
  sc_in<bool>  p_clk;
  sc_in<bool>  p_resetn;

  IRQ_IN       *irq_in;
  IRQ_OUT      irq_out;

  IrqHandler(sc_module_name name, size_t nirq);
  ~IrqHandler();

private:
  void transition();
  void genMoore();

  sc_signal<bool>             interrupt_s;
  sc_signal<int> type_s;
  sc_signal<int> op_s;
  sc_signal<addr_t>           addr_s;

  sc_signal<size_t>     irq_n_s;

  size_t m_nirq;
};    

#endif
