Jump to content
Sign in to follow this  
katang

How to share a clock among modules as parameter?

Recommended Posts

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

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.

Sign in to follow this  

×
×
  • Create New...