/*****************************************************************************
 *
 * Copyright (c) 2018-19, Eduard Gerlits, Paula Herber, Josef Treus
 * Westfälische Wilhelms-Universität Münster, AG Embedded Systems 
 * All rights reserved.
 *
 * This file is part of SysCSec
 *
 * SysCSec is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * SysCSec is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with SysCSec.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 *  Please report any problems or bugs to: sysc.sec@uni-muenster.de
 *
 ****************************************************************************/

#ifndef _MODADD_H_
#define _MODADD_H_

#include <systemc.h>

/*
modular addition module
*/

SC_MODULE(ModAddModule){

	/// in

	// First Operand
	sc_in<sc_biguint<160> > x;

	// Second Operand
	sc_in<sc_biguint<160> > y;

	// Modulo value
	sc_in<sc_biguint<160> > m;

	// Enable
	sc_in<bool> en;

	// clock
	sc_in<bool> clk;


	/// out

	// output value
	sc_out<sc_biguint<160> > out;

	// computation finished
	sc_out<bool> done;

	// SystemC Process
	void exe();

	int mode;
	SC_HAS_PROCESS(ModAddModule);
	ModAddModule(sc_module_name name, int mode): sc_module(name){
		this->mode = mode;
		SC_THREAD(exe);
		sensitive << clk;
	}
};

#endif
