Jump to content

SystemC clock time period


Pruthvi Reddy G

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 post
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 post
Share on other sites

Archived

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

×
×
  • Create New...