inline void MOESI_protocol::do_snoop_IS (Mreq *request) { switch (request->msg) { case GETS: case GETM: /** While in IS we will see our own GETS or GETM on the bus. We should just * ignore it and wait for DATA to show up. */ break; case DATA: /** IS state meant that the block had sent the GET and was waiting on DATA. * Now that Data is received we can send the DATA to the processor and finish * the transition to M. */ send_DATA_to_proc(request->addr); if(true==get_shared_line()) { state = MOESI_CACHE_S; } else { state = MOESI_CACHE_E; } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: I state shouldn't see this message\n"); } }
inline void MOESI_protocol::do_snoop_ISE (Mreq *request){ switch (request->msg) { case GETS: case GETM: break; case DATA: if (get_shared_line() == true) state = MOESI_CACHE_S; else state = MOESI_CACHE_E; send_DATA_to_proc(request->addr); break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: ISE state shouldn't see this message\n"); } }
inline void MOESI_protocol::do_snoop_IS (Mreq *request){ switch (request->msg){ case GETS: case GETM: break; case DATA: send_DATA_to_proc(request->addr); if(get_shared_line()) //IF DATA IS SHARED NEXT STATE IS SHARED STATE ELSE EXCLUSIVE STATE state = MOESI_CACHE_S; else state = MOESI_CACHE_E; break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: IS state shouldn't see this message\n"); } }
inline void MOESI_protocol::do_snoop_SM (Mreq *request) { switch (request->msg) { case GETS: set_shared_line(); if(-1!=Owner_nodeID) { //give data send_DATA_on_bus(request->addr,request->src_mid); } break; case GETM: if( (-1!=Owner_nodeID) && (false==get_shared_line()) ) { //give data set_shared_line(); send_DATA_on_bus(request->addr,request->src_mid); } if (request->src_mid.nodeID != Owner_nodeID) { //Change state state = MOESI_CACHE_IM; Owner_nodeID = -1; } break; case DATA: Owner_nodeID = -1; //Get data send_DATA_to_proc(request->addr); //Change to modify state state = MOESI_CACHE_M; break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: State shouldn't see this message\n"); } }
inline void MSI_protocol::do_snoop_S (Mreq *request) { switch (request->msg) { case GETS: break; case GETM: state = MSI_CACHE_I; break; case DATA: if (get_shared_line()) { } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: S state shouldn't see this message\n"); } }
inline void MOESIF_protocol::do_snoop_OM (Mreq *request) { switch (request->msg) { case GETS: case GETM: set_shared_line(); send_DATA_on_bus(request->addr,request->src_mid); break; case DATA: send_DATA_to_proc(request->addr); state = MOESIF_CACHE_M; if (get_shared_line()) { } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: OM state shouldn't see this message\n"); } }
inline void MESI_protocol::do_snoop_IS (Mreq *request) { switch (request->msg) { case GETS: case GETM: break; case DATA: // Send the data up send_DATA_to_proc(request->addr); // Check if there are other copies in other processors. If so // then we go to the shared state, otherwise go to exclusive if (get_shared_line()) state = MESI_CACHE_S; else { state = MESI_CACHE_E; set_shared_line(false); } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client SnoopIS state shouldn't see this message\n"); } }
inline void MSI_protocol::do_snoop_IM (Mreq *request) { switch (request->msg) { case GETS: case GETM: /** While in IM we will see our own GETS or GETM on the bus, there is no practical * way, in this project, to detect that the request is our own. We may also see other * caches make GETS or GETM requests. Since we came from I, we can ignore these * requests and wait for DATA to show up. In other protocols with other intermediate * states, the cache will have come from a different state, and then * it might need to respond and possibly transition while waiting to receive data. */ break; case DATA: /** IM state meant that the block had sent the GET and was waiting on DATA. * Now that Data is received we can send the DATA to the processor and finish * the transition to M. */ /** * Note we use get_shared_line() here to demonstrate its use. * (Hint) The shared line indicates when another cache has a copy and is useful * for knowing when to go to the E/S state. * Since we only have I and M state in the MI protocol, what the shared line * means here is whether a cache sent the data or the memory controller. */ send_DATA_to_proc(request->addr); state = MSI_CACHE_M; if (get_shared_line()) { // Nothing to do for MI protocol } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: IM state shouldn't see this message\n"); } }
inline void MESI_protocol::do_snoop_IS (Mreq *request) { switch (request->msg) { case GETS: case GETM: /** While in IS we will see our own GETS or GETM on the bus. We should just * ignore it and wait for DATA to show up. */ break; case DATA: /** IS state meant that the block had sent the GET and was waiting on DATA. * Now that Data is received we can send the DATA to the processor and finish * the transition to M. */ /** * Note we use get_shared_line() here to demonstrate its use. * (Hint) The shared line indicates when another cache has a copy and is useful * for knowing when to go to the E/S state. * Since we only have I and M state in the MI protocol, what the shared line * means here is whether a cache sent the data or the memory controller. */ if (get_shared_line()) { send_DATA_to_proc(request->addr); state = MESI_CACHE_S; } else { send_DATA_to_proc(request->addr); state = MESI_CACHE_E; } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: I state shouldn't see this message\n"); } }
inline void MOESIF_protocol::do_snoop_IS (Mreq *request) { switch (request->msg) { case GETS: break; case GETM: break; case DATA: send_DATA_to_proc(request->addr); /* Once we receive the data in IS, we check the shared line to see if any other nodes currently have this data; if they don't we go to E, otherwise we go to S. */ if (get_shared_line()) { state = MOESIF_CACHE_S; } else { state = MOESIF_CACHE_E; } break; default: request->print_msg (my_table->moduleID, "ERROR"); fatal_error ("Client: IS state shouldn't see this message\n"); } }