A Component representing a Motorola 88000 processor. More...
#include <M88K_CPUComponent.h>
Public Member Functions | |
M88K_CPUComponent () | |
Constructs a M88K_CPUComponent. More... | |
virtual void | ResetState () |
Resets the state variables of this component. More... | |
virtual bool | PreRunCheckForComponent (GXemul *gxemul) |
Checks the state of this component, before starting execution. More... | |
virtual size_t | DisassembleInstruction (uint64_t vaddr, vector< string > &result) |
Disassembles an instruction into readable strings. More... | |
![]() | |
CPUDyntransComponent (const string &className, const string &cpuKind) | |
Constructs a CPUDyntransComponent. More... | |
virtual int | Execute (GXemul *gxemul, int nrOfCycles) |
Execute one or more cycles. More... | |
![]() | |
CPUComponent (const string &className, const string &cpuKind) | |
Constructs a CPUComponent. More... | |
SymbolRegistry & | GetSymbolRegistry () |
Gets a reference to the CPU's symbol registry. More... | |
const SymbolRegistry & | GetSymbolRegistry () const |
virtual double | GetCurrentFrequency () const |
Returns the current frequency (in Hz) that the component runs at. More... | |
virtual CPUComponent * | AsCPUComponent () |
Returns the component's CPUComponent interface. More... | |
virtual void | GetMethodNames (vector< string > &names) const |
Retrieves a component's implemented method names. More... | |
virtual bool | MethodMayBeReexecutedWithoutArgs (const string &methodName) const |
Returns whether a method name may be re-executed without args. More... | |
virtual void | ExecuteMethod (GXemul *gxemul, const string &methodName, const vector< string > &arguments) |
Executes a method on the component. More... | |
virtual AddressDataBus * | AsAddressDataBus () |
Returns the component's AddressDataBus interface, if any. More... | |
virtual void | AddressSelect (uint64_t address) |
Place an address on the bus. More... | |
virtual bool | ReadData (uint8_t &data, Endianness endianness) |
Reads 8-bit data from the currently selected address. More... | |
virtual bool | ReadData (uint16_t &data, Endianness endianness) |
Reads 16-bit data from the currently selected address. More... | |
virtual bool | ReadData (uint32_t &data, Endianness endianness) |
Reads 32-bit data from the currently selected address. More... | |
virtual bool | ReadData (uint64_t &data, Endianness endianness) |
Reads 64-bit data from the currently selected address. More... | |
virtual bool | WriteData (const uint8_t &data, Endianness endianness) |
Writes 8-bit data to the currently selected address. More... | |
virtual bool | WriteData (const uint16_t &data, Endianness endianness) |
Writes 16-bit data to the currently selected address. More... | |
virtual bool | WriteData (const uint32_t &data, Endianness endianness) |
Writes 32-bit data to the currently selected address. More... | |
virtual bool | WriteData (const uint64_t &data, Endianness endianness) |
Writes 64-bit data to the currently selected address. More... | |
![]() | |
virtual | ~Component () |
string | GetClassName () const |
Gets the class name of the component. More... | |
string | GetVisibleClassName () const |
Gets the visible class name of the component. More... | |
refcount_ptr< Component > | Clone () const |
Clones the component and all its children. More... | |
const refcount_ptr< Component > | LightClone () const |
Makes a light clone of the component and all its children. More... | |
void | DetectChanges (const refcount_ptr< Component > &oldClone, ostream &changeMessages) const |
Compare an older clone to the current tree, to find changes. More... | |
string | GenerateTreeDump (const string &branchTemplate, bool htmlLinksForClassNames=false, string prefixForComponentUrls="") const |
Generates an ASCII tree dump of a component tree. More... | |
virtual string | GenerateDetails () const |
Generate details about the component. More... | |
void | Reset () |
Resets the state of this component and all its children. More... | |
bool | PreRunCheck (GXemul *gxemul) |
Checks the state of this component and all its children, before starting execution. More... | |
void | FlushCachedState () |
Resets the cached state of this component and all its children. More... | |
virtual RootComponent * | AsRootComponent () |
Returns the component's RootComponent interface. More... | |
void | SetParent (Component *parentComponent) |
Sets the parent component of this component. More... | |
Component * | GetParent () |
Gets this component's parent component, if any. More... | |
const Component * | GetParent () const |
string | GeneratePath () const |
Generates a string representation of the path to the Component. More... | |
string | GenerateShortestPossiblePath () const |
Generates a short string representation of the path to the Component. More... | |
const refcount_ptr< Component > | LookupPath (string path) const |
Looks up a path from this Component, and returns a pointer to the found Component, if any. More... | |
vector< string > | FindPathByPartialMatch (const string &partialPath, bool shortestPossible=false) const |
Finds complete component paths, given a partial path. More... | |
void | AddChild (refcount_ptr< Component > childComponent, size_t insertPosition=(size_t) -1) |
Adds a reference to a child component. More... | |
size_t | RemoveChild (Component *childToRemove) |
Removes a reference to a child component. More... | |
Components & | GetChildren () |
Gets pointers to child components. More... | |
const Components & | GetChildren () const |
Gets pointers to child components, as a const reference. More... | |
void | GetVariableNames (vector< string > &names) const |
Retrieves a component's state variable names. More... | |
StateVariable * | GetVariable (const string &name) |
Gets a pointer to a state variable. More... | |
const StateVariable * | GetVariable (const string &name) const |
Gets a pointer to a state variable. More... | |
bool | SetVariableValue (const string &name, const string &expression) |
Sets a variable to a new value. More... | |
void | Serialize (ostream &ss, SerializationContext &context) const |
Serializes the Component into a string stream. More... | |
bool | CheckConsistency () const |
Checks consistency by serializing and deserializing the component (including all its child components), and comparing the checksum of the original tree with the deserialized tree. More... | |
void | AddChecksum (Checksum &checksum) const |
Adds this component's state, including children, to a checksum. More... | |
![]() | |
ReferenceCountable () | |
Default constructor, which initializes the reference count to zero. More... | |
~ReferenceCountable () | |
![]() | |
AddressDataBus () | |
Constructs an AddressDataBus instance. More... | |
virtual | ~AddressDataBus () |
Static Public Member Functions | |
static refcount_ptr< Component > | Create (const ComponentCreateArgs &args) |
Creates a M88K_CPUComponent. More... | |
static string | GetAttribute (const string &attributeName) |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
![]() | |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
![]() | |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
![]() | |
static string | GetAttribute (const string &attributeName) |
Creates a Component. More... | |
static refcount_ptr< Component > | Deserialize (ostream &messages, const string &str, size_t &pos) |
Deserializes a string into a component tree. More... | |
![]() | |
static void | RunUnitTests (int &nSucceeded, int &nFailures) |
Runs unit test cases. More... | |
Protected Member Functions | |
virtual bool | CheckVariableWrite (StateVariable &var, const string &oldValue) |
Checks whether a write to a variable is OK. More... | |
virtual bool | VirtualToPhysical (uint64_t vaddr, uint64_t &paddr, bool &writable) |
Virtual to physical address translation (MMU). More... | |
virtual int | FunctionTraceArgumentCount () |
virtual int64_t | FunctionTraceArgument (int n) |
virtual bool | FunctionTraceReturnImpl (int64_t &retval) |
virtual int | GetDyntransICshift () const |
virtual DyntransIC_t | GetDyntransToBeTranslated () |
virtual void | ShowRegisters (GXemul *gxemul, const vector< string > &arguments) const |
![]() | |
void | DyntransToBeTranslatedBegin (struct DyntransIC *) |
bool | DyntransReadInstruction (uint16_t &iword, int offset=0) |
bool | DyntransReadInstruction (uint32_t &iword, int offset=0) |
void | DyntransToBeTranslatedDone (struct DyntransIC *) |
void | DyntransResyncPC () |
Calculate m_pc based on m_nextIC and m_firstIConPage. More... | |
void | DyntransPCtoPointers () |
Calculate m_nextIC and m_firstIConPage, based on m_pc. More... | |
DECLARE_DYNTRANS_INSTR (nop) | |
DECLARE_DYNTRANS_INSTR (abort) | |
DECLARE_DYNTRANS_INSTR (endOfPage) | |
DECLARE_DYNTRANS_INSTR (endOfPage2) | |
DECLARE_DYNTRANS_INSTR (branch_samepage) | |
DECLARE_DYNTRANS_INSTR (set_u64_imms32) | |
DECLARE_DYNTRANS_INSTR (mov_u64_u64) | |
DECLARE_DYNTRANS_INSTR (add_u32_u32_immu32) | |
DECLARE_DYNTRANS_INSTR (add_u32_u32_u32) | |
DECLARE_DYNTRANS_INSTR (add_u64_u64_imms32_truncS32) | |
DECLARE_DYNTRANS_INSTR (add_u64_u64_u64_truncS32) | |
DECLARE_DYNTRANS_INSTR (add_u64_u64_imms32) | |
DECLARE_DYNTRANS_INSTR (sub_u32_u32_immu32) | |
DECLARE_DYNTRANS_INSTR (sub_u32_u32_u32) | |
DECLARE_DYNTRANS_INSTR (sub_u64_u64_u64_truncS32) | |
DECLARE_DYNTRANS_INSTR (and_u32_u32_immu32) | |
DECLARE_DYNTRANS_INSTR (and_u64_u64_immu32) | |
DECLARE_DYNTRANS_INSTR (or_u32_u32_immu32) | |
DECLARE_DYNTRANS_INSTR (or_u32_u32_u32) | |
DECLARE_DYNTRANS_INSTR (or_u64_u64_immu32) | |
DECLARE_DYNTRANS_INSTR (xor_u32_u32_immu32) | |
DECLARE_DYNTRANS_INSTR (xor_u32_u32_u32) | |
DECLARE_DYNTRANS_INSTR (xor_u64_u64_immu32) | |
DECLARE_DYNTRANS_INSTR (xor_u64_u64_u64) | |
DECLARE_DYNTRANS_INSTR (shift_left_u64_u64_imm5_truncS32) | |
DECLARE_DYNTRANS_INSTR (shift_right_u64_u64asu32_imm5_truncS32) | |
![]() | |
virtual void | FlushCachedStateForComponent () |
Resets the cached state of this component. More... | |
uint64_t | Unassemble (int nRows, bool indicatePC, uint64_t vaddr, ostream &output) |
virtual string | VirtualAddressAsString (uint64_t vaddr) |
Format a virtual address as a displayable string. More... | |
virtual uint64_t | PCtoInstructionAddress (uint64_t pc) |
Convert PC value to instuction address. More... | |
bool | FunctionTraceCall () |
bool | FunctionTraceReturn () |
![]() | |
Component (const string &className, const string &visibleClassName) | |
Base constructor for a Component. More... | |
template<class T > | |
bool | AddVariable (const string &name, T *variablePointer) |
Adds a state variable of type T to the Component. More... | |
bool | AddCustomVariable (const string &name, CustomStateVariableHandler *variableHandler) |
Adds a custom state variable to the Component. More... | |
GXemul * | GetRunningGXemulInstance () |
Returns a reference to the current GXemul instance. More... | |
UI * | GetUI () |
Gets an UI reference for outputting debug messages during runtime. More... | |
Additional Inherited Members | |
![]() | |
struct DyntransIC * | m_firstIConPage |
struct DyntransIC * | m_nextIC |
int | m_dyntransPageMask |
int | m_dyntransICentriesPerPage |
int | m_dyntransICshift |
int | m_executedCycles |
int | m_nrOfCyclesToExecute |
DyntransTranslationCache | m_translationCache |
struct DyntransIC | m_abortIC |
![]() | |
double | m_frequency |
bool | m_paused |
string | m_cpuArchitecture |
int | m_pageSize |
uint64_t | m_pc |
uint64_t | m_lastDumpAddr |
uint64_t | m_lastUnassembleVaddr |
bool | m_hasUsedUnassemble |
bool | m_isBigEndian |
bool | m_showFunctionTraceCall |
bool | m_showFunctionTraceReturn |
int32_t | m_functionCallTraceDepth |
int64_t | m_nrOfTracedFunctionCalls |
bool | m_inDelaySlot |
uint64_t | m_delaySlotTarget |
AddressDataBus * | m_addressDataBus |
uint64_t | m_addressSelect |
bool | m_exceptionOrAbortInDelaySlot |
A Component representing a Motorola 88000 processor.
The only two implementations there were of the 88K architecture were 88100 and 88110. GXemul only supports 88100 emulation so far.
Definition at line 341 of file M88K_CPUComponent.h.
M88K_CPUComponent::M88K_CPUComponent | ( | ) |
Constructs a M88K_CPUComponent.
Definition at line 60 of file M88K_CPUComponent.cc.
References CPUComponent::m_frequency.
Referenced by Create().
|
protectedvirtual |
Checks whether a write to a variable is OK.
This function is called after the variable has been written. By returning false, the component indicates that the value which was written is invalid, and the write will be undone.
An implementation should first check variables defined for the implementation class, and then call its base class' function.
The implementation in the base Component class handles the variables that are defined for all components, and returns true for anything else.
var | The variable to check. |
oldValue | The serialized previous value. |
Reimplemented from Component.
Definition at line 198 of file M88K_CPUComponent.cc.
References Component::GetUI(), M88K_ZERO_REG, m88k_cpu_type_def::name, and UI::ShowDebugMessage().
|
static |
Creates a M88K_CPUComponent.
Definition at line 110 of file M88K_CPUComponent.cc.
References ComponentFactory::GetCreationArgOverrides(), and M88K_CPUComponent().
|
virtual |
Disassembles an instruction into readable strings.
vaddr | The virtual address of the program counter. |
result | A vector where the implementation will add:
|
Implements CPUComponent.
Definition at line 364 of file M88K_CPUComponent.cc.
References CPUComponent::AddressSelect(), BigEndian, LittleEndian, CPUComponent::m_inDelaySlot, CPUComponent::m_isBigEndian, CPUComponent::m_pc, and CPUComponent::ReadData().
|
inlineprotectedvirtual |
Reimplemented from CPUComponent.
Definition at line 375 of file M88K_CPUComponent.h.
References M88K_FIRST_ARG_REG.
|
inlineprotectedvirtual |
Reimplemented from CPUComponent.
Definition at line 374 of file M88K_CPUComponent.h.
|
inlineprotectedvirtual |
Reimplemented from CPUComponent.
Definition at line 376 of file M88K_CPUComponent.h.
References M88K_RETURN_VALUE_REG.
|
static |
Definition at line 886 of file M88K_CPUComponent.cc.
References Component::GetAttribute().
|
protectedvirtual |
Implements CPUDyntransComponent.
Definition at line 333 of file M88K_CPUComponent.cc.
References M88K_INSTR_ALIGNMENT_SHIFT.
|
protectedvirtual |
Implements CPUDyntransComponent.
Definition at line 340 of file M88K_CPUComponent.cc.
|
virtual |
Checks the state of this component, before starting execution.
Note 1: This function is not recursive, so children should not be traversed.
Note 2: After a component's state variables have been checked, the base class' PreRunCheckForComponent(GXemul*) function should also be called.
The implementation of this function may choose to print warning messages but still return true, or it can print error messages and return false.
Typical examples of pre-run-check failures are:
Reimplemented from CPUComponent.
Definition at line 167 of file M88K_CPUComponent.cc.
References GXemul::GetUI(), M88K_ZERO_REG, CPUComponent::m_pc, N_M88K_REGS, CPUComponent::PreRunCheckForComponent(), and UI::ShowDebugMessage().
|
virtual |
Resets the state variables of this component.
Note 1: This function is not recursive, so children should not be traversed.
Note 2: After a component's state variables have been reset, the base class' ResetState() function should also be called.
The implementation of this function ususally takes the form of a number of assignment of values to member variables, and then the call to the base class' ResetState() function.
Reimplemented from CPUComponent.
Definition at line 136 of file M88K_CPUComponent.cc.
References M88K_CR_PID, M88K_CR_PSR, M88K_PID_MC, M88K_PSR_BO, M88K_PSR_IND, M88K_PSR_MODE, M88K_STACKPOINTER_REG, CPUComponent::m_isBigEndian, CPUComponent::m_pageSize, CPUComponent::m_pc, N_M88K_CONTROL_REGS, N_M88K_FPU_CONTROL_REGS, N_M88K_REGS, m88k_cpu_type_def::pid, and CPUComponent::ResetState().
|
static |
|
protectedvirtual |
Reimplemented from CPUComponent.
Definition at line 241 of file M88K_CPUComponent.cc.
References CPUComponent::GetSymbolRegistry(), SymbolRegistry::LookupAddress(), CPUComponent::m_pc, N_M88K_CONTROL_REGS, and N_M88K_REGS.
|
protectedvirtual |
Virtual to physical address translation (MMU).
This function should be overridden in each CPU implementation.
vaddr | The virtual address to translate. |
paddr | The return value; physical address. |
writable | This is set to true or false by the function, depending on if the memory at the virtual address was writable or not. |
Implements CPUComponent.
Definition at line 346 of file M88K_CPUComponent.cc.