gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gic.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * Authors: Gabe Black
28  */
29 
30 #ifndef __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
31 #define __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
32 
33 #pragma GCC diagnostic push
34 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
35 #include <amba_pv.h>
36 #pragma GCC diagnostic pop
37 
38 #include <memory>
39 
41 #include "dev/arm/base_gic.hh"
42 #include "params/FastModelGIC.hh"
43 #include "params/SCFastModelGIC.hh"
44 #include "scx_evs_GIC.h"
47 
48 namespace FastModel
49 {
50 
51 // The fast model exports a class called scx_evs_GIC which represents
52 // the subsystem described in LISA+. This class specializes it to export gem5
53 // ports and interface with its peer gem5 GIC. The gem5 GIC inherits from the
54 // gem5 BaseGic class and implements its API, while this class actually does
55 // the work.
56 class SCGIC : public scx_evs_GIC
57 {
58  private:
59  // The unconnected CPU ports/sockets still need to be connected for TLM to
60  // be happy, so this module finds all unbound sockets, creates pair
61  // sockets for them to connect to, binds everything together, and
62  // implements the target interface with a dummy stub that will complain
63  // and crash gem5 if it ever gets called.
65  public svp_gicv3_comms::gicv3_comms_fw_if
66  {
67  protected:
68  typedef sc_core::sc_vector<
69  svp_gicv3_comms::gicv3_comms_initiator_socket<>> Initiators;
70  typedef sc_core::sc_vector<
71  svp_gicv3_comms::gicv3_comms_target_socket<>> Targets;
72 
73  Targets targets;
74 
75  static int countUnbound(const Initiators &inits);
76 
77  public:
78  Terminator(sc_core::sc_module_name _name, Initiators &inits);
79 
80  // Stub out the terminated interface.
81  void sendTowardsCPU(uint8_t len, const uint8_t *data) override;
82  };
83 
84  std::unique_ptr<Terminator> terminator;
85  const SCFastModelGICParams &_params;
86 
87  public:
88  SCGIC(const SCFastModelGICParams &params, sc_core::sc_module_name _name);
89 
91 
92  void before_end_of_elaboration() override;
93 
94  void
95  end_of_elaboration() override
96  {
97  scx_evs_GIC::end_of_elaboration();
98  scx_evs_GIC::start_of_simulation();
99  }
100  void start_of_simulation() override {}
101  const SCFastModelGICParams &
103  {
104  return _params;
105  }
106 };
107 
108 // This class pairs with the one above to implement the receiving end of gem5's
109 // GIC API. It acts as an interface which passes work to the fast model GIC,
110 // and lets the fast model GIC interact with the rest of the system.
111 class GIC : public BaseGic
112 {
113  private:
115  64, svp_gicv3_comms::gicv3_comms_fw_if,
116  svp_gicv3_comms::gicv3_comms_bw_if, 1,
118 
122 
124 
125  public:
126  GIC(const FastModelGICParams &params);
127 
128  Port &getPort(const std::string &if_name,
129  PortID idx=InvalidPortID) override;
130 
131  void sendInt(uint32_t num) override;
132  void clearInt(uint32_t num) override;
133 
134  void sendPPInt(uint32_t num, uint32_t cpu) override;
135  void clearPPInt(uint32_t num, uint32_t cpu) override;
136 
137  bool supportsVersion(GicVersion version) override;
138 
139  AddrRangeList getAddrRanges() const override { return AddrRangeList(); }
140  Tick read(PacketPtr pkt) override { return 0; }
141  Tick write(PacketPtr pkt) override { return 0; }
142 };
143 
144 } // namespace FastModel
145 
146 #endif // __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
SCGIC * scGIC
Definition: gic.hh:123
Ports are used to interface objects to each other.
Definition: port.hh:60
const PortID InvalidPortID
Definition: types.hh:238
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
Definition: addr_range.hh:573
SignalInterruptInitiatorSocket signalInterrupt
Definition: gic.hh:90
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:140
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_target_socket<> > Targets
Definition: gic.hh:71
void end_of_elaboration() override
Definition: gic.hh:95
void sendTowardsCPU(uint8_t len, const uint8_t *data) override
Definition: gic.cc:67
AmbaInitiator ambaM
Definition: gic.hh:119
const SCFastModelGICParams & params()
Definition: gic.hh:102
STL vector class.
Definition: stl.hh:40
std::unique_ptr< Terminator > terminator
Definition: gic.hh:84
uint64_t Tick
Tick count type.
Definition: types.hh:63
const SCFastModelGICParams & _params
Definition: gic.hh:85
std::vector< std::unique_ptr< TlmGicInitiator > > redistributors
Definition: gic.hh:121
Bitfield< 18, 16 > len
AmbaTarget ambaS
Definition: gic.hh:120
GicVersion
Definition: base_gic.hh:68
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: gic.hh:139
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:141
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_initiator_socket<> > Initiators
Definition: gic.hh:69
Base class for ARM GIC implementations.
sc_gem5::TlmInitiatorBaseWrapper< 64, svp_gicv3_comms::gicv3_comms_fw_if, svp_gicv3_comms::gicv3_comms_bw_if, 1, sc_core::SC_ONE_OR_MORE_BOUND > TlmGicInitiator
Definition: gic.hh:117
SCGIC(const SCFastModelGICParams &params, sc_core::sc_module_name _name)
Definition: gic.cc:72
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
const char data[]
void start_of_simulation() override
Definition: gic.hh:100
Terminator(sc_core::sc_module_name _name, Initiators &inits)
Definition: gic.cc:49
virtual void before_end_of_elaboration()
Definition: sc_module.hh:250
static int countUnbound(const Initiators &inits)
Definition: gic.cc:40

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13