mem-garnet: Add a garnet namespace

Add a namespace encapsulating all garnet files.

GarnetSyntheticTraffic, from
cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.hh
has not been added to this namespace.

Change-Id: I5304ad3130100ba325e35e20883ee9286f51a75a
Issued-on: https://gem5.atlassian.net/browse/GEM5-987
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47306
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Srikant Bharadwaj <srikant.bharadwaj@amd.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Daniel R. Carvalho
2021-06-12 09:27:02 -03:00
committed by Daniel Carvalho
parent 974a47dfb9
commit 00cd307b13
36 changed files with 149 additions and 10 deletions

View File

@@ -36,6 +36,9 @@
namespace gem5
{
namespace garnet
{
// All common enums and typedefs go here
enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_,
@@ -68,6 +71,7 @@ struct RouteInfo
#define INFINITE_ 10000
} // namespace garnet
} // namespace gem5
#endif //__MEM_RUBY_NETWORK_GARNET_0_COMMONTYPES_HH__

View File

@@ -35,6 +35,9 @@
namespace gem5
{
namespace garnet
{
// Credit Signal for buffers inside VC
// Carries m_vc (inherits from flit.hh)
// and m_is_free_signal (whether VC is free or not)
@@ -83,4 +86,5 @@ Credit::print(std::ostream& out) const
out << "]";
}
} // namespace garnet
} // namespace gem5

View File

