Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkpoint: add crossbar initial stubs
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef __CROSSBAR_H__ | ||
#define __CROSSBAR_H__ | ||
|
||
#include "sim/componentbase.h" | ||
#include "util/construction_payload.h" | ||
|
||
extern ComponentCount CrossBarCount; | ||
|
||
//forward declarations | ||
class Packet; | ||
template<class T> class InPortBase; | ||
template<class T> class OutPortBase; | ||
|
||
namespace rigel { | ||
class ConstructionPayload; | ||
} | ||
|
||
class CrossBar : public ComponentBase { | ||
|
||
public: | ||
|
||
CrossBar( | ||
rigel::ConstructionPayload cp, | ||
ComponentCount& count = CrossBarCount | ||
); | ||
|
||
/// component interface | ||
/// required interface | ||
void Dump() {}; | ||
void Heartbeat() {}; | ||
void EndSim() {}; | ||
int PerCycle() {}; | ||
|
||
private: | ||
|
||
int _numports; | ||
|
||
std::vector< InPortBase<Packet*>* > inports; | ||
std::vector< OutPortBase<Packet*>* > outports; | ||
|
||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
#include "interconnect/crossbar.h" | ||
#include "port/port.h" | ||
|
||
ComponentCount CrossBarCount; | ||
|
||
CrossBar::CrossBar( | ||
rigel::ConstructionPayload cp, | ||
ComponentCount& count | ||
) : | ||
ComponentBase(cp.parent, | ||
cp.change_name("CrossBar").component_name.c_str(), | ||
count), | ||
_numports(rigel::NUM_TILES), // FIXME: set dynamically | ||
inports(_numports), | ||
outports(_numports) | ||
{ | ||
// instantiate ports | ||
// TODO: do elsewhere, and connect | ||
for (int i = 0; i < inports.size(); i++) { | ||
inports[i] = new InPortBase<Packet*>( PortName(name(), id(), "in", i) ); | ||
} | ||
|
||
for (int i = 0; i < outports.size(); i++) { | ||
outports[i] = new OutPortBase<Packet*>( PortName(name(), id(), "out", i) ); | ||
} | ||
} | ||
|