gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NetworkInterface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Inria
3  * Copyright (c) 2016 Georgia Institute of Technology
4  * Copyright (c) 2008 Princeton University
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 
32 #ifndef __MEM_RUBY_NETWORK_GARNET2_0_NETWORKINTERFACE_HH__
33 #define __MEM_RUBY_NETWORK_GARNET2_0_NETWORKINTERFACE_HH__
34 
35 #include <iostream>
36 #include <vector>
37 
45 #include "params/GarnetNetworkInterface.hh"
46 
47 class MessageBuffer;
48 class flitBuffer;
49 
50 class NetworkInterface : public ClockedObject, public Consumer
51 {
52  public:
53  typedef GarnetNetworkInterfaceParams Params;
54  NetworkInterface(const Params *p);
55  ~NetworkInterface() = default;
56 
57  void init();
58 
59  void addInPort(NetworkLink *in_link, CreditLink *credit_link);
60  void addOutPort(NetworkLink *out_link, CreditLink *credit_link,
61  SwitchID router_id);
62 
63  void dequeueCallback();
64  void wakeup();
67 
68  void print(std::ostream& out) const;
69  int get_vnet(int vc);
70  int get_router_id() { return m_router_id; }
71  void init_net_ptr(GarnetNetwork *net_ptr) { m_net_ptr = net_ptr; }
72 
73  uint32_t functionalWrite(Packet *);
74 
75  private:
77  const NodeID m_id;
79  int m_router_id; // id of my router
81  int m_vc_round_robin; // For round robin scheduling
87 
92 
93  // Queue for stalled flits
96 
97  // Input Flit Buffers
98  // The flit buffers which will serve the Consumer
101 
102  // The Message buffers that takes messages from the protocol
104  // The Message buffers that provides messages to the protocol
106  // When a vc stays busy for a long time, it indicates a deadlock
108 
109  bool checkStallQueue();
110  bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
111  int calculateVC(int vnet);
112 
113  void scheduleOutputLink();
114  void checkReschedule();
115  void sendCredit(flit *t_flit, bool is_free);
116 
117  void incrementStats(flit *t_flit);
118 };
119 
120 #endif // __MEM_RUBY_NETWORK_GARNET2_0_NETWORKINTERFACE_HH__
std::vector< int > m_stall_count
void incrementStats(flit *t_flit)
~NetworkInterface()=default
std::vector< Cycles > m_ni_out_vcs_enqueue_time
std::shared_ptr< Message > MsgPtr
Definition: Message.hh:40
void sendCredit(flit *t_flit, bool is_free)
flitBuffer outCreditQueue
GarnetNetworkInterfaceParams Params
void addOutPort(NetworkLink *out_link, CreditLink *credit_link, SwitchID router_id)
int calculateVC(int vnet)
void scheduleOutputLink()
This function looks at the NI buffers if some buffer has flits which are ready to traverse the link i...
std::vector< int > vc_busy_counter
std::deque< flit * > m_stall_queue
flitBuffer outFlitQueue
Used to model link contention.
NetworkLink * outNetLink
STL vector class.
Definition: stl.hh:37
void addInPort(NetworkLink *in_link, CreditLink *credit_link)
NetworkInterface(const Params *p)
unsigned int NodeID
Definition: TypeDefines.hh:34
unsigned int SwitchID
Definition: TypeDefines.hh:35
Definition: flit.hh:41
void addNode(std::vector< MessageBuffer *> &inNode, std::vector< MessageBuffer *> &outNode)
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
uint32_t functionalWrite(Packet *)
NetworkLink * inNetLink
bool flitisizeMessage(MsgPtr msg_ptr, int vnet)
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:249
CreditLink * inCreditLink
void print(std::ostream &out) const
STL deque class.
Definition: stl.hh:44
std::vector< flitBuffer > niOutVcs
std::vector< int > m_vc_allocator
CreditLink * outCreditLink
std::vector< MessageBuffer * > outNode_ptr
std::vector< MessageBuffer * > inNode_ptr
void init_net_ptr(GarnetNetwork *net_ptr)
std::vector< OutVcState > outVcState
const int m_virtual_networks
GarnetNetwork * m_net_ptr
Bitfield< 0 > p
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.

Generated on Mon Jun 8 2020 15:45:12 for gem5 by doxygen 1.8.13