#ifndef _MAIN_OSC_SEM_CPP_
#define _MAIN_OSC_SEM_CPP_

#include <systemc.h>
#include "Precision.h"
#include "sc_float.h"
#include "Osc_SEM.h"
#include "Osc_SEM_TB.h"

//Deklarácia TOP modulu
class Main_Osc : public sc_module
{
public:
//Definovanie vnutorných signálov modulu
  //Signály pre konštanty
	sc_signal<sc_float<E, M> > coef0_sc_fl_sig;
	sc_signal<sc_float<E, M> > coef1_sc_fl_sig;
	sc_signal<sc_float<E, M> > Uz_sc_fl_sig;
	sc_signal<sc_float<E, M> > komp_value_sc_fl_sig;
  //
	sc_clock clk_sig;
	sc_signal<bool> rst_sig;
	sc_signal<bool> en_sig;
	sc_signal<sc_float<E, M> > outp_sig;
  //"Handshaking"
	sc_signal<bool> inp_vld_sig;
	sc_signal<bool> inp_rdy_sig;
	sc_signal<bool> outp_vld_sig;
	sc_signal<bool> outp_rdy_sig;

//Instanciovanie modulov BlackBox a BlackBox_TB
	Osc_SEM *dut0;
	Osc_SEM_TB *tb0;
	
//Konštruktor TOP modulu
SC_HAS_PROCESS(Main_Osc);
Main_Osc(sc_module_name nm) : sc_module(nm),
	//Signály pre konštanty
		coef0_sc_fl_sig			("coef0_sc_fl_sig"),
		coef1_sc_fl_sig			("coef1_sc_fl_sig"),
		Uz_sc_fl_sig			("Uz_sc_fl_sig"),
		komp_value_sc_fl_sig	("komp_value_sc_fl_sig"),
	//Vstupy TOP modulu
		clk_sig		("clk_sig", 10, SC_NS),
	//Vstupy do DUT
		rst_sig		("rst_sig"),
		en_sig		("en_sig"),
	//Výstupy z DUT
		outp_sig	("outp_sig"),
	//"Handshaking"
		inp_vld_sig		("inp_vld_sig"),
		inp_rdy_sig		("inp_rdy_sig"),
		outp_vld_sig	("outp_vld_sig"),
		outp_rdy_sig	("outp_rdy_sig")
{
//Instanciovanie DUT, TB
		dut0 = new Osc_SEM("DUT0");
		tb0 = new Osc_SEM_TB("TB0");

//Priradzovanie portov DUT
		dut0->clk(clk_sig);
		dut0->rst(rst_sig);
		dut0->en(en_sig);
		dut0->outp(outp_sig);
	//Vstupné konštanty DUT
		dut0->coef0_sc_fl(coef0_sc_fl_sig);
		dut0->coef1_sc_fl(coef1_sc_fl_sig);
		dut0->Uz_sc_fl(Uz_sc_fl_sig);
		dut0->komp_value(komp_value_sc_fl_sig);
	//"Handshaking" pre DUT
		dut0->inp_vld(inp_vld_sig);
		dut0->inp_rdy(inp_rdy_sig);
		dut0->outp_vld(outp_vld_sig);
		dut0->outp_rdy(outp_rdy_sig);

//Priradzovanie portov TB
		tb0->clk(clk_sig);
		tb0->rst(rst_sig);
		tb0->en(en_sig);
		tb0->outp(outp_sig);
	//Výstupné konštanty DUT
		tb0->coef0_sc_fl(coef0_sc_fl_sig);
		tb0->coef1_sc_fl(coef1_sc_fl_sig);
		tb0->Uz_sc_fl(Uz_sc_fl_sig);
		tb0->komp_value(komp_value_sc_fl_sig);
	//"Handshaking" pre TB
		tb0->inp_vld(inp_vld_sig);
		tb0->inp_rdy(inp_rdy_sig);
		tb0->outp_vld(outp_vld_sig);
		tb0->outp_rdy(outp_rdy_sig);
}//Ukončenie deklarácie TOP modulu

//Deštruktor
	~Main_Osc()
	{
		delete dut0;
		delete tb0;
	}
};
#endif
