ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
etiss::SimpleMemSystem Class Reference

simple etiss:System implementation for testing More...

#include <SimpleMemSystem.h>

Inheritance diagram for etiss::SimpleMemSystem:
Inheritance graph
[legend]
Collaboration diagram for etiss::SimpleMemSystem:
Collaboration graph
[legend]

Classes

struct  find_fitting_mseg
 

Public Member Functions

 SimpleMemSystem (void)
 
virtual ~SimpleMemSystem (void)
 
etiss::int32 iread (ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint32 len)
 Instruction read operation. More...
 
etiss::int32 iwrite (ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
 Instruction write operation. More...
 
etiss::int32 dread (ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
 Data read operation. More...
 
etiss::int32 dwrite (ETISS_CPU *cpu, etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
 Data write operation. More...
 
etiss::int32 dbg_read (etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
 Debug read operation. More...
 
etiss::int32 dbg_write (etiss::uint64 addr, etiss::uint8 *buf, etiss::uint32 len)
 Debug write operation. More...
 
void syncTime (ETISS_CPU *cpu)
 Synchronize simulation time. More...
 
void init_memory ()
 
void load_elf ()
 
void load_segments (void)
 
etiss::uint64 get_startaddr (void)
 
void add_memsegment (std::unique_ptr< MemSegment > &mseg, const void *raw_data, size_t file_size_bytes)
 
- Public Member Functions inherited from etiss::System
virtual ~System ()
 

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::uint64configured_address_spaces_
 

Detailed Description

simple etiss:System implementation for testing

Definition at line 123 of file SimpleMemSystem.h.

Constructor & Destructor Documentation

◆ SimpleMemSystem()

SimpleMemSystem::SimpleMemSystem ( void  )

Definition at line 400 of file SimpleMemSystem.cpp.

References etiss::cfg(), print_dbus_access_, and trace_file_dbus_.

Here is the call graph for this function:

◆ ~SimpleMemSystem()

virtual etiss::SimpleMemSystem::~SimpleMemSystem ( void  )
inlinevirtual

Definition at line 128 of file SimpleMemSystem.h.

References msegs_.

Member Function Documentation

◆ add_memsegment()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbg_read()

etiss::int32 SimpleMemSystem::dbg_read ( etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
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.

Note
The read debug operation is used for the instruction fetches required for generating the code blocks.
Parameters
addrThe address from which the data should be read.
bufPointer to the buffer, that contains the instruction.
lenThe length of the data in bytes.
Returns
0 if no error occurred.

Implements etiss::System.

Definition at line 504 of file SimpleMemSystem.cpp.

References dread().

Here is the call graph for this function:

◆ dbg_write()

etiss::int32 SimpleMemSystem::dbg_write ( etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
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.

Parameters
addrThe address to which the data should be written.
bufPointer to the buffer, that contains the instruction.
lenThe length of the data in bytes.
Returns
0 if no error occurred

Implements etiss::System.

Definition at line 509 of file SimpleMemSystem.cpp.

References dwrite().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbus_access()

template<bool write>
etiss::int32 SimpleMemSystem::dbus_access ( ETISS_CPU cpu,
etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
private

◆ dread()

etiss::int32 SimpleMemSystem::dread ( ETISS_CPU cpu,
etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
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.

Parameters
cpuPointer to the CPU structure, that requested this operation.
addrThe address from which the data should be read.
bufPointer to the buffer, that contains the instruction.
lenThe length of the data in bytes.
Returns
0 if no error occurred.

Implements etiss::System.

Definition at line 494 of file SimpleMemSystem.cpp.

Referenced by dbg_read().

Here is the caller graph for this function:

◆ dwrite()

etiss::int32 SimpleMemSystem::dwrite ( ETISS_CPU cpu,
etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
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.

Parameters
cpuPointer to the CPU structure, that requested this operation.
addrThe address to which the data should be written.
bufPointer to the buffer, that contains the instruction.
lenThe length of the data in bytes.
Returns
0 if no error occurred.

Implements etiss::System.

Definition at line 499 of file SimpleMemSystem.cpp.

Referenced by dbg_write().

Here is the caller graph for this function:

◆ get_startaddr()

etiss::uint64 etiss::SimpleMemSystem::get_startaddr ( void  )
inline

Definition at line 147 of file SimpleMemSystem.h.

References start_addr_.

Referenced by main().

Here is the caller graph for this function:

◆ init_memory()

void SimpleMemSystem::init_memory ( )

Definition at line 192 of file SimpleMemSystem.cpp.

References b, load_elf(), load_segments(), msegs_, and sort().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iread()

etiss::int32 SimpleMemSystem::iread ( ETISS_CPU cpu,
etiss::uint64  addr,
etiss::uint32  len 
)
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.

Note
Normally this method can be implemented as an empty method that only returns an error value. Because of the translating nature of ETISS all instruction operations are out of order an will be performed via the debug interface.
Parameters
cpuPointer to the CPU structure, that requested this operation.
addrThe address from which the instruction should be read.
lenThe length of the instruction in bytes.
Returns
0 if no error occurred

Implements etiss::System.

Definition at line 425 of file SimpleMemSystem.cpp.

References access_error(), etiss::ERROR, msegs_, and etiss::mm::NOERROR.

Here is the call graph for this function:

◆ iwrite()

etiss::int32 SimpleMemSystem::iwrite ( ETISS_CPU cpu,
etiss::uint64  addr,
etiss::uint8 buf,
etiss::uint32  len 
)
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.

Note
Normally this method can be implemented as an empty method that only returns an error value. Because of the translating nature of ETISS all instruction operations are out of order an will be performed via the debug interface
Parameters
cpuPointer to the CPU structure, that requested this operation.
addrThe address to which the instruction should be written.
bufPointer to the buffer, that contains the instruction.
lenThe length of the instruction in bytes.
Returns
0 if no error occurred.

Implements etiss::System.

Definition at line 434 of file SimpleMemSystem.cpp.

References access_error(), and etiss::ERROR.

Here is the call graph for this function:

◆ load_elf()

void SimpleMemSystem::load_elf ( )

◆ load_segments()

void SimpleMemSystem::load_segments ( void  )

◆ syncTime()

void SimpleMemSystem::syncTime ( ETISS_CPU cpu)
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.

See also
etiss::ETISS_CPU
Parameters
cpuPointer to the CPU structure, for which the synchronization should be performed.

Implements etiss::System.

Definition at line 515 of file SimpleMemSystem.cpp.

Member Data Documentation

◆ configured_address_spaces_

std::map<etiss::uint64, etiss::uint64> etiss::SimpleMemSystem::configured_address_spaces_
private

Definition at line 176 of file SimpleMemSystem.h.

Referenced by load_segments().

◆ error_on_seg_mismatch_

bool etiss::SimpleMemSystem::error_on_seg_mismatch_
private

Definition at line 170 of file SimpleMemSystem.h.

Referenced by load_elf().

◆ message_max_cnt_

int etiss::SimpleMemSystem::message_max_cnt_
private

Definition at line 172 of file SimpleMemSystem.h.

◆ msegs_

std::vector<std::unique_ptr<MemSegment> > etiss::SimpleMemSystem::msegs_ {}
private

◆ print_dbgbus_access_

bool etiss::SimpleMemSystem::print_dbgbus_access_
private

Definition at line 167 of file SimpleMemSystem.h.

◆ print_dbus_access_

bool etiss::SimpleMemSystem::print_dbus_access_
private

Definition at line 166 of file SimpleMemSystem.h.

Referenced by dbus_access(), and SimpleMemSystem().

◆ print_ibus_access_

bool etiss::SimpleMemSystem::print_ibus_access_
private

Definition at line 165 of file SimpleMemSystem.h.

◆ print_to_file_

bool etiss::SimpleMemSystem::print_to_file_
private

Definition at line 168 of file SimpleMemSystem.h.

Referenced by dbus_access().

◆ start_addr_

etiss::uint64 etiss::SimpleMemSystem::start_addr_ { 0 }
private

Definition at line 156 of file SimpleMemSystem.h.

Referenced by get_startaddr(), and load_elf().

◆ trace_file_dbus_

std::ofstream etiss::SimpleMemSystem::trace_file_dbus_
private

Definition at line 174 of file SimpleMemSystem.h.

Referenced by dbus_access(), and SimpleMemSystem().


The documentation for this class was generated from the following files: