/*****************************************************************************
 *
 * 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
 *
 ****************************************************************************/
#include <systemc.h>
#include "MAP.h"
#include "FW.h"
#include "inputMAP.h"

#define __TIMEOUT__ 1000

int sc_main(int sc_argc, char* sc_argv[]){
	
	// 1.Elaboration

	// instantiate clock 
	sc_clock clk("clk",10, SC_MS);

	// Modules
	InputModule input("input");
	MAPModule map("map");

	// connect clock
	input.clk(clk);
	map.clk(clk);

	/// HARDWARE PORTS (inputMap -> MAP)

	// x
	sc_signal<sc_biguint<160> > x_sig;
	input.x(x_sig);
	map.x(x_sig);

	// y
	sc_signal<sc_biguint<160> > y_sig;
	input.y(y_sig);
	map.y(y_sig);

	// m
	sc_signal<sc_biguint<160> > m_sig;
	input.m(m_sig);
	map.m(m_sig);

	// opcode
	sc_signal<sc_uint<3> > opcode_sig;
	input.opcode(opcode_sig);
	map.opcode(opcode_sig);

	// out
	sc_signal<sc_biguint<160> > out_sig;
	input.out(out_sig);
	map.out(out_sig);

	// done
	sc_signal<bool> done_sig;
	input.done(done_sig);
	map.done(done_sig);

	// 2. Execution

	sc_start(__TIMEOUT__, SC_MS);
	
	return 0;
}
