Sign in to follow this  
Followers 0
katang

How to share a clock among modules as parameter?

3 posts in this topic

I want to share a clock between modules. If I attempt to do it like

   sc_core::sc_clock Clock("Clock",sc_core::sc_time(1,sc_core::SC_NS));
    scProc* Proc = new scProc("MY",Clock, 100,100);

then the compiler gives the message

/usr/local/systemc231a/include/sysc/communication/sc_clock.h:169: error: 'sc_core::sc_clock::sc_clock(const sc_core::sc_clock&)' is private
     sc_clock( const sc_clock& );
     ^

If I (after changing the signatures correspondingly)
 

   sc_core::sc_clock Clock("Clock",sc_core::sc_time(1,sc_core::SC_NS));
    scProc* Proc = new scProc("EMPA",&Clock, 100,100);

then the code compiles, but in runtime presents with the error message

Error: (E109) complete binding failed: port not bound: port 'MY.My.port_0' (sc_in)

 

In scProc I have a private member

 sc_core::sc_in_clk     mClock;

and during initialization, I use

mClock(*Clock),

 

Share this post


Link to post
Share on other sites

Hello @katang,

You can use:

sc_core::sc_in<bool> clk;

in your modules and bind them in the top module as a normal sc_in/out port binding operation.

e.g:

// In top module.
// Clock is the system clock object.
some_module_having.clk(Clock);
some_other_module_having.clk(Clock);
some_another_module_having.clk(Clock);

Each of the modules will have public port interface mentioned above.

Regards,

Ameya Vikram Singh

Share this post


Link to post
Share on other sites

Hello @Ameya,

so you say that Clock (in C++ terms) should be global. This is fine, and if you have modules at the same level of hierarchy, I would do so.

What I am thinking about, is a hierarchy, like a many-core processor, where the processor which receives the clock as sc_in

and must drive the cores' sc_in from something like sc_out. How to convert this, and what electronic transformation the different types (in C++) mean ?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0