Jump to content

Passing collected events to sensitive


gmohler

Recommended Posts

Hi,

I'm using systemC to simulate a hierarchy of objects, where only the bottom of the hierarchy and the top are systemC modules.  The objects in-between are organizational elements that allow me to create arbitrary collections of the bottom elements that I can then stamp out and efficiently wire to the top module.  I want to both automate and hide the ports and channels necessary at each level. A stumbling block I've hit is how to handle the sensitivity of the top object.  Currently I have as a method in the top object:

    SC_METHOD(send_op);
    for (int j=0;j<numRanks;j++) {
      for (int i=0;i<numPawns;i++) {
        sensitive << myRank[j]->receiveReady[i];
      }
    }

where Rank is the middle, non-SystemC organizing object, and the Pawns are the bottom-level SystemC objects that send a "Ready" event to the top object.

I'd like to have

    SC_METHOD(send_op);
    for (int j=0;j<numRanks;j++) {
      sensitive << myRank[j]->get_sensitivities_from_rank();
    }
  

where get_sensitivies_from_rank is a function that returns the result of sensitive << (loop i over receiveReady[ i ]) for the container object Rank[j].

I can make a similar function that passes a collection of outputs for cout by using the ostream family, but this seems to be a much more sophisticated problem with sensitive.  One of the errors I get appears to be that sensitive requires explicit channels in the << list, and anything indirect won't work.  I've looked at sc_export, but that doesn't seem to work with static sensitivities...? 

I could also be doing this all the hard way; I've been using this as a way to learn systemC, so I'm open to any suggestions.  Full code attached, if that helps.  Thanks!

rank.h

rank.cc

pawn.h

pawn.cc

Makefile

king.h

king.cc

king_pawn_tst.cpp

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...