int_links.append(IntLink(link_id=link_count,
src_node=routers[east_out],
dst_node=routers[west_in],
+ src_outport="East",
+ dst_inport="West",
weight=1))
link_count += 1
int_links.append(IntLink(link_id=link_count,
src_node=routers[west_out],
dst_node=routers[east_in],
+ src_outport="West",
+ dst_inport="East",
weight=1))
link_count += 1
int_links.append(IntLink(link_id=link_count,
src_node=routers[north_out],
dst_node=routers[south_in],
+ src_outport="North",
+ dst_inport="South",
weight=2))
link_count += 1
int_links.append(IntLink(link_id=link_count,
src_node=routers[south_out],
dst_node=routers[north_in],
+ src_outport="South",
+ dst_inport="North",
weight=2))
link_count += 1
cxx_header = "mem/ruby/network/BasicLink.hh"
ext_node = Param.RubyController("External node")
int_node = Param.BasicRouter("ID of internal node")
- bandwidth_factor = 16
+ bandwidth_factor = 16 # only used by simple network
class BasicIntLink(BasicLink):
type = 'BasicIntLink'
cxx_header = "mem/ruby/network/BasicLink.hh"
src_node = Param.BasicRouter("Router on src end")
dst_node = Param.BasicRouter("Router on dst end")
+
+ # only used by Garnet.
+ src_outport = Param.String("", "Outport direction at src router")
+ dst_inport = Param.String("", "Inport direction at dst router")
+
+ # only used by simple network
bandwidth_factor = 16
: ClockedObject(p)
{
m_id = p->router_id;
+ m_latency = p->latency;
}
void
// ID in relation to other routers in the system
//
uint32_t m_id;
+ uint32_t m_latency;
};
inline std::ostream&
type = 'BasicRouter'
cxx_header = "mem/ruby/network/BasicRouter.hh"
router_id = Param.Int("ID in relation to other routers")
+ latency = Param.Cycles(1, "number of cycles inside router")
virtual void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry) = 0;
virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry) = 0;
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport) = 0;
virtual void collateStats() = 0;
virtual void print(std::ostream& out) const = 0;
BasicRouter *router_src = int_link->params()->src_node;
BasicRouter *router_dst = int_link->params()->dst_node;
+ PortDirection src_outport = int_link->params()->src_outport;
+ PortDirection dst_inport = int_link->params()->dst_inport;
+
// Store the IntLink pointers for later
m_int_link_vector.push_back(int_link);
int dst = router_dst->params()->router_id + 2*m_nodes;
// create the internal uni-directional link from src to dst
- addLink(src, dst, int_link);
+ addLink(src, dst, int_link, src_outport, dst_inport);
}
}
}
void
-Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link)
+Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link,
+ PortDirection src_outport_dirn,
+ PortDirection dst_inport_dirn)
{
assert(src <= m_number_of_switches+m_nodes+m_nodes);
assert(dest <= m_number_of_switches+m_nodes+m_nodes);
src_dest_pair.first = src;
src_dest_pair.second = dest;
link_entry.link = link;
+ link_entry.src_outport_dirn = src_outport_dirn;
+ link_entry.dst_inport_dirn = dst_inport_dirn;
m_link_map[src_dest_pair] = link_entry;
}
link_entry = m_link_map[src_dest];
net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
link_entry.link,
- routing_table_entry);
+ routing_table_entry,
+ link_entry.src_outport_dirn,
+ link_entry.dst_inport_dirn);
}
}
class Network;
typedef std::vector<std::vector<int> > Matrix;
+typedef std::string PortDirection;
struct LinkEntry
{
BasicLink *link;
LinkDirection direction;
+ PortDirection src_outport_dirn;
+ PortDirection dst_inport_dirn;
};
typedef std::map<std::pair<SwitchID, SwitchID>, LinkEntry> LinkMap;
void print(std::ostream& out) const { out << "[Topology]"; }
private:
- void addLink(SwitchID src, SwitchID dest, BasicLink* link);
+ void addLink(SwitchID src, SwitchID dest, BasicLink* link,
+ PortDirection src_outport_dirn = "",
+ PortDirection dest_inport_dirn = "");
void makeLink(Network *net, SwitchID src, SwitchID dest,
const NetDest& routing_table_entry);
void
GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry)
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport)
{
GarnetIntLink_d* garnet_link = safe_cast<GarnetIntLink_d*>(link);
NetworkLink_d* net_link = garnet_link->m_network_links[0];
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry);
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport);
//! Function for performing a functional write. The return value
//! indicates the number of messages that were written.
void
GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry)
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport)
{
GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[0];
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry);
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport);
//! Function for performing a functional read. The return value
//! indicates if a message was found that had the required address.
// From a switch to a switch
void
SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry)
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport)
{
// Create a set of new MessageBuffers
std::vector<MessageBuffer*> queues(m_virtual_networks);
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
- const NetDest& routing_table_entry);
+ const NetDest& routing_table_entry,
+ PortDirection src_outport,
+ PortDirection dst_inport);
void print(std::ostream& out) const;