#include <crossbar.hh>
Inheritance diagram for Crossbar:
Public Member Functions | |
Crossbar (const std::string &_name, int _width, int _clock, int _transDelay, int _arbDelay, int _cpu_count, HierParams *_hier) | |
~Crossbar () | |
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) |
The crossbar modelled in this class differs from the IBM design in a few ways:
Arbitration and transfer in the crossbar are pipelined.
Definition at line 32 of file crossbar.hh.
Crossbar::Crossbar | ( | const std::string & | _name, | |
int | _width, | |||
int | _clock, | |||
int | _transDelay, | |||
int | _arbDelay, | |||
int | _cpu_count, | |||
HierParams * | _hier | |||
) | [inline] |
This constructor initialises a few member variables, but sends all parameters to the Interconnect constructor.
_name | The object name from the configuration file. This is passed on to BaseHier and SimObject | |
_width | The bit width of the transmission lines in the interconnect | |
_clock | The number of processor cycles in one interconnect clock cycle. | |
_transDelay | The end-to-end transfer delay through the interconnect in CPU cycles | |
_arbDelay | The lenght of an arbitration in CPU cycles | |
_cpu_count | The number of processors in the system | |
_hier | Hierarchy parameters for BaseHier |
Definition at line 82 of file crossbar.hh.
Crossbar::~Crossbar | ( | ) | [inline] |
This destructor deletes the request queues that are dynamically allocated when the first request is recieved.
Definition at line 106 of file crossbar.hh.
void Crossbar::arbitrate | ( | Tick | cycle | ) | [virtual] |
The crossbar arbitration method removes the oldest request from each request queue each cycle. The request must have experienced the specified arbitration delay to be eligible for being granted access. If all requests can not be granted, it attempts to schedule a new arbitration event.
cycle | The clock cycle the method was called. |
Implements Interconnect.
Definition at line 72 of file crossbar.cc.
References Interconnect::allInterfaces, Interconnect::arbitratedRequests, Interconnect::arbitrationDelay, Interconnect::blocked, Interconnect::totalArbitrationCycles, and Interconnect::totalArbQueueCycles.
void Crossbar::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 366 of file crossbar.cc.
References Interconnect::arbitrationEvents, Interconnect::blocked, Interconnect::blockedAt, Interconnect::deliverEvents, and Interconnect::numClearBlocked.
void Crossbar::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 285 of file crossbar.cc.
References Interconnect::allInterfaces, Interconnect::blocked, Interconnect::isSorted(), Interconnect::perCpuTotalTransferCycles, Interconnect::perCpuTotalTransQueueCycles, Interconnect::sentRequests, Interconnect::totalTransferCycles, Interconnect::totalTransQueueCycles, and Interconnect::transferDelay.
int Crossbar::getChannelCount | ( | ) | [inline, virtual] |
This method returns the number of transmission channels and is used by the InterconnectProfile class. In this crossbar implementation, the number of channels is the number of interfaces plus the shared bus.
Implements Interconnect.
Definition at line 191 of file crossbar.hh.
References Interconnect::allInterfaces.
vector< int > Crossbar::getChannelSample | ( | ) | [virtual] |
This method returns the number of cycles the different channels was occupied since it was called last.
Implements Interconnect.
Definition at line 428 of file crossbar.cc.
void Crossbar::request | ( | Tick | time, | |
int | fromID | |||
) | [virtual] |
The request method administrates one queue for each transmission channel. All channels are kept sorted to simplify arbitration. If an arbitration event is needed, this method adds one.
time | The clock cycle the method was called | |
fromID | The interface ID of the requesting interface |
Implements Interconnect.
Definition at line 8 of file crossbar.cc.
References Interconnect::allInterfaces, Interconnect::arbitrationDelay, Interconnect::blocked, and Interconnect::requests.
void Crossbar::send | ( | MemReqPtr & | req, | |
Tick | time, | |||
int | fromID | |||
) | [virtual] |
The send method is called when an interface is granted access and finds the destination interface from the values in the request. Then, it adds the request to a delivery queue and 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 233 of file crossbar.cc.
References Interconnect::allInterfaces, Interconnect::blocked, Interconnect::deliverEvents, Interconnect::getTarget(), Interconnect::transferDelay, and Interconnect::width.
void Crossbar::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 336 of file crossbar.cc.
References Interconnect::arbitrationEvents, Interconnect::blocked, Interconnect::blockedAt, Interconnect::deliverEvents, Interconnect::numSetBlocked, and Interconnect::waitingFor.
void Crossbar::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 442 of file crossbar.cc.
References Interconnect::allInterfaces.