Jump to content
rfajardo

VCD File Timescale - VCD Trace set_time_unit()

Recommended Posts

Hello everyone,

I have noticed that when using the sc_time_unit (X, SC_US), the timescale in the resulting file is missing. SC_NS, SC_MS work well for example.

The time marks are set correctly, only the timescale is missing. Output below.

Best regards,

Raul

System: SystemC-2.3.0 on MSVS2010

SC_NS:

$date

Feb 28, 2013 13:37:30

$end

$version

SystemC 2.3.0-ASI --- Feb 22 2013 08:38:45

$end

$timescale

1 ns

$end

$scope module SystemC $end

$var wire 1 aaa HSS-PWM $end

...

SC_US:

$date

Feb 28, 2013 13:42:21

$end

$version

SystemC 2.3.0-ASI --- Feb 22 2013 08:38:45

$end

$scope module SystemC $end

$var wire 1 aaa HSS-PWM $end

...

Share this post


Link to post
Share on other sites

I'd say, this depends on the X, you're supplying to the set_time_unit call. It is currently not enforced that this X needs to be a power of 10, according to 8.1.2 in the 1666-2011 standard.

Can you post a minimal example demonstrating the problem?

Opening a trace file, adding a single variable/signal, calling sc_start() and closing the file again should be enough.

/Philipp

Share this post


Link to post
Share on other sites

I'd say it does not.

Below you can see an example. I tried to attach it. But I am not allowed to.

Raul

#include <systemc.h>

SC_MODULE(Testbench)
{
 sc_trace_file * traceFile;
 sc_signal<bool> toggle_o;
 void toggle();
 SC_CTOR(Testbench)
 {
   toggle_o = 0;
   traceFile = sc_create_vcd_trace_file("testbench");
   traceFile->set_time_unit(10, SC_US);
   sc_trace(traceFile, toggle_o, "toggle_o");
   SC_THREAD(toggle);
 }
 ~Testbench()
 {
   sc_close_vcd_trace_file(traceFile);
 }
};

void Testbench::toggle()
{
 while(true)
 {
   toggle_o = !toggle_o;
   wait(100, SC_US);
 }
}

int sc_main(int argc, char * argv[])
{
 Testbench testbench("Testbench");
 sc_start(500, SC_US);            //simulate for 500 microseconds
 return 0;
}

Share this post


Link to post
Share on other sites

Hello,

As I have not seen your code, I cannot comment in any great depth,

but from my experience, setting the time unit for the VCD tracing is

both straightforward and tricky, depending on the design at hand. If

there is only one clock, no issues. If there are more than one clock,

you have no option but experiment. Hope this helps.

Share this post


Link to post
Share on other sites

Raul,

ok, I can confirm your problem and this is a bug in the ASI proof-of-concept implementation.

Thanks for reporting it, I'll forward it to the LWG to get it fixed in the next release.

As a workaround, you can work around the issue by using sc_time and SC_SEC as time unit:

//	traceFile->set_time_unit(10, SC_US);
traceFile->set_time_unit(sc_time(10, SC_US).to_seconds(), SC_SEC);

Greetings from Oldenburg,

Philipp

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...