@@ -41,6 +41,9 @@
namespace gem5
{
namespace garnet
{
// Credit Signal for buffers inside VC
// Carries m_vc (inherits from flit.hh)
// and m_is_free_signal (whether VC is free or not)
@@ -64,6 +67,7 @@ class Credit : public flit
bool m_is_free_signal;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_CREDIT_HH__

View File

@@ -37,6 +37,9 @@
namespace gem5
{
namespace garnet
{
class CreditLink : public NetworkLink
{
public:
@@ -44,6 +47,7 @@ class CreditLink : public NetworkLink
CreditLink(const Params &p) : NetworkLink(p) {}
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_CREDITLINK_HH__

View File

@@ -38,6 +38,9 @@
namespace gem5
{
namespace garnet
{
CrossbarSwitch::CrossbarSwitch(Router *router)
: Consumer(router), m_router(router), m_num_vcs(m_router->get_num_vcs()),
m_crossbar_activity(0), switchBuffers(0)
@@ -103,4 +106,5 @@ CrossbarSwitch::resetStats()
m_crossbar_activity = 0;
}
} // namespace garnet
} // namespace gem5

View File

@@ -42,6 +42,9 @@
namespace gem5
{
namespace garnet
{
class Router;
class CrossbarSwitch : public Consumer
@@ -71,6 +74,7 @@ class CrossbarSwitch : public Consumer
std::vector<flitBuffer> switchBuffers;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_CROSSBARSWITCH_HH__

View File

@@ -38,6 +38,9 @@
namespace gem5
{
namespace garnet
{
GarnetIntLink::GarnetIntLink(const Params &p)
: BasicIntLink(p)
{
@@ -157,4 +160,5 @@ GarnetExtLink::print(std::ostream& out) const
out << name();
}
} // namespace garnet
} // namespace gem5

View File

@@ -45,6 +45,9 @@
namespace gem5
{
namespace garnet
{
class GarnetIntLink : public BasicIntLink
{
public:
@@ -126,6 +129,7 @@ operator<<(std::ostream& out, const GarnetExtLink& obj)
return out;
}
} // namespace garnet
} // namespace gem5
#endif //__MEM_RUBY_NETWORK_GARNET_0_GARNETLINK_HH__

View File

@@ -38,7 +38,7 @@ class CDCType(Enum): vals = [
class NetworkLink(ClockedObject):
type = 'NetworkLink'
cxx_header = "mem/ruby/network/garnet/NetworkLink.hh"
cxx_class = 'gem5::NetworkLink'
cxx_class = 'gem5::garnet::NetworkLink'
link_id = Param.Int(Parent.link_id, "link id")
link_latency = Param.Cycles(Parent.latency, "link latency")
@@ -53,12 +53,12 @@ class NetworkLink(ClockedObject):
class CreditLink(NetworkLink):
type = 'CreditLink'
cxx_header = "mem/ruby/network/garnet/CreditLink.hh"
cxx_class = 'gem5::CreditLink'
cxx_class = 'gem5::garnet::CreditLink'
class NetworkBridge(CreditLink):
type = 'NetworkBridge'
cxx_header = "mem/ruby/network/garnet/NetworkBridge.hh"
cxx_class = 'gem5::NetworkBridge'
cxx_class = 'gem5::garnet::NetworkBridge'
link = Param.NetworkLink("Associated Network Link")
vtype = Param.CDCType('LINK_OBJECT',
@@ -70,7 +70,7 @@ class NetworkBridge(CreditLink):
class GarnetIntLink(BasicIntLink):
type = 'GarnetIntLink'
cxx_header = "mem/ruby/network/garnet/GarnetLink.hh"
cxx_class = 'gem5::GarnetIntLink'
cxx_class = 'gem5::garnet::GarnetIntLink'
# The internal link includes one forward link (for flit)
# and one backward flow-control link (for credit)
@@ -109,7 +109,7 @@ class GarnetIntLink(BasicIntLink):
class GarnetExtLink(BasicExtLink):
type = 'GarnetExtLink'
cxx_header = "mem/ruby/network/garnet/GarnetLink.hh"
cxx_class = 'gem5::GarnetExtLink'
cxx_class = 'gem5::garnet::GarnetExtLink'
# The external link is bi-directional.
# It includes two forward links (for flits)

View File

@@ -49,6 +49,9 @@
namespace gem5
{
namespace garnet
{
/*
* GarnetNetwork sets up the routers and links and collects stats.
* Default parameters (GarnetNetwork.py) can be overwritten from command line
@@ -617,4 +620,5 @@ GarnetNetwork::functionalWrite(Packet *pkt)
return num_functional_writes;
}
} // namespace garnet
} // namespace gem5

View File

@@ -44,9 +44,13 @@ namespace gem5
{
class FaultModel;
class NetDest;
namespace garnet
{
class NetworkInterface;
class Router;
class NetDest;
class NetworkLink;
class CreditLink;
@@ -212,6 +216,7 @@ operator<<(std::ostream& out, const GarnetNetwork& obj)
return out;
}
} // namespace garnet
} // namespace gem5
#endif //__MEM_RUBY_NETWORK_GARNET_0_GARNETNETWORK_HH__

View File

@@ -37,7 +37,7 @@ from m5.objects.ClockedObject import ClockedObject
class GarnetNetwork(RubyNetwork):
type = 'GarnetNetwork'
cxx_header = "mem/ruby/network/garnet/GarnetNetwork.hh"
cxx_class = 'gem5::GarnetNetwork'
cxx_class = 'gem5::garnet::GarnetNetwork'
num_rows = Param.Int(0, "number of rows if 2D (mesh/torus/..) topology");
ni_flit_size = Param.UInt32(16, "network interface flit size in bytes")
@@ -53,7 +53,7 @@ class GarnetNetwork(RubyNetwork):
class GarnetNetworkInterface(ClockedObject):
type = 'GarnetNetworkInterface'
cxx_class = 'gem5::NetworkInterface'
cxx_class = 'gem5::garnet::NetworkInterface'
cxx_header = "mem/ruby/network/garnet/NetworkInterface.hh"
id = Param.UInt32("ID in relation to other network interfaces")
@@ -66,7 +66,7 @@ class GarnetNetworkInterface(ClockedObject):
class GarnetRouter(BasicRouter):
type = 'GarnetRouter'
cxx_class = 'gem5::Router'
cxx_class = 'gem5::garnet::Router'
cxx_header = "mem/ruby/network/garnet/Router.hh"
vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet,
"virtual channels per virtual network")

View File

@@ -38,6 +38,9 @@
namespace gem5
{
namespace garnet
{
InputUnit::InputUnit(int id, PortDirection direction, Router *router)
: Consumer(router), m_router(router), m_id(id), m_direction(direction),
m_vc_per_vnet(m_router->get_vc_per_vnet())
@@ -166,4 +169,5 @@ InputUnit::resetStats()
}
}
} // namespace garnet
} // namespace gem5

View File

@@ -46,6 +46,9 @@
namespace gem5
{
namespace garnet
{
class InputUnit : public Consumer
{
public:
@@ -166,6 +169,7 @@ class InputUnit : public Consumer
std::vector<double> m_num_buffer_reads;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_INPUTUNIT_HH__

View File

@@ -42,6 +42,9 @@
namespace gem5
{
namespace garnet
{
NetworkBridge::NetworkBridge(const Params &p)
:CreditLink(p)
{
@@ -268,4 +271,5 @@ NetworkBridge::wakeup()
}
}
} // namespace garnet
} // namespace gem5

View File

@@ -49,6 +49,9 @@
namespace gem5
{
namespace garnet
{
class GarnetNetwork;
class NetworkBridge: public CreditLink
@@ -98,6 +101,7 @@ class NetworkBridge: public CreditLink
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_NETWORK_BRIDGE_HH__

View File

@@ -45,6 +45,9 @@
namespace gem5
{
namespace garnet
{
NetworkInterface::NetworkInterface(const Params &p)
: ClockedObject(p), Consumer(this), m_id(p.id),
m_virtual_networks(p.virt_nets), m_vc_per_vnet(0),
@@ -674,4 +677,5 @@ NetworkInterface::functionalWrite(Packet *pkt)
return num_functional_writes;
}
} // namespace garnet
} // namespace gem5

View File

@@ -50,6 +50,10 @@ namespace gem5
{
class MessageBuffer;
namespace garnet
{
class flitBuffer;
class NetworkInterface : public ClockedObject, public Consumer
@@ -300,6 +304,7 @@ class NetworkInterface : public ClockedObject, public Consumer
OutputPort *getOutportForVnet(int vnet);
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_NETWORKINTERFACE_HH__

View File

@@ -39,6 +39,9 @@
namespace gem5
{
namespace garnet
{
NetworkLink::NetworkLink(const Params &p)
: ClockedObject(p), Consumer(this), m_id(p.link_id),
m_type(NUM_LINK_TYPES_),
@@ -119,4 +122,5 @@ NetworkLink::functionalWrite(Packet *pkt)
return linkBuffer.functionalWrite(pkt);
}
} // namespace garnet
} // namespace gem5

View File

@@ -45,6 +45,9 @@
namespace gem5
{
namespace garnet
{
class GarnetNetwork;
class NetworkLink : public ClockedObject, public Consumer
@@ -100,6 +103,7 @@ class NetworkLink : public ClockedObject, public Consumer
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_NETWORKLINK_HH__

View File

@@ -35,6 +35,9 @@
namespace gem5
{
namespace garnet
{
OutVcState::OutVcState(int id, GarnetNetwork *network_ptr,
uint32_t consumerVcs)
: m_time(0)
@@ -71,4 +74,5 @@ OutVcState::decrement_credit()
assert(m_credit_count >= 0);
}
} // namespace garnet
} // namespace gem5

View File

@@ -37,6 +37,9 @@
namespace gem5
{
namespace garnet
{
class OutVcState
{
public:
@@ -67,6 +70,7 @@ class OutVcState
int m_max_credit_count;
};
} // namespace garnet
} // namespace gem5
#endif //__MEM_RUBY_NETWORK_GARNET_0_OUTVCSTATE_HH__

View File

@@ -40,6 +40,9 @@
namespace gem5
{
namespace garnet
{
OutputUnit::OutputUnit(int id, PortDirection direction, Router *router,
uint32_t consumerVcs)
: Consumer(router), m_router(router), m_id(id), m_direction(direction),
@@ -172,4 +175,5 @@ OutputUnit::functionalWrite(Packet *pkt)
return outBuffer.functionalWrite(pkt);
}
} // namespace garnet
} // namespace gem5

View File

@@ -44,6 +44,9 @@
namespace gem5
{
namespace garnet
{
class CreditLink;
class Router;
@@ -114,6 +117,7 @@ class OutputUnit : public Consumer
std::vector<OutVcState> outVcState;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_OUTPUTUNIT_HH__

View File

@@ -42,6 +42,9 @@
namespace gem5
{
namespace garnet
{
Router::Router(const Params &p)
: BasicRouter(p), Consumer(this), m_latency(p.latency),
m_virtual_networks(p.virt_nets), m_vc_per_vnet(p.vcs_per_vnet),
@@ -285,4 +288,5 @@ Router::functionalWrite(Packet *pkt)
return num_functional_writes;
}
} // namespace garnet
} // namespace gem5

View File

@@ -50,11 +50,15 @@
namespace gem5
{
class FaultModel;
namespace garnet
{
class NetworkLink;
class CreditLink;
class InputUnit;
class OutputUnit;
class FaultModel;
class Router : public BasicRouter, public Consumer
{
@@ -157,6 +161,7 @@ class Router : public BasicRouter, public Consumer
statistics::Scalar m_crossbar_activity;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__

View File

@@ -40,6 +40,9 @@
namespace gem5
{
namespace garnet
{
RoutingUnit::RoutingUnit(Router *router)
{
m_router = router;
@@ -264,4 +267,5 @@ RoutingUnit::outportComputeCustom(RouteInfo route,
panic("%s placeholder executed", __FUNCTION__);
}
} // namespace garnet
} // namespace gem5

View File

@@ -40,6 +40,9 @@
namespace gem5
{
namespace garnet
{
class InputUnit;
class Router;
@@ -91,6 +94,7 @@ class RoutingUnit
std::map<PortDirection, int> m_outports_dirn2idx;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTINGUNIT_HH__

View File

@@ -40,6 +40,9 @@
namespace gem5
{
namespace garnet
{
SwitchAllocator::SwitchAllocator(Router *router)
: Consumer(router)
{
@@ -390,4 +393,5 @@ SwitchAllocator::resetStats()
m_output_arbiter_activity = 0;
}
} // namespace garnet
} // namespace gem5

View File

@@ -41,6 +41,9 @@
namespace gem5
{
namespace garnet
{
class Router;
class InputUnit;
class OutputUnit;
@@ -86,6 +89,7 @@ class SwitchAllocator : public Consumer
std::vector<int> m_vc_winners;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_SWITCHALLOCATOR_HH__

View File

@@ -34,6 +34,9 @@
namespace gem5
{
namespace garnet
{
VirtualChannel::VirtualChannel()
: inputBuffer(), m_vc_state(IDLE_, Tick(0)), m_output_port(-1),
m_enqueue_time(INFINITE_), m_output_vc(-1)
@@ -75,4 +78,5 @@ VirtualChannel::functionalWrite(Packet *pkt)
return inputBuffer.functionalWrite(pkt);
}
} // namespace garnet
} // namespace gem5

View File

@@ -40,6 +40,9 @@
namespace gem5
{
namespace garnet
{
class VirtualChannel
{
public:
@@ -99,6 +102,7 @@ class VirtualChannel
int m_output_vc;
};
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_VIRTUALCHANNEL_HH__

View File

@@ -36,6 +36,9 @@
namespace gem5
{
namespace garnet
{
// Constructor for the flit
flit::flit(int id, int vc, int vnet, RouteInfo route, int size,
MsgPtr msg_ptr, int MsgSize, uint32_t bWidth, Tick curTime)
@@ -124,4 +127,5 @@ flit::functionalWrite(Packet *pkt)
return msg->functionalWrite(pkt);
}
} // namespace garnet
} // namespace gem5

View File

@@ -41,6 +41,9 @@
namespace gem5
{
namespace garnet
{
class flit
{
public:
@@ -130,6 +133,7 @@ operator<<(std::ostream& out, const flit& obj)
return out;
}
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_FLIT_HH__

View File

@@ -34,6 +34,9 @@
namespace gem5
{
namespace garnet
{
flitBuffer::flitBuffer()
{
max_size = INFINITE_;
@@ -93,4 +96,5 @@ flitBuffer::functionalWrite(Packet *pkt)
return num_functional_writes;
}
} // namespace garnet
} // namespace gem5

View File

@@ -41,6 +41,9 @@
namespace gem5
{
namespace garnet
{
class flitBuffer
{
public:
@@ -89,6 +92,7 @@ operator<<(std::ostream& out, const flitBuffer& obj)
return out;
}
} // namespace garnet
} // namespace gem5
#endif // __MEM_RUBY_NETWORK_GARNET_0_FLITBUFFER_HH__