#include <butterfly.hh>
Inheritance diagram for Butterfly:
Public Member Functions | |
Butterfly (const std::string &_name, int _width, int _clock, int _transDelay, int _arbDelay, int _cpu_count, HierParams *_hier, int _switchDelay, int _radix, int _banks) | |
~Butterfly () | |
void | request (Tick time, int fromID) |
void | send (MemReqPtr &req, Tick time, int fromID) |
void | arbitrate (Tick cycle) |
void | deliver (MemReqPtr &req, Tick cycle, int toID, int fromID) |
void | setBlocked (int fromInterface) |
void | clearBlocked (int fromInterface) |
int | getChannelCount () |
std::vector< int > | getChannelSample () |
void | writeChannelDecriptor (std::ofstream &stream) |
In particular, it handles 2, 4 or 8 processor cores. The reason is that the mapping from interface to butterfly node is defined in the constructor. Since 8 processors are the maximum number used in this work, it was not prioritised to add support for more processors. Furthermore, only radix 2 switches is supported and only L2 caches with 4 banks.
Path diversity can be added to a butterfly by adding extra stages. This implementation has no path diversity.
Definition at line 25 of file butterfly.hh.
Butterfly::Butterfly | ( | const std::string & | _name, | |
int | _width, | |||
int | _clock, | |||
int | _transDelay, | |||
int | _arbDelay, | |||
int | _cpu_count, | |||
HierParams * | _hier, | |||
int | _switchDelay, | |||
int | _radix, | |||
int | _banks | |||
) |
This constructor creates the interface to node mapping for a given number of CPUs. Furthermore, a number of convenience values are computed. Examples of such values are the width and height of the butterfly.
_name | The name given in the configuration file | |
_width | The width of the transmission channels | |
_clock | The number of processor clock cycles in one interconnect clock cycle | |
_transDelay | The transfer delay _per_ _channel_ in the butterfly | |
_arbDelay | Arbitration delay for the Interconnect constructor. This should be set to 0 as there is no explicit arbitration in a butterfly. | |
_cpu_count | The number of cpus in the system | |
_hier | Hierarchy parameters for BaseHier | |
_switchDelay | The delay through the switches in the butterfly | |
_radix | The number of inputs or outputs for each switch (only 2 are supported in this implementation). | |
_banks | The number of L2 banks (only 4 are supported in this implementation). |
Definition at line 9 of file butterfly.cc.
References Interconnect::cpu_count.
Butterfly::~Butterfly | ( | ) | [inline] |
This destructor does nothing.
Definition at line 89 of file butterfly.hh.
void Butterfly::arbitrate | ( | Tick | cycle | ) | [virtual] |
This method is called when an arbitration event is serviced. It attempts to grant access to as many interfaces as possible given the limitations of the butterfly interconnect. Since the request queue is sorted, the older requests are prioritised.
If all requests can not be granted at a given cycle, an arbitration event is scheduled at the next clock cycle if at least one request is old enough to be scheduled at this cycle. If not, an arbitration event is added at the request time + arbitration delay.
cycle | The clock cycle the method is called. |
Implements Interconnect.
Definition at line 162 of file butterfly.cc.
References Interconnect::allInterfaces, Interconnect::arbitratedRequests, Interconnect::arbitrationDelay, Interconnect::totalArbitrationCycles, and Interconnect::totalArbQueueCycles.
void Butterfly::clearBlocked | ( | int | fromInterface | ) | [virtual] |
This method is called when a L2 bank becomes unblocked. If there are waiting requests or deliveries, new arbitration events or deliver events are scheduled respectively.
fromInterface | The ID of the interface that has blocked |
Implements Interconnect.
Definition at line 384 of file butterfly.cc.
References Interconnect::arbitrationDelay, Interconnect::arbitrationEvents, Interconnect::blocked, Interconnect::blockedAt, Interconnect::deliverEvents, Interconnect::numClearBlocked, and Interconnect::transferDelay.
void Butterfly::deliver | ( | MemReqPtr & | req, | |
Tick | cycle, | |||
int | toID, | |||
int | fromID | |||
) | [virtual] |
This method tries to deliver as many requests as possible to its destination. Only, requests that have experienced the defined delay can be delivered. However, if an L2 bank blocks, all requests that are old enough might not be delivered. Since the delivery queue is kept sorted, the oldest requests are delivered first.
Since this class uses a delivery queue, all parameters except cycle are discarded.
req | Not used, must be NULL. | |
cycle | The clock cycle the method is called. | |
toID | Not used, must be -1. | |
fromID | Not used, must be -1. |
Implements Interconnect.
Definition at line 305 of file butterfly.cc.
References Interconnect::allInterfaces, Interconnect::blocked, Interconnect::isSorted(), Interconnect::perCpuTotalTransferCycles, Interconnect::perCpuTotalTransQueueCycles, Interconnect::sentRequests, Interconnect::totalTransferCycles, Interconnect::totalTransQueueCycles, and Interconnect::transferDelay.
int Butterfly::getChannelCount | ( | ) | [virtual] |
This method returns the number of transmission channels in the interconnect and is used by the InterconnectProfile class.
Implements Interconnect.
Definition at line 443 of file butterfly.cc.
Referenced by getChannelSample().
vector< int > Butterfly::getChannelSample | ( | ) | [virtual] |
This method returns the number of cycles the different channels was occupied since it was called last.
Implements Interconnect.
Definition at line 448 of file butterfly.cc.
References getChannelCount().
void Butterfly::request | ( | Tick | time, | |
int | fromID | |||
) | [virtual] |
This method puts the request into a queue and schedules an arbitration event if needed. The request queue is kept sorted in ascending order on the clock cycle it was recieved as this simplifies the arbitration method.
time | The clock cycle the method was called | |
fromID | The interface ID of the requesting interface |
Implements Interconnect.
Definition at line 105 of file butterfly.cc.
References Interconnect::arbitrationDelay, Interconnect::blocked, Interconnect::isSorted(), and Interconnect::requests.
void Butterfly::send | ( | MemReqPtr & | req, | |
Tick | time, | |||
int | fromID | |||
) | [virtual] |
This method is called from an interface when it is granted access. It computes the interface ID of the recipient based on the request given and adds this to a delivery queue. Then, it schedules a delivery event if needed.
req | The memory request to send. | |
time | The clock cycle the method was called at. | |
fromID | The interface ID of the sender interface. |
Implements Interconnect.
Definition at line 128 of file butterfly.cc.
References Interconnect::allInterfaces, Interconnect::blocked, Interconnect::deliverEvents, Interconnect::getTarget(), Interconnect::transferDelay, and Interconnect::width.
void Butterfly::setBlocked | ( | int | fromInterface | ) | [virtual] |
This method is called when a L2 bank blocks. It deschedules all arbitration events and delivery events. Consequently, no requests are delivered to interfaces that are not blocked either.
fromInterface | The ID of the interface that has blocked |
Implements Interconnect.
Definition at line 356 of file butterfly.cc.
References Interconnect::arbitrationEvents, Interconnect::blocked, Interconnect::blockedAt, Interconnect::deliverEvents, Interconnect::numSetBlocked, and Interconnect::waitingFor.
void Butterfly::writeChannelDecriptor | ( | std::ofstream & | stream | ) | [virtual] |
This method writes a description of the different channels to the provided stream.
stream | The output stream to write to. |
Implements Interconnect.
Definition at line 456 of file butterfly.cc.
References Interconnect::allInterfaces, Interconnect::interconnectIDToL2IDMap, and Interconnect::interconnectIDToProcessorIDMap.