|
ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
|
CPUCore is responsible for the simulation of a CPU core in ETISS. More...
#include <CPUCore.h>


Classes | |
| class | InterruptVectorWrapper |
Public Member Functions | |
| ~CPUCore () | |
| void | reset (etiss::uint64 *startindex) |
| Reset the CPU state. | |
| ETISS_CPU * | getState () |
| Get the CPU state structure containing instruction pointer, frequency, etc. | |
| virtual std::shared_ptr< VirtualStruct > | getStruct () |
| Get the virtual structure of this CPUCore instance. | |
| virtual std::shared_ptr< etiss::mm::MMU > | getMMU () |
| Get the Memory Management Unit(MMU) of this CPUCore instance. | |
| etiss::InterruptVector * | getInterruptVector () |
| Get the interrupt vector of simulated CPU. | |
| etiss::InterruptEnable * | getInterruptEnable () |
| std::shared_ptr< etiss::CPUArch > | getArch () |
| Get the CPU architecture. | |
| void | set (std::shared_ptr< etiss::JIT > jit) |
| Set the JIT plug-in used for execution. | |
| void | setTimer (bool on) |
| Enable or disable the timer of the CPU. | |
| void | addPlugin (std::shared_ptr< etiss::Plugin > plugin) |
| Adds a plug-in to the core simulator. | |
| void | removePlugin (std::shared_ptr< etiss::Plugin > plugin) |
| Remove a plug-in from the core simulator. | |
| void | removePlugins () |
| Remove all plug-ins from the core simulator. | |
| void | setBlockChainCount (unsigned bcc) |
| Set the number of blocks jumps in between the coroutines are not executed. | |
| etiss::int32 | execute (ETISS_System &system) |
| Start the simulation of the CPU core for the system model. | |
| etiss::int32 | execute (etiss::System &system) |
| Start the simulation of the CPU core for the system model. | |
| const std::string & | getName () |
| Get the name of the CPUCore instance. | |
| const int & | getID () |
| Get the ID of the CPUCore instance. | |
| std::string | getJITName () |
| Get the name of the JIT plug-in used by the CPUCore instance. | |
| std::shared_ptr< etiss::JIT > | getJIT () |
| Get a reference to the JIT plugin. | |
| const std::string & | toString () const |
| Get a string representation of the object. | |
| std::shared_ptr< Plugin > | getPlugin (std::string name) |
| returns the plugin with the given name. | |
| std::list< std::shared_ptr< Plugin > > const * | getPlugins () |
| returns the list of all plugins. | |
Public Member Functions inherited from etiss::VirtualStructSupport | |
| virtual | ~VirtualStructSupport () |
Public Member Functions inherited from etiss::ToString | |
| ToString () | |
| virtual | ~ToString () |
Static Public Member Functions | |
| static std::shared_ptr< CPUCore > | create (std::string archname, std::string instancename="", std::map< std::string, std::string > archoptions=std::map< std::string, std::string >()) |
| Create a CPUCore instance. | |
| static int | getNextID () |
| static std::list< std::string > | list () |
| returns a list of currently present CPU cores | |
Public Attributes | |
| uint64_t | instrcounter |
Protected Member Functions | |
| CPUCore (std::shared_ptr< etiss::CPUArch > arch, std::string const &name) | |
| Private constructor of CPUCore. | |
| CPUCore (std::shared_ptr< etiss::CPUArch > arch) | |
Private Attributes | |
| std::shared_ptr< etiss::CPUArch > | arch_ |
| std::string | name_ |
| cpu architecture of this cpu core. may never be 0 or changed | |
| const int | id_ |
| name of the cpu core | |
| ETISS_CPU * | cpu_ |
| ID of the cpu core. | |
| std::shared_ptr< etiss::VirtualStruct > | vcpu_ |
| cpu state structure allocated by arch_ | |
| etiss::InterruptVector * | intvector_ |
| InterruptVectorWrapper * | intwrapper_ |
| cpu interrupt vector derived from cpu_ and allocated by arch_ | |
| etiss::InterruptEnable * | intenable_ |
| wrapped interrupt vector to allow interrupt listening | |
| bool | timer_enabled_ |
| std::shared_ptr< etiss::JIT > | jit_ |
| if true the a timer plugin allocated by arch_ will be added in CPUCore::execute | |
| std::mutex | mu_ |
| JIT instance to use. may be 0 (etiss::getDefaultJIT() will be used in that case) | |
| std::list< std::shared_ptr< Plugin > > | plugins |
| mutex to lock the configuration of this cpu core. | |
| unsigned | bcc_ |
| list of all plugins | |
| unsigned | blockCounter |
| unsigned | exception_skip_count_ |
| int | blockCacheLimit_ |
| bool | mmu_enabled_ |
| TODO: possibility to limit the cache size. | |
| std::shared_ptr< etiss::mm::MMU > | mmu_ |
Static Private Attributes | |
| static std::mutex | instances_mu_ |
| this field is always present to maintain API compatibility but it is only used if ETISS_CPUCORE_DBG_APPROXIMATE_INSTRUCTION_COUNTER is set to 1 | |
| static std::list< std::weak_ptr< CPUCore > > | instances_ |
| mutext for access to a list of cpu core instances | |
Friends | |
| class | CPUArchRegListenerInterface |
| class | InterruptVectorWrapper |
CPUCore is responsible for the simulation of a CPU core in ETISS.
CPUCore is responsible for the simulation of a CPU core in ETISS. An instance of CPUCore is always tied to a single CPU architecture. If plug-ins should be active during the simulation they need to be added to the CPUCore instance. Before the simulation can be start a JIT compilier must be present if the default JIT plug-in should not be used (etiss::getDefaultJIT()). A JIT plug-in must be specified with CPUCore::set(). To start the simulation of a system model with a CPUCore instance call CPUCore::execute().
|
protected |
Private constructor of CPUCore.
To create a new instance of CPUCore use the CPUCore::create().
| name | The name of the CPUCore instance. |
| arch | Pointer to the CPU architecture used by the CPU core simulator. |
Definition at line 122 of file CPUCore.cpp.
References arch_, bcc_, blockCacheLimit_, blockCounter, cpu_, exception_skip_count_, instrcounter, ETISS_CPU::instructionPointer, intvector_, intwrapper_, etiss::VirtualStruct::Field::P, etiss::VirtualStruct::Field::R, timer_enabled_, uint64_t, v, vcpu_, and etiss::VirtualStruct::Field::W.
|
protected |
Definition at line 173 of file CPUCore.cpp.
| CPUCore::~CPUCore | ( | ) |
Definition at line 282 of file CPUCore.cpp.
References arch_, cpu_, intvector_, intwrapper_, and vcpu_.
| void CPUCore::addPlugin | ( | std::shared_ptr< etiss::Plugin > | plugin | ) |
Adds a plug-in to the core simulator.
See the different plug-in classes, for information on how the plug-in influences the simulation.
| plugin | Pointer to the plug-in that shall be added. |
Definition at line 175 of file CPUCore.cpp.
References getName(), etiss::log(), mu_, plugins, and etiss::WARNING.

