gem5  v20.1.0.0
cpu.cc
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 
29 
31 #include "scx/scx.h"
32 #include "sim/serialize.hh"
33 
34 namespace Iris
35 {
36 
37 BaseCPU::BaseCPU(BaseCPUParams *params, sc_core::sc_module *_evs) :
38  ::BaseCPU::BaseCPU(params), evs(_evs),
39  clockEvent(nullptr), periodAttribute(nullptr)
40 {
42 
43  const auto &event_vec = evs->get_child_events();
44  auto event_it = std::find_if(event_vec.begin(), event_vec.end(),
45  [](const sc_core::sc_event *e) -> bool {
46  return e->basename() == ClockEventName; });
47  if (event_it != event_vec.end())
48  clockEvent = *event_it;
49 
53  "The EVS clock period attribute is not of type "
54  "sc_attribute<Tick>.");
55 
59  base);
61  "The EVS send functional attribute is not of type "
62  "sc_attribute<PortProxy::SendFunctionalFunc>.");
63 
64  // Make sure fast model knows we're using debugging mechanisms to control
65  // the simulation, and it shouldn't shut down if simulation time stops
66  // for some reason. Despite the misleading name, this doesn't start a CADI
67  // server because it's first parameter is false.
68  scx::scx_start_cadi_server(false, false, true);
69 }
70 
72 {
73  for (auto &tc: threadContexts)
74  delete tc;
75  threadContexts.clear();
76 }
77 
78 Counter
80 {
81  Counter count = 0;
82  for (auto *tc: threadContexts)
83  count += tc->getCurrentInstCount();
84  return count;
85 }
86 
87 void
89 {
91  for (auto *tc: threadContexts)
92  tc->initMemProxies(tc);
93 }
94 
95 void
97 {
99 }
100 
101 } // namespace Iris
serialize.hh
Iris::PeriodAttributeName
static const std::string PeriodAttributeName
Definition: cpu.hh:46
BaseCPU::init
void init() override
Definition: base.cc:267
Iris
Definition: cpu.cc:34
sc_core::sc_module
Definition: sc_module.hh:97
Iris::BaseCPU::~BaseCPU
virtual ~BaseCPU()
Definition: cpu.cc:71
ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
Iris::BaseCPU::serializeThread
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
Definition: cpu.cc:96
Iris::BaseCPU::BaseCPU
BaseCPU(BaseCPUParams *params, sc_core::sc_module *_evs)
Definition: cpu.cc:37
sc_core::sc_attribute< Tick >
X86ISA::base
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
X86ISA::count
count
Definition: misc.hh:703
Iris::BaseCPU::totalInsts
Counter totalInsts() const override
Definition: cpu.cc:79
cpu.hh
sc_core::sc_attr_base
Definition: sc_attr.hh:37
Counter
int64_t Counter
Statistics counter type.
Definition: types.hh:58
cp
Definition: cprintf.cc:40
Iris::BaseCPU::evs
sc_core::sc_module * evs
Definition: cpu.hh:96
Iris::BaseCPU::periodAttribute
sc_core::sc_attribute< Tick > * periodAttribute
Definition: cpu.hh:100
sc_core::sc_event
Definition: sc_event.hh:169
BaseCPU::threadContexts
std::vector< ThreadContext * > threadContexts
Definition: base.hh:252
BaseCPU::serialize
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
Definition: base.cc:651
Iris::BaseCPU::clockEvent
sc_core::sc_event * clockEvent
Definition: cpu.hh:99
sc_core::sc_object::get_attribute
sc_attr_base * get_attribute(const std::string &)
Definition: sc_object.cc:92
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
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:197
Iris::BaseCPU::init
void init() override
Definition: cpu.cc:88
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
Iris::SendFunctionalAttributeName
static const std::string SendFunctionalAttributeName
Definition: cpu.hh:52
thread_context.hh
Iris::BaseCPU::sendFunctional
sc_core::sc_attribute< PortProxy::SendFunctionalFunc > * sendFunctional
Definition: cpu.hh:101
sc_core::sc_module::get_child_events
virtual const std::vector< sc_event * > & get_child_events() const
Definition: sc_module.cc:251
Iris::BaseCPU
Definition: cpu.hh:58

Generated on Wed Sep 30 2020 14:01:58 for gem5 by doxygen 1.8.17