ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
simple etiss:System implementation for testing More...
#include <SimpleMemSystem.h>
Classes | |
struct | find_fitting_mseg |
Private Member Functions | |
template<bool write> | |
etiss::int32 | dbus_access (ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len) |
Private Attributes | |
std::vector< std::unique_ptr< MemSegment > > | msegs_ {} |
etiss::uint64 | start_addr_ { 0 } |
bool | print_ibus_access_ |
bool | print_dbus_access_ |
bool | print_dbgbus_access_ |
bool | print_to_file_ |
bool | error_on_seg_mismatch_ |
int | message_max_cnt_ |
std::ofstream | trace_file_dbus_ |
std::map< etiss::uint64, etiss::uint64 > | configured_address_spaces_ |
simple etiss:System implementation for testing
Definition at line 123 of file SimpleMemSystem.h.
SimpleMemSystem::SimpleMemSystem | ( | void | ) |
Definition at line 400 of file SimpleMemSystem.cpp.
References etiss::cfg(), print_dbus_access_, and trace_file_dbus_.
|
inlinevirtual |
Definition at line 128 of file SimpleMemSystem.h.
References msegs_.
void SimpleMemSystem::add_memsegment | ( | std::unique_ptr< MemSegment > & | mseg, |
const void * | raw_data, | ||
size_t | file_size_bytes | ||
) |
Definition at line 389 of file SimpleMemSystem.cpp.
References etiss::INFO, etiss::log(), and msegs_.
Referenced by load_elf(), and load_segments().
|
virtual |
Debug read operation.
This method should implement a debug read operation. The debug operations are used for data access that should not influence the simulation time. To indicate an error a non 0 value should be returned.
addr | The address from which the data should be read. |
buf | Pointer to the buffer, that contains the instruction. |
len | The length of the data in bytes. |
Implements etiss::System.
Definition at line 504 of file SimpleMemSystem.cpp.
References dread().
|
virtual |
Debug write operation.
This method should implement a debug write operation. The debug operations are used for data access that should not influence the simulation time. To indicate an error a non 0 value should be returned.
addr | The address to which the data should be written. |
buf | Pointer to the buffer, that contains the instruction. |
len | The length of the data in bytes. |
Implements etiss::System.
Definition at line 509 of file SimpleMemSystem.cpp.
References dwrite().
Referenced by main().
|
private |
Definition at line 466 of file SimpleMemSystem.cpp.
References access_error(), etiss::ERROR, memcpy(), msegs_, etiss::mm::NOERROR, print_dbus_access_, print_to_file_, etiss::MemSegment::READ, trace(), trace_file_dbus_, etiss::WARNING, and etiss::MemSegment::WRITE.
|
virtual |
Data read operation.
This method should implement a data read operation. To indicate an error a non 0 value should be returned. The CPU time needs to be increased according to the delay of this instruction operation.
cpu | Pointer to the CPU structure, that requested this operation. |
addr | The address from which the data should be read. |
buf | Pointer to the buffer, that contains the instruction. |
len | The length of the data in bytes. |
Implements etiss::System.
Definition at line 494 of file SimpleMemSystem.cpp.
Referenced by dbg_read().
|
virtual |
Data write operation.
This method should implement a data write operation. To indicate an error a non 0 value should be returned. The CPU time needs to be increased according to the delay of this instruction operation.
cpu | Pointer to the CPU structure, that requested this operation. |
addr | The address to which the data should be written. |
buf | Pointer to the buffer, that contains the instruction. |
len | The length of the data in bytes. |
Implements etiss::System.
Definition at line 499 of file SimpleMemSystem.cpp.
Referenced by dbg_write().
|
inline |
Definition at line 147 of file SimpleMemSystem.h.
References start_addr_.
Referenced by main().
void SimpleMemSystem::init_memory | ( | ) |
Definition at line 192 of file SimpleMemSystem.cpp.
References b, load_elf(), load_segments(), msegs_, and sort().
Referenced by main().
|
virtual |
Instruction read operation.
This method should implement an instruction read operation. To indicate an error a non 0 value should be returned. The CPU time needs to be increased according to the delay of this instruction operation.
cpu | Pointer to the CPU structure, that requested this operation. |
addr | The address from which the instruction should be read. |
len | The length of the instruction in bytes. |
Implements etiss::System.
Definition at line 425 of file SimpleMemSystem.cpp.
References access_error(), etiss::ERROR, msegs_, and etiss::mm::NOERROR.
|
virtual |
Instruction write operation.
This method should implement an instruction write operation. To indicate an error a non 0 value should be returned. The CPU time needs to be increased according to the delay of this instruction operation.
cpu | Pointer to the CPU structure, that requested this operation. |
addr | The address to which the instruction should be written. |
buf | Pointer to the buffer, that contains the instruction. |
len | The length of the instruction in bytes. |
Implements etiss::System.
Definition at line 434 of file SimpleMemSystem.cpp.
References access_error(), and etiss::ERROR.
void SimpleMemSystem::load_elf | ( | ) |
Definition at line 284 of file SimpleMemSystem.cpp.
References add_memsegment(), etiss::cfg(), error_on_seg_mismatch_, etiss::MemSegment::EXEC, etiss::FATALERROR, etiss::Configuration::get(), etiss::INFO, etiss::log(), get_metrics::mode, msegs_, etiss::MemSegment::READ, get_metrics::reader, etiss::Configuration::set(), start_addr_, etiss::WARNING, and etiss::MemSegment::WRITE.
Referenced by init_memory().
void SimpleMemSystem::load_segments | ( | void | ) |
Definition at line 198 of file SimpleMemSystem.cpp.
References add_memsegment(), etiss::cfg(), configured_address_spaces_, etiss::MemSegment::EXEC, etiss::FATALERROR, etiss::Configuration::get(), etiss::INFO, etiss::Configuration::isSet(), length(), etiss::log(), MAX_MEMSEGS, get_metrics::mode, etiss::MemSegment::READ, uint64_t, etiss::MemSegment::UNSET, and etiss::MemSegment::WRITE.
Referenced by init_memory().
|
virtual |
Synchronize simulation time.
This method should implement the synchronization between the simulation time of the system and the CPU. This function call should allow the system to catch up with the CPU.
cpu | Pointer to the CPU structure, for which the synchronization should be performed. |
Implements etiss::System.
Definition at line 515 of file SimpleMemSystem.cpp.
|
private |
Definition at line 176 of file SimpleMemSystem.h.
Referenced by load_segments().
|
private |
Definition at line 170 of file SimpleMemSystem.h.
Referenced by load_elf().
|
private |
Definition at line 172 of file SimpleMemSystem.h.
|
private |
Definition at line 151 of file SimpleMemSystem.h.
Referenced by add_memsegment(), dbus_access(), init_memory(), iread(), load_elf(), and ~SimpleMemSystem().
|
private |
Definition at line 167 of file SimpleMemSystem.h.
|
private |
Definition at line 166 of file SimpleMemSystem.h.
Referenced by dbus_access(), and SimpleMemSystem().
|
private |
Definition at line 165 of file SimpleMemSystem.h.
|
private |
Definition at line 168 of file SimpleMemSystem.h.
Referenced by dbus_access().
|
private |
Definition at line 156 of file SimpleMemSystem.h.
Referenced by get_startaddr(), and load_elf().
|
private |
Definition at line 174 of file SimpleMemSystem.h.
Referenced by dbus_access(), and SimpleMemSystem().