|
static |
Create a CPUCore instance.
This is the factory method to create a new CPUCore instance for a specific CPU architecture.
| archname | The name of a CPUArch plug-in. This plug-in must be present in ETISS in order to create the CPUCore instance. |
| instancename | A descriptive name for the new instance. |
| archoptions | A key value map with options for the CPUArch plug-in. |
| archoptions | obsolet: now defined by ID - "core[ID]" |
Definition at line 234 of file CPUCore.cpp.
References etiss::FATALERROR, etiss::forceInitialization(), etiss::getCPUArch(), instances_, instances_mu_, and etiss::log().
Referenced by main().


| etiss::int32 CPUCore::execute | ( | etiss::System & | system | ) |
Start the simulation of the CPU core for the system model.
This method works the same as execute(ETISS_System & system), but uses the etiss::System interface to access the model.
Definition at line 945 of file CPUCore.cpp.
References execute(), and etiss::wrap().

| etiss::int32 CPUCore::execute | ( | ETISS_System & | system | ) |
Start the simulation of the CPU core for the system model.
This method starts the simulation of the CPU core for the provided system model. It uses the C-structure interface to access the system model. This method is (like any other methods of this class) thread-safe. However if any method of this class including this one is called while this method is running, it will block until this method is finished returns.
Definition at line 495 of file CPUCore.cpp.
References ETISS_CPU::_etiss_private_handle_, arch_, bcc_, c, etiss::cfg(), coverage_map, cpu_, ETISS_CPU::cpuCycleTime_ps, ETISS_CPU::cpuTime_ps, ETISS_CPU::cycles, double, etiss::BlockLink::end, etiss::ERROR, etiss_CPUCore_handleException(), ETISS_MAX_RESOURCES, ETISS_System_isvalid(), etiss::BlockLink::execBlock, etiss::FATALERROR, float, etiss::Configuration::get(), etiss::Translation::getBlockFast(), etiss::Plugin::getPluginName(), ETISS_System::handle, etiss::INFO, etiss::Translation::init(), instrcounter, ETISS_CPU::instructionPointer, etiss::Configuration::isSet(), jit_, likely, etiss::log(), max(), mmu_, mmu_enabled_, mu_, name_, plugins, ETISS_CPU::resources, ETISS_CPU::resourceUsages, ETISS_System::syncTime, timer_enabled_, etiss::toString(), uint64_t, unlikely, vcpu_, verifyJITPragmaPack(), verifyJITSizeOf(), etiss::WARNING, and etiss::mm::X_ACCESS.
Referenced by execute().


|
inline |
|
inline |
|
inline |
Definition at line 142 of file CPUCore.h.
References intenable_.
|
inline |
Get the interrupt vector of simulated CPU.
Definition at line 140 of file CPUCore.h.
References intwrapper_.
|
inline |
| std::string CPUCore::getJITName | ( | ) |
Get the name of the JIT plug-in used by the CPUCore instance.
Definition at line 954 of file CPUCore.cpp.
References etiss::JIT::getName(), and jit_.

