gem5  v20.1.0.0
etherbus.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /* @file
30  * Device module for modelling an ethernet hub
31  */
32 
33 #ifndef __DEV_NET_ETHERBUS_HH__
34 #define __DEV_NET_ETHERBUS_HH__
35 
36 #include "dev/net/etherpkt.hh"
37 #include "params/EtherBus.hh"
38 #include "sim/eventq.hh"
39 #include "sim/sim_object.hh"
40 
41 class EtherDump;
42 class EtherInt;
43 class EtherBus : public SimObject
44 {
45  protected:
48  double ticksPerByte;
49  bool loopback;
50 
51  protected:
56 
57  public:
58  typedef EtherBusParams Params;
59  EtherBus(const Params *p);
60  virtual ~EtherBus() {}
61 
62  const Params *
63  params() const
64  {
65  return dynamic_cast<const Params *>(_params);
66  }
67 
68  void txDone();
69  void reg(EtherInt *dev);
70  bool busy() const { return (bool)packet; }
72  Port &getPort(const std::string &if_name,
73  PortID idx=InvalidPortID) override;
74 };
75 
76 #endif // __DEV_NET_ETHERBUS_HH__
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
EtherBus::loopback
bool loopback
Definition: etherbus.hh:49
EtherInt
Definition: etherint.hh:47
EtherBus::devlist_t
std::list< EtherInt * > devlist_t
Definition: etherbus.hh:46
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
EtherBus::params
const Params * params() const
Definition: etherbus.hh:63
EtherBus::ticksPerByte
double ticksPerByte
Definition: etherbus.hh:48
EtherBus::event
EventFunctionWrapper event
Definition: etherbus.hh:52
EventFunctionWrapper
Definition: eventq.hh:1101
EtherBus::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: etherbus.cc:83
EtherBus::txDone
void txDone()
Definition: etherbus.cc:59
EtherBus::~EtherBus
virtual ~EtherBus()
Definition: etherbus.hh:60
sim_object.hh
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
EtherBus
Definition: etherbus.hh:43
EtherBus::Params
EtherBusParams Params
Definition: etherbus.hh:58
EtherBus::sender
EtherInt * sender
Definition: etherbus.hh:54
EthPacketPtr
std::shared_ptr< EthPacketData > EthPacketPtr
Definition: etherpkt.hh:87
EtherBus::EtherBus
EtherBus(const Params *p)
Definition: etherbus.cc:51
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
EtherBus::dump
EtherDump * dump
Definition: etherbus.hh:55
EtherBus::busy
bool busy() const
Definition: etherbus.hh:70
EtherBus::packet
EthPacketPtr packet
Definition: etherbus.hh:53
etherpkt.hh
EtherDump
Definition: etherdump.hh:45
EtherBus::devlist
devlist_t devlist
Definition: etherbus.hh:47
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< EtherInt * >
EtherBus::send
bool send(EtherInt *sender, EthPacketPtr &packet)
Definition: etherbus.cc:89
EtherBus::reg
void reg(EtherInt *dev)
eventq.hh
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17