-
Notifications
You must be signed in to change notification settings - Fork 12
GEMSExplained
This page describes how GEMS memory simulator has been connected to topaz, and how to use it in your simulations. The approach used keeps both simulators fully issolated. TOPAZ is designed with a "agnostic" interface, to make it work within any full-system symulator. Actually TOPAZ has been successfully connected to RSIM, SimOS, GEMS, and GEM5.
The idea is simple, every time Full-system simulator tries to send a message to the network, a TOPAZ message is created and a pointer to the intended message is appended as externalInfo. This message is injected in TOPAZ and full system simulator will be notified with the sent message at destination. In the case of ruby, we need a interface to perform such actions. This interface is located at ruby/network/simple/PerfectSwitch.C
and a simplified sketch is:
//
// Every time a event for a PerfectSwith object reach the head of ruby event queue this is executed
//
void PerfectSwitch::wakeup()
{
if(TOPAZ_IS_ENABLED)
//in_queue connects the switch to the coherency controller
gems_message = peekMessageFrom(in_queue);
//Copies gems_message contents in topaz message
topaz_message = topaz.createMessage(gems_message);
//Send the message to topaz
topaz.sendMessage( topaz_message);
if ( PerfectSwitch.id() == 0)
{
//Clock edge is sent to topaz
schedule(this->wakeUpTopaz(),1);
}
else
{
//We can use simultaneously both simulators
Simple_network_perfect_switch_wakeup;
}
}
void PerfectSwitch::WakeUpTopaz()
{
if(ruby_clock*ruby_topaz_clock_ratio < topaz.clock)
{
//Topaz simulation is run for the predefined clock ratio
//runs in a separate thread in MTOPAZ
topaz.run(ruby_topaz_clock_ratio);
}
//We grab all potential messages received at TOPAZ consumers (Exlusive in MTOPAZ)
out_queue = topaz->getMessagesReceived();
//If there are messages inside TOPAZ we schedule next clock edge
if( topaz.PerfectSwitch.id() == 0 && topaz.anyMessageInNetwork() != 0)
{
schedule(this->wakeUpTopaz(),1);
}
}