|
inlinevirtual |
Get the Memory Management Unit(MMU) of this CPUCore instance.
MMU is responsible to translate virtual address to physical address, which is essential to support multi-taking operationg systems, such as Linux
Definition at line 133 of file CPUCore.h.
References mmu_.
Referenced by ETISS_SIGNAL_MMU().

|
inlinevirtual |
Get the name of the CPUCore instance.
Implements etiss::VirtualStructSupport.
Definition at line 246 of file CPUCore.h.
References name_.
Referenced by addPlugin().

|
static |
Definition at line 118 of file CPUCore.cpp.
References currID.
Referenced by etiss::CPUArch::CPUArch().

| std::shared_ptr< Plugin > CPUCore::getPlugin | ( | std::string | name | ) |
returns the plugin with the given name.
Definition at line 972 of file CPUCore.cpp.
References plugins.
|
inline |
|
inline |
|
inlinevirtual |
Get the virtual structure of this CPUCore instance.
The virtual structure allows the to access the fields of the CPU structure and sub structures (e.g. plug-ins) used by CPUCore.
Implements etiss::VirtualStructSupport.
Definition at line 122 of file CPUCore.h.
References vcpu_.
Referenced by etiss::plugin::InstructionAccurateCallback::call_on_entry(), etiss::plugin::errorInjection::BlockAccurateHandler::execute(), etiss::plugin::VariableValueLogger::finalizeInstrSet(), etiss::plugin::gdb::Server::handlePacket(), etiss::CPUArchRegListenerInterface::signalChangedRegisterValue(), and etiss::plugin::VariableValueLogger::writeValue().

|
static |
returns a list of currently present CPU cores
Definition at line 264 of file CPUCore.cpp.
References instances_, and instances_mu_.
Referenced by etiss::shutdown().

| void CPUCore::removePlugin | ( | std::shared_ptr< etiss::Plugin > | plugin | ) |
Remove a plug-in from the core simulator.
| plugin | Pointer to the plug-in that shall be removed. |
Definition at line 207 of file CPUCore.cpp.
References mu_, etiss::Plugin::plugin_core_, plugins, and etiss::Plugin::removedFromCPUCore().

|
inline |
| void CPUCore::reset | ( | etiss::uint64 * | startindex | ) |
Reset the CPU state.
Definition at line 967 of file CPUCore.cpp.
|
inline |
|
inline |
|
inline |
Enable or disable the timer of the CPU.
| on | true to enable the timer / false to disable the timer |
Definition at line 172 of file CPUCore.h.
References mu_, and timer_enabled_.
|
inline |
|
friend |
|
friend |
|
private |
|
private |
list of all plugins
Definition at line 325 of file CPUCore.h.
Referenced by CPUCore(), execute(), and setBlockChainCount().
|
private |
|
private |
|
private |
ID of the cpu core.
Definition at line 314 of file CPUCore.h.
Referenced by CPUCore(), execute(), getState(), reset(), and ~CPUCore().
|
private |
|
private |
|
staticprivate |
|
staticprivate |
| uint64_t etiss::CPUCore::instrcounter |
|
private |
wrapped interrupt vector to allow interrupt listening
Definition at line 318 of file CPUCore.h.
Referenced by getInterruptEnable().
|
private |
Definition at line 316 of file CPUCore.h.
Referenced by CPUCore(), and ~CPUCore().
|
private |
cpu interrupt vector derived from cpu_ and allocated by arch_
Definition at line 317 of file CPUCore.h.
Referenced by CPUCore(), getInterruptVector(), and ~CPUCore().
|
private |
if true the a timer plugin allocated by arch_ will be added in CPUCore::execute
Definition at line 321 of file CPUCore.h.
Referenced by execute(), getJIT(), getJITName(), and set().
|
private |
|
private |
|
private |
JIT instance to use. may be 0 (etiss::getDefaultJIT() will be used in that case)
Definition at line 322 of file CPUCore.h.
Referenced by addPlugin(), execute(), removePlugin(), removePlugins(), and setTimer().
|
private |
cpu architecture of this cpu core. may never be 0 or changed
Definition at line 312 of file CPUCore.h.
Referenced by execute(), getName(), and toString().
|
private |
mutex to lock the configuration of this cpu core.
etiss::CPUCore::execution holds this lock during execution
Definition at line 324 of file CPUCore.h.
Referenced by addPlugin(), execute(), getPlugin(), getPlugins(), removePlugin(), and removePlugins().
|
private |
Definition at line 319 of file CPUCore.h.
Referenced by CPUCore(), execute(), and setTimer().
|
private |
cpu state structure allocated by arch_
Definition at line 315 of file CPUCore.h.
Referenced by CPUCore(), execute(), getStruct(), and ~CPUCore().