gem5  v22.0.0.2
cortex_r52.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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 
28 #ifndef __ARCH_ARM_FASTMODEL_CORTEXR52_CORETEX_R52_HH__
29 #define __ARCH_ARM_FASTMODEL_CORTEXR52_CORETEX_R52_HH__
30 
34 #include "params/FastModelCortexR52.hh"
35 #include "params/FastModelCortexR52Cluster.hh"
36 #include "scx/scx.h"
37 #include "sim/port.hh"
39 
40 namespace gem5
41 {
42 
43 class BaseCPU;
44 
45 GEM5_DEPRECATED_NAMESPACE(FastModel, fastmodel);
46 namespace fastmodel
47 {
48 
49 // The fast model exports a class called scx_evs_CortexR52x1 which represents
50 // the subsystem described in LISA+. This class specializes it to export gem5
51 // ports and interface with its peer gem5 CPU. The gem5 CPU inherits from the
52 // gem5 BaseCPU class and implements its API, while this class actually does
53 // the work.
54 class CortexR52Cluster;
55 
56 class CortexR52 : public Iris::CPU<CortexR52TC>
57 {
58  protected:
60 
62  int num = 0;
63 
64  public:
65  PARAMS(FastModelCortexR52);
66  CortexR52(const Params &p) :
67  Base(p, scx::scx_get_iris_connection_interface())
68  {}
69 
70  template <class T>
71  void set_evs_param(const std::string &n, T val);
72 
73  void setCluster(CortexR52Cluster *_cluster, int _num);
74 
75  void setResetAddr(Addr addr, bool secure = false) override;
76 
77  Port &getPort(const std::string &if_name,
78  PortID idx=InvalidPortID) override;
79 };
80 
82 {
83  private:
86 
87  public:
88  template <class T>
89  void
90  set_evs_param(const std::string &n, T val)
91  {
92  scx::scx_set_parameter(evs->name() + std::string(".") + n, val);
93  }
94 
95  CortexR52 *getCore(int num) const { return cores.at(num); }
96  sc_core::sc_module *getEvs() const { return evs; }
97 
98  PARAMS(FastModelCortexR52Cluster);
99  CortexR52Cluster(const Params &p);
100 
101  Port &getPort(const std::string &if_name,
102  PortID idx=InvalidPortID) override;
103 };
104 
105 template <class T>
106 inline void
107 CortexR52::set_evs_param(const std::string &n, T val)
108 {
109  for (auto &path: params().thread_paths)
110  cluster->set_evs_param(path + "." + n, val);
111 }
112 
113 } // namespace fastmodel
114 } // namespace gem5
115 
116 #endif // __ARCH_ARM_FASTMODEL_CORTEXR52_CORETEX_R52_HH__
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::fastmodel::CortexR52Cluster::evs
sc_core::sc_module * evs
Definition: cortex_r52.hh:85
gem5::fastmodel::CortexR52::setResetAddr
void setResetAddr(Addr addr, bool secure=false) override
Definition: cortex_r52.cc:83
gem5::fastmodel::CortexR52Cluster::getEvs
sc_core::sc_module * getEvs() const
Definition: cortex_r52.hh:96
sc_core::sc_module
Definition: sc_module.hh:101
gem5::fastmodel::CortexR52::setCluster
void setCluster(CortexR52Cluster *_cluster, int _num)
Definition: cortex_r52.cc:43
gem5::fastmodel::CortexR52::cluster
CortexR52Cluster * cluster
Definition: cortex_r52.hh:61
gem5::fastmodel::CortexR52::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Definition: cortex_r52.cc:89
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
gem5::fastmodel::CortexR52::CortexR52
CortexR52(const Params &p)
Definition: cortex_r52.hh:66
std::vector
STL vector class.
Definition: stl.hh:37
gem5::fastmodel::CortexR52
Definition: cortex_r52.hh:56
gem5::fastmodel::CortexR52Cluster::set_evs_param
void set_evs_param(const std::string &n, T val)
Definition: cortex_r52.hh:90
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:246
gem5::fastmodel::CortexR52Cluster::getCore
CortexR52 * getCore(int num) const
Definition: cortex_r52.hh:95
gem5::fastmodel::CortexR52::PARAMS
PARAMS(FastModelCortexR52)
cpu.hh
gem5::SimObject::Params
SimObjectParams Params
Definition: sim_object.hh:170
gem5::fastmodel::CortexR52::num
int num
Definition: cortex_r52.hh:62
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::fastmodel::CortexR52Cluster::PARAMS
PARAMS(FastModelCortexR52Cluster)
thread_context.hh
gem5::fastmodel::CortexR52Cluster::cores
std::vector< CortexR52 * > cores
Definition: cortex_r52.hh:84
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
port.hh
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::fastmodel::CortexR52Cluster
Definition: cortex_r52.hh:81
sc_module.hh
amba_ports.hh
gem5::fastmodel::CortexR52::set_evs_param
void set_evs_param(const std::string &n, T val)
Definition: cortex_r52.hh:107
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:456
gem5::fastmodel::CortexR52::Base
Iris::CPU< CortexR52TC > Base
Definition: cortex_r52.hh:59
sc_core::sc_object::name
const char * name() const
Definition: sc_object.cc:44
gem5::Iris::CPU
Definition: cpu.hh:118
gem5::fastmodel::CortexR52Cluster::CortexR52Cluster
CortexR52Cluster(const Params &p)
Definition: cortex_r52.cc:107
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::fastmodel::CortexR52Cluster::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: cortex_r52.cc:157
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Thu Jul 28 2022 13:32:22 for gem5 by doxygen 1.8.17