Jump to content

Recommended Posts

Your problem description is a bit vague. Did the errors really occur when you tried to compile the unmodified QPSK example? The warnings you are showing point to a file header.h, which does neither exist in the SystemC-AMS PoC simulator sources nor the TUV library sources.

You should check the lines referenced by the compiler warnings to understand the cause of the warnings. Probably, std::time_t is on your platform 64 bit long whereas unsigned int is 32 bit long. Try to use unsigned long instead.

Nevertheless, the warnings are most probably unrelated to why no VCD trace files get generated. Tracing is usually set up in the sc_main() function (located in main.cpp in the QPSK example). First a handle for the trace file needs to be created with sca_util::sca_create_vcd_trace_file(). Then, the signals to be traced have to be selected by calling sca_util::sca_trace() on them. After simulation (sc_start() call), the trace file needs to be closed using sca_util::sca_close_vcd_trace_file(). In the QPSK example, tracing is set up to be written to a file named "tr.vcd". You will find it in your current working directory, from where you called the executable.

Share this post


Link to post
Share on other sites

thank you for your time,

i just changed the TUV library name to Header.h and Header.cpp . sorry for the ambiguity of my question.

the program is worked just fine but as i mentioned before... after executing the project and enter the variables there no "tr.vcd" in project directory. I've searched all the sub-folders.  

Actually i write a simple SystemC project and i have same problem(No VCD file). then i tested an example from internet it worked all good (with VCD)

This my systemC code:

#include <systemc.h>
//using namespace sc_core;

class XORgate : public sc_module
{
public:
	sc_in <sc_logic> i1, i2;
	sc_out <sc_logic> o1;
	SC_CTOR(XORgate)
	{
		SC_METHOD(evl);
		sensitive << i1, i2;
	}
	void evl()
	{
		if (i1->read() == i2->read())
			o1->write(SC_LOGIC_1);
		else
			o1->write(SC_LOGIC_0);
	}
};
class AO2gate : public sc_module
{
public:

	sc_in<bool> i1, i2, i3, i4;
	sc_out <sc_logic> o1;
	SC_CTOR(AO2gate)
	{
		SC_METHOD(evl);
		sensitive << i1 << i2 << i3 << i4;
	}
	void evl()
	{
		if (((i1->read() & i2->read()) | (i3->read() & i4->read())) == '1')
			o1->write(SC_LOGIC_1);
		else
			o1->write(SC_LOGIC_0);
	}

};

class oneBitAdder : public sc_module
{
public:

	sc_in < sc_logic > i1, i2, i3;
	sc_out <sc_logic > o1, o2;
	sc_signal <sc_logic> x1;
	XORgate * xor1;
	XORgate * xor2;
	AO2gate * AO2a;

	SC_HAS_PROCESS(oneBitAdder);
	oneBitAdder(sc_module_name);


};


oneBitAdder::oneBitAdder(sc_module_name)
{
	xor1 = new XORgate("xorA");
	(*xor1)(i1, i2, x1);
	xor2 = new XORgate("xorB");
	(*xor2)(x1, i3, o2);
	AO2a = new AO2gate("AO2_gate");
	(*AO2a)(i1, i2, x1, i3, o1);

}

int sc_main(int argc, char **argv)
{
	sc_signal <sc_logic> aData;
	sc_signal <sc_logic> bData;
	sc_signal <sc_logic> cData;
	sc_signal <sc_logic> cOut;
	sc_signal <sc_logic> sOut;

	oneBitAdder *FA1 = new oneBitAdder("FA_instance");
	(*FA1) (aData, bData, cData, cOut, sOut);
	sc_trace_file *dummy = sc_create_vcd_trace_file("dummy_file");
	sc_trace(dummy, aData, "Ain");
	sc_trace(dummy, bData, "Bin");
	sc_trace(dummy, cData, "Cin");
	sc_trace(dummy, sOut, "SUMout");
	sc_trace(dummy, cOut, "CarryOut");

	sc_int <3> intData;
	sc_lv <3> abcData;

	sc_start(15, SC_NS);

	intData = 0;
	int ij = 0;
	do {
		abcData = intData;
		aData = abcData[2];
		aData = abcData[1];
		aData = abcData[0];
		sc_start(15, SC_NS);
		intData = intData + 1;
		sc_start(50, SC_NS);

	} while (++ij < 40);
	sc_start(100, SC_NS);

	return 0;

}

 Would you please tell me what is the problem ??

My main project is about systemc-ams, so please let me know if you figured out whats the problem of TUV examples

Best regards,

elyas

Share this post


Link to post
Share on other sites

In the above example, you forgot to close the trace file after the last call to sc_start(). You have to explicitly call sc_close_vcd_trace_file(dummy) before you return from sc_main(). Otherwise, the trace file is not guaranteed to be complete and flushed to the disk. The same holds true for the equivalent tracing functions in SystemC AMS.

This is essentially equivalent to the file handling with fopen() and fclose() in C, which the original designers of SystemC seem to have tried to mimic as much as possible to not "scare" away hardware designers with "too complex/strange" C++ syntax. ;-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×