gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NetworkInterface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 Princeton University
3  * Copyright (c) 2016 Georgia Institute of Technology
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Authors: Niket Agarwal
30  * Tushar Krishna
31  */
32 
33 
34 #ifndef __MEM_RUBY_NETWORK_GARNET_NETWORK_INTERFACE_HH__
35 #define __MEM_RUBY_NETWORK_GARNET_NETWORK_INTERFACE_HH__
36 
37 #include <iostream>
38 #include <vector>
39 
47 #include "params/GarnetNetworkInterface.hh"
48 
49 class MessageBuffer;
50 class flitBuffer;
51 
52 class NetworkInterface : public ClockedObject, public Consumer
53 {
54  public:
55  typedef GarnetNetworkInterfaceParams Params;
56  NetworkInterface(const Params *p);
58 
59  void init();
60 
61  void addInPort(NetworkLink *in_link, CreditLink *credit_link);
62  void addOutPort(NetworkLink *out_link, CreditLink *credit_link,
63  SwitchID router_id);
64 
65  void dequeueCallback();
66  void wakeup();
69 
70  void print(std::ostream& out) const;
71  int get_vnet(int vc);
72  int get_router_id() { return m_router_id; }
73  void init_net_ptr(GarnetNetwork *net_ptr) { m_net_ptr = net_ptr; }
74 
75  uint32_t functionalWrite(Packet *);
76 
77  private:
79  const NodeID m_id;
81  int m_router_id; // id of my router
84  int m_vc_round_robin; // For round robin scheduling
85  flitBuffer *outFlitQueue; // For modeling link contention
88 
93 
94  // Queue for stalled flits
97 
98  // Input Flit Buffers
99  // The flit buffers which will serve the Consumer
102 
103  // The Message buffers that takes messages from the protocol
105  // The Message buffers that provides messages to the protocol
107  // When a vc stays busy for a long time, it indicates a deadlock
109 
110  bool checkStallQueue();
111  bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
112  int calculateVC(int vnet);
113 
114  void scheduleOutputLink();
115  void checkReschedule();
116  void sendCredit(flit *t_flit, bool is_free);
117 
118  void incrementStats(flit *t_flit);
119 };
120 
121 #endif // __MEM_RUBY_NETWORK_GARNET_NETWORK_INTERFACE_HH__
std::vector< int > m_stall_count
void incrementStats(flit *t_flit)
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)
GarnetNetworkInterfaceParams Params
void addOutPort(NetworkLink *out_link, CreditLink *credit_link, SwitchID router_id)
int calculateVC(int vnet)
std::vector< flitBuffer * > m_ni_out_vcs
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
NetworkLink * outNetLink
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:44
std::vector< OutVcState * > m_out_vc_state
flitBuffer * outFlitQueue
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
flitBuffer * outCreditQueue
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:245
CreditLink * inCreditLink
void print(std::ostream &out) const
void addNode(std::vector< MessageBuffer * > &inNode, std::vector< MessageBuffer * > &outNode)
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)
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 Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6