Jump to content
gmohler

Passing collected events to sensitive

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

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

×