gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cortex_a76.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_CORTEXA76_CORETEX_A76_HH__
31 #define __ARCH_ARM_FASTMODEL_CORTEXA76_CORETEX_A76_HH__
32 
36 #include "params/FastModelCortexA76.hh"
37 #include "params/FastModelCortexA76Cluster.hh"
38 #include "scx/scx.h"
39 #include "sim/port.hh"
41 
42 class BaseCPU;
43 
44 namespace FastModel
45 {
46 
47 // The fast model exports a class called scx_evs_CortexA76x1 which represents
48 // the subsystem described in LISA+. This class specializes it to export gem5
49 // ports and interface with its peer gem5 CPU. The gem5 CPU inherits from the
50 // gem5 BaseCPU class and implements its API, while this class actually does
51 // the work.
52 class CortexA76Cluster;
53 
54 class CortexA76 : public Iris::CPU<CortexA76TC>
55 {
56  protected:
57  typedef FastModelCortexA76Params Params;
59  const Params &_params;
60 
62  int num = 0;
63 
64  const Params &params() { return _params; }
65 
66  public:
67  CortexA76(Params &p) : Base(&p, scx::scx_get_iris_connection_interface()),
68  _params(p)
69  {}
70 
71  void
72  clockPeriodUpdated() override
73  {
75 
76  // FIXME(b/139447397): this is a workaround since CNTFRQ_EL0 should not
77  // be modified after clock is changed in real hardwares. Remove or
78  // modify this after a more reasonable solution is found.
79  for (auto *tc : threadContexts) {
80  tc->setMiscRegNoEffect(ArmISA::MISCREG_CNTFRQ_EL0, frequency());
81  }
82  }
83 
84  void initState() override;
85 
86  template <class T>
87  void set_evs_param(const std::string &n, T val);
88 
89  void setCluster(CortexA76Cluster *_cluster, int _num);
90 
91  Port &getPort(const std::string &if_name,
92  PortID idx=InvalidPortID) override;
93 };
94 
96 {
97  private:
98  typedef FastModelCortexA76ClusterParams Params;
99  const Params &_params;
100 
103 
104  public:
105  template <class T>
106  void
107  set_evs_param(const std::string &n, T val)
108  {
109  scx::scx_set_parameter(evs->name() + std::string(".") + n, val);
110  }
111 
112  CortexA76 *getCore(int num) { return cores.at(num); }
114 
115  CortexA76Cluster(Params &p);
116  const Params &params() { return _params; }
117 
118  Port &getPort(const std::string &if_name,
119  PortID idx=InvalidPortID) override;
120 };
121 
122 template <class T>
123 inline void
124 CortexA76::set_evs_param(const std::string &n, T val)
125 {
126  for (auto &path: params().thread_paths)
127  cluster->set_evs_param(path + "." + n, val);
128 }
129 
130 } // namespace FastModel
131 
132 #endif // __ARCH_ARM_FASTMODEL_CORTEXA76_CORETEX_A76_HH__
Ports are used to interface objects to each other.
Definition: port.hh:60
void set_evs_param(const std::string &n, T val)
Definition: cortex_a76.hh:124
const PortID InvalidPortID
Definition: types.hh:238
CortexA76Cluster * cluster
Definition: cortex_a76.hh:61
static std::stack< std::string > path
Definition: serialize.hh:267
void clockPeriodUpdated() override
A hook subclasses can implement so they can do any extra work that&#39;s needed when the clock rate is ch...
Definition: cortex_a76.hh:72
CortexA76(Params &p)
Definition: cortex_a76.hh:67
const char * name() const
Definition: sc_object.cc:46
STL vector class.
Definition: stl.hh:40
Bitfield< 63 > val
Definition: misc.hh:771
Bitfield< 31 > n
std::vector< ThreadContext * > threadContexts
Definition: base.hh:267
Iris::CPU< CortexA76TC > Base
Definition: cortex_a76.hh:58
sc_core::sc_module * evs
Definition: cpu.hh:98
const Params & params()
Definition: cortex_a76.hh:64
uint64_t frequency() const
CortexA76 * getCore(int num)
Definition: cortex_a76.hh:112
const Params & _params
Definition: cortex_a76.hh:59
sc_core::sc_module * getEvs()
Definition: cortex_a76.hh:113
void setCluster(CortexA76Cluster *_cluster, int _num)
Definition: cortex_a76.cc:49
FastModelCortexA76Params Params
Definition: cortex_a76.hh:57
Port Object Declaration.
std::vector< CortexA76 * > cores
Definition: cortex_a76.hh:101
void set_evs_param(const std::string &n, T val)
Definition: cortex_a76.hh:107
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: cortex_a76.cc:42
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
const Params & params()
Definition: cortex_a76.hh:116
FastModelCortexA76ClusterParams Params
Definition: cortex_a76.hh:98
Bitfield< 0 > p
sc_core::sc_module * evs
Definition: cortex_a76.hh:102
void clockPeriodUpdated() override
A hook subclasses can implement so they can do any extra work that&#39;s needed when the clock rate is ch...
Definition: cpu.hh:107
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: cortex_a76.cc:95
Abstract superclass for simulation objects.
Definition: sim_object.hh:96

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