gem5 v24.0.0.0
Loading...
Searching...
No Matches
NetworkLink.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Advanced Micro Devices, Inc.
3 * Copyright (c) 2020 Inria
4 * Copyright (c) 2016 Georgia Institute of Technology
5 * Copyright (c) 2008 Princeton University
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer;
12 * redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution;
15 * neither the name of the copyright holders nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32
34
35#include "base/trace.hh"
36#include "debug/RubyNetwork.hh"
38
39namespace gem5
40{
41
42namespace ruby
43{
44
45namespace garnet
46{
47
49 : ClockedObject(p), Consumer(this), m_id(p.link_id),
50 m_type(NUM_LINK_TYPES_),
51 m_latency(p.link_latency), m_link_utilized(0),
52 m_virt_nets(p.virt_nets), linkBuffer(),
53 link_consumer(nullptr), link_srcQueue(nullptr)
54{
55 int num_vnets = (p.supported_vnets).size();
56 mVnets.resize(num_vnets);
57 bitWidth = p.width;
58 for (int i = 0; i < num_vnets; i++) {
59 mVnets[i] = p.supported_vnets[i];
60 }
61}
62
63void
65{
66 link_consumer = consumer;
67}
68
69void
70NetworkLink::setVcsPerVnet(uint32_t consumerVcs)
71{
72 m_vc_load.resize(m_virt_nets * consumerVcs);
73}
74
75void
77{
78 link_srcQueue = src_queue;
79 src_object = srcClockObj;
80}
81
82void
84{
85 DPRINTF(RubyNetwork, "Woke up to transfer flits from %s\n",
86 src_object->name());
87 assert(link_srcQueue != nullptr);
88 assert(curTick() == clockEdge());
90 flit *t_flit = link_srcQueue->getTopFlit();
91 DPRINTF(RubyNetwork, "Transmission will finish at %ld :%s\n",
92 clockEdge(m_latency), *t_flit);
93 if (m_type != NUM_LINK_TYPES_) {
94 // Only for assertions and debug messages
95 assert(t_flit->m_width == bitWidth);
96 assert((std::find(mVnets.begin(), mVnets.end(),
97 t_flit->get_vnet()) != mVnets.end()) ||
98 (mVnets.size() == 0));
99 }
100 t_flit->set_time(clockEdge(m_latency));
101 linkBuffer.insert(t_flit);
104 m_vc_load[t_flit->get_vc()]++;
105 }
106
107 if (!link_srcQueue->isEmpty()) {
109 }
110}
111
112void
114{
115 for (int i = 0; i < m_vc_load.size(); i++) {
116 m_vc_load[i] = 0;
117 }
118
119 m_link_utilized = 0;
120}
121
122bool
127
128uint32_t
133
134} // namespace garnet
135} // namespace ruby
136} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:210
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
virtual std::string name() const
Definition named.hh:47
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
void scheduleEventAbsolute(Tick timeAbs)
Definition Consumer.cc:63
void scheduleEvent(Cycles timeDelta)
Definition Consumer.cc:56
bool functionalRead(Packet *pkt, WriteMask &mask)
Definition flitBuffer.cc:89
bool isReady(Tick curTime)
Definition flitBuffer.cc:60
uint32_t functionalWrite(Packet *pkt)
void set_time(Tick time)
Definition flit.hh:75
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0