gem5  v22.0.0.2
cortex_r52.cc
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 
29 
31 #include "base/logging.hh"
32 #include "dev/arm/base_gic.hh"
34 
35 namespace gem5
36 {
37 
38 GEM5_DEPRECATED_NAMESPACE(FastModel, fastmodel);
39 namespace fastmodel
40 {
41 
42 void
44 {
45  cluster = _cluster;
46  num = _num;
47 
48  set_evs_param("CFGEND", params().CFGEND);
49  set_evs_param("CFGTE", params().CFGTE);
50  set_evs_param("RVBARADDR", params().RVBARADDR);
51  set_evs_param("ase-present", params().ase_present);
52  set_evs_param("dcache-size", params().dcache_size);
53  set_evs_param("flash.enable", params().flash_enable);
54  set_evs_param("icache-size", params().icache_size);
55  set_evs_param("llpp.base", params().llpp_base);
56  set_evs_param("llpp.size", params().llpp_size);
57  set_evs_param("max_code_cache_mb", params().max_code_cache_mb);
58  set_evs_param("min_sync_level", params().min_sync_level);
59  set_evs_param("semihosting-A32_HLT", params().semihosting_A32_HLT);
60  // Use uint32_t, since the model doesn't like setting these as uint8_t.
61  set_evs_param<uint32_t>("semihosting-ARM_SVC",
62  params().semihosting_ARM_SVC);
63  set_evs_param<uint32_t>("semihosting-T32_HLT",
64  params().semihosting_T32_HLT);
65  set_evs_param<uint32_t>("semihosting-Thumb_SVC",
66  params().semihosting_Thumb_SVC);
67  set_evs_param("semihosting-cmd_line", params().semihosting_cmd_line);
68  set_evs_param("semihosting-cwd", params().semihosting_cwd);
69  set_evs_param("semihosting-enable", params().semihosting_enable);
70  set_evs_param("semihosting-heap_base", params().semihosting_heap_base);
71  set_evs_param("semihosting-heap_limit", params().semihosting_heap_limit);
72  set_evs_param("semihosting-stack_base", params().semihosting_stack_base);
73  set_evs_param("semihosting-stack_limit", params().semihosting_stack_limit);
74  set_evs_param("tcm.a.enable", params().tcm_a_enable);
75  set_evs_param("tcm.a.size", params().tcm_a_size);
76  set_evs_param("tcm.b.size", params().tcm_b_size);
77  set_evs_param("tcm.c.size", params().tcm_c_size);
78  set_evs_param("vfp-dp-present", params().vfp_dp_present);
79  set_evs_param("vfp-enable_at_reset", params().vfp_enable_at_reset);
80 }
81 
82 void
84 {
85  evs_base_cpu->setResetAddr(num, addr, secure);
86 }
87 
88 Port &
89 CortexR52::getPort(const std::string &if_name, PortID idx)
90 {
91  if (if_name == "ppi") {
92  // Since PPIs are indexed both by core and by number, modify the name
93  // to hold the core number.
94  return evs->gem5_getPort(csprintf("%s_%d", if_name, num), idx);
95  } else if (if_name == "amba" || if_name == "llpp" || if_name == "flash" ||
96  if_name == "core_reset" || if_name == "poweron_reset" ||
97  if_name == "halt") {
98  // Since these ports are scalar per core, use the core number as the
99  // index. Also verify that that index is not being used.
100  assert(idx == InvalidPortID);
101  return evs->gem5_getPort(if_name, num);
102  } else {
103  return SimObject::getPort(if_name, idx);
104  }
105 }
106 
108  SimObject(p), cores(p.cores), evs(p.evs)
109 {
110  for (int i = 0; i < p.cores.size(); i++)
111  p.cores[i]->setCluster(this, i);
112 
113  Iris::BaseCpuEvs *e = dynamic_cast<Iris::BaseCpuEvs *>(evs);
114  panic_if(!e, "EVS should be of type Iris::BaseCpuEvs");
115  e->setCluster(this);
116 
117  set_evs_param("core.CLUSTER_ID", params().CLUSTER_ID);
118  set_evs_param("core.DBGROMADDR", params().DBGROMADDR);
119  set_evs_param("core.DBGROMADDRV", params().DBGROMADDRV);
120  set_evs_param("core.PERIPHBASE", params().PERIPHBASE);
121  set_evs_param("core.cluster_utid", params().cluster_utid);
122  set_evs_param("core.cpi_div", params().cpi_div);
123  set_evs_param("core.cpi_mul", params().cpi_mul);
124  set_evs_param("core.dcache-prefetch_enabled",
125  params().dcache_prefetch_enabled);
126  set_evs_param("core.dcache-read_access_latency",
127  params().dcache_read_access_latency);
128  set_evs_param("core.dcache-state_modelled",
129  params().dcache_state_modelled);
130  set_evs_param("core.dcache-write_access_latency",
131  params().dcache_write_access_latency);
132  set_evs_param("core.flash_protection_enable_at_reset",
133  params().flash_protection_enable_at_reset);
134  set_evs_param("core.has_flash_protection", params().has_flash_protection);
135  set_evs_param("core.icache-prefetch_enabled",
136  params().icache_prefetch_enabled);
137  set_evs_param("core.icache-read_access_latency",
138  params().icache_read_access_latency);
139  set_evs_param("core.icache-state_modelled",
140  params().icache_state_modelled);
141  set_evs_param("core.memory.ext_slave_base",
142  params().memory_ext_slave_base);
143  set_evs_param("core.memory.flash_base", params().memory_flash_base);
144  set_evs_param("core.memory.flash_size", params().memory_flash_size);
145  // Use uint32_t, since the model doesn't like setting these as uint8_t.
146  set_evs_param<uint32_t>("core.num_protection_regions_s1",
147  params().num_protection_regions_s1);
148  set_evs_param<uint32_t>("core.num_protection_regions_s2",
149  params().num_protection_regions_s2);
150  set_evs_param("core.num_spi", params().num_spi);
151  set_evs_param("core.ram_protection_enable_at_reset",
152  params().ram_protection_enable_at_reset);
153  set_evs_param("core.has_export_m_port", params().has_export_m_port);
154 }
155 
156 Port &
157 CortexR52Cluster::getPort(const std::string &if_name, PortID idx)
158 {
159  if (if_name == "spi") {
160  return evs->gem5_getPort(if_name, idx);
161  } else if (if_name == "ext_slave" || if_name == "top_reset" ||
162  if_name == "dbg_reset" || if_name == "model_reset") {
163  assert(idx == InvalidPortID);
164  return evs->gem5_getPort(if_name, idx);
165  } else {
166  return SimObject::getPort(if_name, idx);
167  }
168 }
169 
170 } // namespace fastmodel
171 } // namespace gem5
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::SimObject::getPort
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Definition: sim_object.cc:126
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::Iris::BaseCpuEvs::setResetAddr
virtual void setResetAddr(int core, Addr addr, bool secure)=0
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_to_tlm.hh
gem5::fastmodel::CortexR52::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Definition: cortex_r52.cc:89
base_gic.hh
gem5::Iris::BaseCpuEvs
Definition: cpu.hh:47
gem5::ArmISA::e
Bitfield< 9 > e
Definition: misc_types.hh:65
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
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::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
cpu.hh
gem5::Iris::BaseCPU::evs_base_cpu
Iris::BaseCpuEvs * evs_base_cpu
Definition: cpu.hh:99
gem5::Iris::BaseCPU::evs
sc_core::sc_module * evs
Definition: cpu.hh:97
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::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
cortex_r52.hh
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::fastmodel::CortexR52Cluster
Definition: cortex_r52.hh:81
gem5::fastmodel::CortexR52::set_evs_param
void set_evs_param(const std::string &n, T val)
Definition: cortex_r52.hh:107
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:204
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
sc_core::sc_module::gem5_getPort
virtual gem5::Port & gem5_getPort(const std::string &if_name, int idx=-1)
Definition: sc_module.cc:117
logging.hh
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