38#include "debug/RubyNetwork.hh"
90 i !=
p.routers.end(); ++
i) {
100 i !=
p.netifs.end(); ++
i) {
103 ni->init_net_ptr(
this);
142 [[maybe_unused]]
int router_id =
148 assert(router_id == router->
get_id());
198 DPRINTF(RubyNetwork,
"Enable external bridge for %s\n",
199 garnet_link->
name());
204 dest,
m_routers[dest]->get_vc_per_vnet());
207 m_nis[local_src]->addOutPort(net_link, credit_link, dest,
212 DPRINTF(RubyNetwork,
"Enable internal bridge for %s\n",
213 garnet_link->
name());
216 addInPort(dst_inport_dirn,
221 m_routers[dest]->addInPort(dst_inport_dirn, net_link, credit_link);
271 DPRINTF(RubyNetwork,
"Enable external bridge for %s\n",
272 garnet_link->
name());
275 addInPort(n_bridge, garnet_link->
extCredBridge[LinkDirection_Out]);
278 m_nis[local_dest]->addInPort(net_link, credit_link);
282 DPRINTF(RubyNetwork,
"Enable internal bridge for %s\n",
283 garnet_link->
name());
286 addOutPort(src_outport_dirn,
288 routing_table_entry, link->
m_weight,
294 addOutPort(src_outport_dirn, net_link,
323 std::max(
m_routers[dest]->get_vc_per_vnet(),
340 DPRINTF(RubyNetwork,
"Enable destination bridge for %s\n",
341 garnet_link->
name());
343 m_routers[dest]->addInPort(dst_inport_dirn, n_bridge,
347 m_routers[dest]->addInPort(dst_inport_dirn, net_link, credit_link);
351 DPRINTF(RubyNetwork,
"Enable source bridge for %s\n",
352 garnet_link->
name());
355 addOutPort(src_outport_dirn, n_bridge,
361 m_routers[src]->addOutPort(src_outport_dirn, net_link,
381 return m_nis[local_ni]->get_router_id(vnet);
406 .
name(
name() +
".packet_network_latency")
412 .
name(
name() +
".packet_queueing_latency")
424 .
name(
name() +
".average_packet_vnet_latency")
430 .
name(
name() +
".average_packet_vqueue_latency")
436 .
name(
name() +
".average_packet_network_latency");
441 .
name(
name() +
".average_packet_queueing_latency");
446 .
name(
name() +
".average_packet_latency");
467 .
name(
name() +
".flit_network_latency")
473 .
name(
name() +
".flit_queueing_latency")
485 .
name(
name() +
".average_flit_vnet_latency")
490 .
name(
name() +
".average_flit_vqueue_latency")
496 .
name(
name() +
".average_flit_network_latency");
501 .
name(
name() +
".average_flit_queueing_latency");
506 .
name(
name() +
".average_flit_latency");
517 .
name(
name() +
".ext_in_link_utilization");
519 .
name(
name() +
".ext_out_link_utilization");
521 .
name(
name() +
".int_link_utilization");
523 .
name(
name() +
".avg_link_utilization");
532 for (
int source = 0; source <
m_routers.size(); ++source) {
538 for (
int dest = 0; dest <
m_routers.size(); ++dest) {
542 data_packets->
name(
name() +
".data_traffic_distribution." +
"n" +
543 std::to_string(source) +
"." +
"n" + std::to_string(dest));
546 ctrl_packets->
name(
name() +
".ctrl_traffic_distribution." +
"n" +
547 std::to_string(source) +
"." +
"n" + std::to_string(dest));
557 double time_delta = double(
curCycle() -
rs->getStartCycle());
571 (double(activity) / time_delta);
574 for (
int j = 0; j < vc_load.size(); j++) {
602 out <<
"[GarnetNetwork]";
610 int vnet = route.
vnet;
627 for (
unsigned int i = 0;
i <
m_nis.size(); ++
i) {
648 uint32_t num_functional_writes = 0;
651 num_functional_writes +=
m_routers[
i]->functionalWrite(pkt);
654 for (
unsigned int i = 0;
i <
m_nis.size(); ++
i) {
655 num_functional_writes +=
m_nis[
i]->functionalWrite(pkt);
662 return num_functional_writes;
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
virtual std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
int declare_router(int number_of_inputs, int number_of_outputs, int number_of_vcs_per_vnet, int number_of_buff_per_data_vc, int number_of_buff_per_ctrl_vc)
Topology * m_topology_ptr
static uint32_t m_virtual_networks
std::vector< std::vector< MessageBuffer * > > m_fromNetQueues
NodeID getLocalNodeID(NodeID global_id) const
std::vector< std::vector< MessageBuffer * > > m_toNetQueues
std::vector< std::string > m_vnet_type_names
void createLinks(Network *net)
NetworkBridge * extCredBridge[2]
NetworkBridge * extNetBridge[2]
NetworkBridge * intCredBridge[2]
NetworkBridge * intNetBridge[2]
NetworkLink * m_network_links[2]
CreditLink * m_credit_links[2]
NetworkBridge * dstNetBridge
NetworkBridge * dstCredBridge
NetworkBridge * srcCredBridge
NetworkLink * m_network_link
NetworkBridge * srcNetBridge
CreditLink * m_credit_link
GarnetNetworkParams Params
statistics::Vector m_packet_network_latency
statistics::Formula m_avg_packet_vqueue_latency
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry, PortDirection src_outport_dirn, PortDirection dest_inport_dirn)
uint32_t m_max_vcs_per_vnet
std::vector< VNET_type > m_vnet_type
uint32_t getBuffersPerDataVC()
uint32_t functionalWrite(Packet *pkt)
Function for performing a functional write.
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
std::vector< std::vector< statistics::Scalar * > > m_data_traffic_distribution
void regStats()
Callback to set stat parameters.
statistics::Scalar m_total_ext_in_link_utilization
int get_router_id(int ni, int vnet)
statistics::Formula m_avg_packet_queueing_latency
statistics::Formula m_avg_flit_queueing_latency
bool m_enable_fault_model
statistics::Vector m_flit_queueing_latency
statistics::Formula m_avg_flit_vqueue_latency
statistics::Scalar m_average_link_utilization
void resetStats()
Callback to reset stats.
const char * garnetVersion
statistics::Formula m_avg_flit_network_latency
uint32_t m_buffers_per_ctrl_vc
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
statistics::Formula m_avg_hops
std::vector< NetworkLink * > m_networklinks
bool isFaultModelEnabled() const
statistics::Vector m_flit_network_latency
std::vector< Router * > m_routers
statistics::Vector m_flits_received
statistics::Vector m_packets_received
statistics::Vector m_packets_injected
uint32_t getBuffersPerCtrlVC()
statistics::Scalar m_total_ext_out_link_utilization
statistics::Scalar m_total_int_link_utilization
statistics::Vector m_flits_injected
uint32_t m_buffers_per_data_vc
statistics::Formula m_avg_packet_network_latency
statistics::Formula m_avg_flit_latency
void update_traffic_distribution(RouteInfo route)
std::vector< std::vector< statistics::Scalar * > > m_ctrl_traffic_distribution
std::vector< CreditLink * > m_creditlinks
statistics::Formula m_avg_packet_latency
void print(std::ostream &out) const
statistics::Scalar m_total_hops
statistics::Formula m_avg_packet_vnet_latency
statistics::Formula m_avg_flit_vnet_latency
bool functionalRead(Packet *pkt, WriteMask &mask)
statistics::Vector m_packet_queueing_latency
GarnetNetwork(const Params &p)
statistics::Vector m_average_vc_load
void makeExtInLink(NodeID src, SwitchID dest, BasicLink *link, std::vector< NetDest > &routing_table_entry)
std::vector< NetworkInterface * > m_nis
std::vector< NetworkBridge * > m_networkbridges
void setType(link_type type)
void printFaultVector(std::ostream &out)
void printAggregateFaultProbability(std::ostream &out)
void init_net_ptr(GarnetNetwork *net_ptr)
uint32_t get_vc_per_vnet()
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
This is a simple scalar statistic, like a counter.
Derived & init(size_type size)
Set this vector to have the given size.
const Params & params() const
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
virtual void regStats()
Callback to set stat parameters.
std::string PortDirection
const FlagsType pdf
Print the percent of the total that this entry represents.
const FlagsType oneline
Print all values on a single line.
const FlagsType nozero
Don't print if this is zero.
const FlagsType total
Print the total.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T safe_cast(U &&ref_or_ptr)
std::string csprintf(const char *format, const Args &...args)