Jump to content

SystemC clock time period


Pruthvi Reddy G
 Share

Recommended Posts

If you use sc_clock to generate clock signal, it has a period() method that returns sc_time value for clock period:

sc_clock clk {"clk", 12, SC_NS};
cout << clk.period() << endl;

will print:

12 ns

If you design a clock source manually, you will need to create your own API for such queries. 

Link to comment
Share on other sites

Hi,

 

Thanks for replay.

 

If i bind that clk to my sc_in<bool>  clk.

 

i tried to print the clk.period(); it's giving error because sc_in don't have property of period function.

 

sudo code::

 

design.h ->

 

sc_in<bool> clk

 

void func(){

cout<<clk.period()<<endl;

}

 

 

in main file 

 

sc_clock clk{"clk",10,SC_NS)

 

object.clk(clk)

 

 

i tried this one..But it's giving error i.e period is not a member function

 

 

Thanks

Pruthvi Reddy

Link to comment
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.

 Share

×
×
  • Create New...