Jump to content

How can I bind signals with policy SC_MANY_WRITERS?


Recommended Posts

In my main program, I have declared

sc_signal<bool, SC_MANY_WRITERS> main_full("full");

later I attempt to bind it as


but my compiler keeps saying

no match for call to ‘(sc_core::sc_signal<bool, (sc_core::sc_writer_policy)1>) (sc_core::sc_signal<bool, (sc_core::sc_writer_policy)1>&)’

My other module declares

sc_signal<bool, SC_MANY_WRITERS> fifo_full;

With the other policy, I have no problem with binding.

What do I wrong?





Link to comment
Share on other sites

You cannot bind a signal to another signal. Instead, you have to bind one or more matching ports to your signal. Your sc_signal<bool, SC_MANY_WRITERS> implements sc_signal_inout_if<bool>. Therefore, ports of type sc_in<bool>, sc_out<bool>, and sc_inout<bool> may be bound to that signal. Due you specified the SC_MANY_WRITERS policy, There won't be an error to write to that signal from more than one processes during any given evaluation phase (see clause 6.4.4 of IEEE Std 1666-2011). So, declare fifo_full to be of type sc_out<bool>. Then, binding that port to the signal main_full should work as you stated:


You may also consider using sc_signal_resolved and its ports sc_in_resolved, sc_inout_resolved, and sc_out_resolved, which uses the sc_logic instead of bool (clause 6.13ff in IEEE Std 1666-2011).

Link to comment
Share on other sites

I strongly agree with @maehne that you should consider using sc_signal_resolved unless you guarantee that all the writers will be perfectly synchronized and never disagree with one another. If you don't, you risk race conditions. You might even want to consider using a pullup signal, which you can easily derive from sc_signal_resolved.


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.

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.

  • Create New...