orca-sim
NetworkTile.cpp
Go to the documentation of this file.
1 
22 #include <iostream>
23 #include <sstream>
24 
25 
26 //model API
27 #include <TDmaNetif.h>
28 #include <TRouter.h>
29 #include <UMemory.h>
30 #include <TNetBridge.h>
31 
32 #include <NetworkTile.h>
33 
38 NetworkTile::NetworkTile(uint32_t x, uint32_t y) : Tile(x, y){
39 
40  //update naming of internal hardware parts (from internal class)
41  this->GetRouter()->SetName(this->GetName() + ".router");
42 
43  //peripherals
44  _socket = new NetBridge(this->GetName() + ".bridge");
45 
46  _socket->SetOutputBuffer(this->GetRouter()->GetInputBuffer(LOCAL));
47  this->GetRouter()->SetOutputBuffer(_socket->GetInputBuffer(), LOCAL);
48 }
49 
51 
52  delete(_socket);
53 }
54 
56  return _socket;
57 }
58 
59 std::string NetworkTile::ToString(){
60  stringstream ss;
61  ss << _name << "={" << _socket->GetName()
62  << ", " << this->GetRouter()->GetName() << "}";
63 
64  return ss.str();
65 }
NetBridge * _socket
Definition: NetworkTile.h:50
NetworkTile(uint32_t x, uint32_t y)
This file is part of project URSA.
Definition: NetworkTile.cpp:38
std::string _name
Definition: NetworkTile.h:49
#define LOCAL
std::string GetName()
Get current tile name.
Definition: Tile.cpp:92
HermesRouter * GetRouter()
Get current router of the PE.
Definition: Tile.cpp:83
NetBridge * GetSocket()
Definition: NetworkTile.cpp:55
Definition: Tile.h:44
std::string ToString()
Definition: NetworkTile.cpp:59