gmohler Posted March 13, 2018 Report Share Posted March 13, 2018 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 Quote Link to comment Share on other sites More sharing options...
David Black Posted March 14, 2018 Report Share Posted March 14, 2018 You are specifically referring to static sensitivity. Perhaps you should consider using dynamic sensitivity instead. You can use sc_event_and_list and sc_event_or_list to build up appropriate sensitivities. Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted March 14, 2018 Report Share Posted March 14, 2018 You can write function that will add collection of events to sensitivity. You can even overload operator << if that's what you want. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.