gem5  v21.1.0.2
CrossbarSwitch.cc
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 
33 
34 #include "debug/RubyNetwork.hh"
37 
38 namespace gem5
39 {
40 
41 namespace ruby
42 {
43 
44 namespace garnet
45 {
46 
48  : Consumer(router), m_router(router), m_num_vcs(m_router->get_num_vcs()),
49  m_crossbar_activity(0), switchBuffers(0)
50 {
51 }
52 
53 void
55 {
57 }
58 
59 /*
60  * The wakeup function of the CrossbarSwitch loops through all input ports,
61  * and sends the winning flit (from SA) out of its output port on to the
62  * output link. The output link is scheduled for wakeup in the next cycle.
63  */
64 
65 void
67 {
68  DPRINTF(RubyNetwork, "CrossbarSwitch at Router %d woke up "
69  "at time: %lld\n",
71 
72  for (auto& switch_buffer : switchBuffers) {
73  if (!switch_buffer.isReady(curTick())) {
74  continue;
75  }
76 
77  flit *t_flit = switch_buffer.peekTopFlit();
78  if (t_flit->is_stage(ST_, curTick())) {
79  int outport = t_flit->get_outport();
80 
81  // flit performs LT_ in the next cycle
82  t_flit->advance_stage(LT_, m_router->clockEdge(Cycles(1)));
83  t_flit->set_time(m_router->clockEdge(Cycles(1)));
84 
85  // This will take care of waking up the Network Link
86  // in the next cycle
87  m_router->getOutputUnit(outport)->insert_flit(t_flit);
88  switch_buffer.getTopFlit();
90  }
91  }
92 }
93 
94 uint32_t
96 {
97  uint32_t num_functional_writes = 0;
98 
99  for (auto& switch_buffer : switchBuffers) {
100  num_functional_writes += switch_buffer.functionalWrite(pkt);
101  }
102 
103  return num_functional_writes;
104 }
105 
106 void
108 {
110 }
111 
112 } // namespace garnet
113 } // namespace ruby
114 } // namespace gem5
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::ruby::garnet::flit
Definition: flit.hh:50
gem5::ruby::garnet::flit::get_outport
int get_outport()
Definition: flit.hh:59
gem5::ruby::garnet::flit::is_stage
bool is_stage(flit_stage stage, Tick time)
Definition: flit.hh:85
gem5::Clocked::curCycle
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
Definition: clocked_object.hh:195
gem5::ruby::garnet::flit::set_time
void set_time(Tick time)
Definition: flit.hh:74
gem5::ruby::garnet::CrossbarSwitch::switchBuffers
std::vector< flitBuffer > switchBuffers
Definition: CrossbarSwitch.hh:77
gem5::ruby::garnet::Router
Definition: Router.hh:66
gem5::ruby::Consumer
Definition: Consumer.hh:61
gem5::ruby::garnet::OutputUnit::insert_flit
void insert_flit(flit *t_flit)
Definition: OutputUnit.cc:169
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::ruby::garnet::CrossbarSwitch::m_router
Router * m_router
Definition: CrossbarSwitch.hh:74
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
CrossbarSwitch.hh
gem5::ruby::garnet::CrossbarSwitch::wakeup
void wakeup()
Definition: CrossbarSwitch.cc:66
gem5::ruby::garnet::CrossbarSwitch::functionalWrite
uint32_t functionalWrite(Packet *pkt)
Definition: CrossbarSwitch.cc:95
gem5::ruby::garnet::CrossbarSwitch::resetStats
void resetStats()
Definition: CrossbarSwitch.cc:107
gem5::ruby::garnet::ST_
@ ST_
Definition: CommonTypes.hh:51
gem5::Clocked::clockEdge
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...
Definition: clocked_object.hh:177
gem5::ruby::garnet::CrossbarSwitch::init
void init()
Definition: CrossbarSwitch.cc:54
OutputUnit.hh
gem5::ruby::garnet::LT_
@ LT_
Definition: CommonTypes.hh:51
gem5::ruby::garnet::flit::advance_stage
void advance_stage(flit_stage t_stage, Tick newTime)
Definition: flit.hh:92
gem5::ruby::garnet::CrossbarSwitch::CrossbarSwitch
CrossbarSwitch(Router *router)
Definition: CrossbarSwitch.cc:47
gem5::ruby::garnet::Router::get_num_inports
int get_num_inports()
Definition: Router.hh:89
gem5::ruby::garnet::CrossbarSwitch::m_crossbar_activity
double m_crossbar_activity
Definition: CrossbarSwitch.hh:76
gem5::ruby::garnet::Router::get_id
int get_id()
Definition: Router.hh:91
gem5::ruby::garnet::Router::getOutputUnit
OutputUnit * getOutputUnit(unsigned port)
Definition: Router.hh:108
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
Router.hh

Generated on Tue Sep 21 2021 12:25:40 for gem5 by doxygen 1.8.17