Jump to content

Assembling submodule status bits in a word


katang

Recommended Posts

My submodules have status bits  like

    sc_out<bool> Pooled;// If this module is in the pool

in the module, I have

    sc_in< sc_dt::sc_uint<No_OF_SUBMODULES> > Pooled;//status bits of the modules

What is the best way of connecting the individual bits to the corresponding bits of the word?

(I want to activate the main module upon status change in any of the submodules)

Link to comment
Share on other sites

There is no predefined way. You would have to have No_OF_SUBMODULES sc_signal<bool> connecting to the sc_out<bool>, one sc_signal<sc_dt::sc_uint<No_OF_SUBMODULES>> connecting to the sc_in<..>, and a SC_METHOD. The method needs to be sensitive to the bool signals, assemble the sc_uint and write it to the sc_uint signal.

HTH

Link to comment
Share on other sites

7 hours ago, katang said:

You are right, but I have a high number of modules, and it is a very ugly code to be sensitive to so many signals. If my submodules (working concurrently) are manipulating sc_uint, I have synchronization issues.

Can you explain what you mean by "ugly"?  You don't want to create many events?  Or you don't want to connect every module manually?

Second problem can be solved with a loop.

Link to comment
Share on other sites

Maybe you are right, but I have not yet seen "sensitive" in a loop. I am not used to that style, that is all.

BTW: In this way the bits of a word are changed in a concurrent way.  As the single bits from the submodules are connected individually to the bits of the word in the module, I guess there might not be any hazard in the electronic implementation. Also, as long as SystemC routines are executed in one thread, similarly no problem in the simulator. Am I right? In the future multithread versions of SystemC, may this change?

Link to comment
Share on other sites

1 hour ago, katang said:

BTW: In this way the bits of a word are changed in a concurrent way.  As the single bits from the submodules are connected individually to the bits of the word in the module, I guess there might not be any hazard in the electronic implementation. Also, as long as SystemC routines are executed in one thread, similarly no problem in the simulator. Am I right? In the future multithread versions of SystemC, may this change?

Check section 4.2 "Simulation" of SystemC standard. Values of signals change in "Update Phase", so they don't depend on process evaluation order. 

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.

×
×
  • Create New...