Jump to content

Syncing multiple clocks


richpodraza

Recommended Posts

I have roughly the following clock scheme set up

double refclk_period = 8000;
double ck1_ratio = 10;
double ck2_ratio = 5;
double ck3_ratio = 6;


sc_clock refclk("refclk", refclk_period, SC_PS);
sc_clock ck1("ck1", refclk_period/ck1_ratio, SC_PS);
sc_clock ck2("ck2", refclk_period/ck2_ratio, SC_PS);
sc_clock ck3("ck3", refclk_period/ck3_ratio, SC_PS);

Then I have SC_THREADs sensitive to each clock's pos(). I've realized a problem which is that eventually ck3 will get quite out of sync since it does not divide the refclk period evenly. For example at 8000 ps, the SC_THREAD watching ck3 last hit at 7998 ps. Ideally all the clocks should be firing at 8000 ps.

This has got to be a common problem. Is there a recommended way to sync clocks with SystemC? Thanks!

Link to post
Share on other sites

Hi, there's no explicit support for synchronizing clocks in SystemC.

Your solution of choosing "nice numbers" makes sense.

Regarding your comment

"This has got to be a common problem."

may not be true :-) Most industry use of SystemC is for virtual prototyping, which generally doesn't use clocks. People do use SystemC for synthesis of course, but then your problem is similar in any hardware description language (and in real hardware as well, hence the use of frequency synthesis techniques for clock division and multiplication on modern FPGAs).

regards

Alan

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...