00001 #ifndef _NETSIM_MODEL_H
00002 #define _NETSIM_MODEL_H
00003 #include <boost/serialization/vector.hpp>
00004 #include <boost/serialization/list.hpp>
00005 #include <sst/core/cpunicEvent.h>
00006 #include <sst/core/link.h>
00007
00008
00009
00010 void add_snd_completion(SST::Link *Qdest, int response, int status, int msg_len,
00011 uint64_t msg_match_bits, uint64_t msg_user_data);
00012
00013 void add_rcv_completion(SST::Link *Qdest, SST::CPUNicEvent *e, int response,
00014 int status, int msg_len, uint64_t msg_match_bits, uint64_t msg_user_data,
00015 uint64_t buf);
00016
00017
00018
00019 class UnexpectedQ {
00020 public:
00021 UnexpectedQ() {
00022
00023 unexpectedQ= new std::list<SST::CPUNicEvent *>;
00024 }
00025
00026 ~UnexpectedQ() {
00027 delete unexpectedQ;
00028 }
00029
00030 void completion_link(SST::Link *link) {
00031 completion= link;
00032 }
00033
00034 bool find(uint64_t match_bits, uint64_t ignore_bits, uint64_t user_data,
00035 uint32_t requested_len, uint64_t buf);
00036
00037 void insert(SST::CPUNicEvent *e);
00038
00039
00040 private:
00041 std::list<SST::CPUNicEvent *> *unexpectedQ;
00042 SST::Link *completion;
00043
00044 friend class boost::serialization::access;
00045 template<class Archive>
00046 void serialize(Archive & ar, const unsigned int version )
00047 {
00048 _AR_DBG(UnexpectedQ, "\n");
00049 ar & BOOST_SERIALIZATION_NVP(unexpectedQ);
00050 ar & BOOST_SERIALIZATION_NVP(completion);
00051 _AR_DBG(UnexpectedQ, "\n");
00052 }
00053
00054 };
00055
00056
00057
00058
00059 class PostedQ {
00060 public:
00061 PostedQ() {
00062
00063 postedQ= new std::list<post_t>;
00064 }
00065
00066 ~PostedQ() {
00067 delete postedQ;
00068 }
00069
00070 void completion_link(SST::Link *link) {
00071 completion= link;
00072 }
00073
00074 void post(uint64_t buf, uint32_t msgSize, uint64_t match_bits,
00075 uint64_t ignore_bits, uint64_t user_data);
00076
00077 bool match(SST::CPUNicEvent *event);
00078
00079 private:
00080 typedef struct post_t {
00081 uint64_t buf;
00082 uint32_t msgSize;
00083 uint64_t match_bits;
00084 uint64_t ignore_bits;
00085 uint64_t user_data;
00086 friend class boost::serialization::access;
00087 template<class Archive>
00088 void serialize(Archive & ar, const unsigned int version )
00089 {
00090 ar & BOOST_SERIALIZATION_NVP(buf);
00091 ar & BOOST_SERIALIZATION_NVP(msgSize);
00092 ar & BOOST_SERIALIZATION_NVP(match_bits);
00093 ar & BOOST_SERIALIZATION_NVP(ignore_bits);
00094 ar & BOOST_SERIALIZATION_NVP(user_data);
00095 }
00096 } post_t;
00097
00098 std::list<post_t> *postedQ;
00099 SST::Link *completion;
00100
00101 friend class boost::serialization::access;
00102 template<class Archive>
00103 void serialize(Archive & ar, const unsigned int version )
00104 {
00105 _AR_DBG(PostedQ, "\n");
00106 ar & BOOST_SERIALIZATION_NVP(postedQ);
00107 ar & BOOST_SERIALIZATION_NVP(completion);
00108 _AR_DBG(PostedQ, "\n");
00109 }
00110
00111 };
00112
00113
00114 #endif // _NETSIM_MODEL_H