richpodraza Posted January 18, 2013 Report Share Posted January 18, 2013 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! Quote Link to comment Share on other sites More sharing options...
richpodraza Posted January 18, 2013 Author Report Share Posted January 18, 2013 Note, I've realized I can kind of solve my problem by scaling the clock periods up so the division is even. e.g. make the reference clock period 24000. For the sake of studying the concept though I am still interested in whether explicitly syncing clocks is supported or recommended in SystemC Quote Link to comment Share on other sites More sharing options...
apfitch Posted January 22, 2013 Report Share Posted January 22, 2013 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 maehne and richpodraza 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.