#include <MainbusComponent.h>
Public Member Functions | |
MainbusComponent () | |
Constructs a MainbusComponent. More... | |
virtual | ~MainbusComponent () |
virtual AddressDataBus * | AsAddressDataBus () |
Returns the component's AddressDataBus interface. 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 int | Execute (GXemul *gxemul, int nrOfCycles) |
Execute one or more cycles. More... | |
virtual double | GetCurrentFrequency () const |
Returns the current frequency (in Hz) that the component runs at. More... | |
virtual RootComponent * | AsRootComponent () |
Returns the component's RootComponent interface. More... | |
virtual CPUComponent * | AsCPUComponent () |
Returns the component's CPUComponent 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 |
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... | |
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 MainbusComponent. More... | |
static string | GetAttribute (const string &attributeName) |
Get attribute information about the MainbusComponent class. More... | |
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 void | FlushCachedStateForComponent () |
Resets the cached state of this component. More... | |
virtual bool | PreRunCheckForComponent (GXemul *gxemul) |
Checks the state of this component, before starting execution. More... | |
![]() | |
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... | |
virtual bool | CheckVariableWrite (StateVariable &var, const string &oldValue) |
Checks whether a write to a variable is OK. More... | |
virtual void | ResetState () |
Resets the state variables of this 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... | |
Main bus Component.
An AddressDataBus Component which forwards reads and writes to MemoryMappedComponent components (which also must implement the AddressDataBus interface), e.g. the RAMComponent.
Definition at line 47 of file MainbusComponent.h.
MainbusComponent::MainbusComponent | ( | ) |
Constructs a MainbusComponent.
Definition at line 32 of file MainbusComponent.cc.
Referenced by Create().
|
virtual |
Definition at line 41 of file MainbusComponent.cc.
|
virtual |
Place an address on the bus.
address | The address to select. |
Implements AddressDataBus.
Definition at line 181 of file MainbusComponent.cc.
References AddressDataBus::AddressSelect().
|
virtual |
Returns the component's AddressDataBus interface.
Reimplemented from Component.
Definition at line 175 of file MainbusComponent.cc.
|
static |
Creates a MainbusComponent.
Definition at line 46 of file MainbusComponent.cc.
References MainbusComponent().
|
protectedvirtual |
Resets the cached state 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' FlushCachedStateForComponent() function should also be called.
The implementation of this function ususally takes the form of setting a number of pointers to NULL, and then the call to the base class' FlushCachedStateForComponent() function.
Reimplemented from Component.
Definition at line 64 of file MainbusComponent.cc.
References Component::FlushCachedStateForComponent().
Referenced by PreRunCheckForComponent().
|
static |
Get attribute information about the MainbusComponent class.
attributeName | The attribute name. |
Definition at line 52 of file MainbusComponent.cc.
References Component::GetAttribute().
|
protectedvirtual |
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 Component.
Definition at line 76 of file MainbusComponent.cc.
References FlushCachedStateForComponent(), Component::GenerateShortestPossiblePath(), Component::GenerateTreeDump(), Component::GetChildren(), GXemul::GetUI(), UI::ShowDebugMessage(), and StateVariable::ToInteger().
|
virtual |
Reads 8-bit data from the currently selected address.
data | A reference to a variable which will receive the data. |
endianness | Selects the endianness of the operation. Ignored for 8-bit reads and writes. |
Implements AddressDataBus.
Definition at line 215 of file MainbusComponent.cc.
References AddressDataBus::ReadData().
|
virtual |
Reads 16-bit data from the currently selected address.
data | A reference to a variable which will receive the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 227 of file MainbusComponent.cc.
References AddressDataBus::ReadData().
|
virtual |
Reads 32-bit data from the currently selected address.
data | A reference to a variable which will receive the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 239 of file MainbusComponent.cc.
References AddressDataBus::ReadData().
|
virtual |
Reads 64-bit data from the currently selected address.
data | A reference to a variable which will receive the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 251 of file MainbusComponent.cc.
References AddressDataBus::ReadData().
|
static |
|
virtual |
Writes 8-bit data to the currently selected address.
data | A reference to a variable which contains the data. |
endianness | Selects the endianness of the operation. Ignored for 8-bit reads and writes. |
Implements AddressDataBus.
Definition at line 263 of file MainbusComponent.cc.
References AddressDataBus::WriteData().
|
virtual |
Writes 16-bit data to the currently selected address.
data | A reference to a variable which contains the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 275 of file MainbusComponent.cc.
References AddressDataBus::WriteData().
|
virtual |
Writes 32-bit data to the currently selected address.
data | A reference to a variable which contains the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 287 of file MainbusComponent.cc.
References AddressDataBus::WriteData().
|
virtual |
Writes 64-bit data to the currently selected address.
data | A reference to a variable which contains the data. |
endianness | Selects the endianness of the operation. |
Implements AddressDataBus.
Definition at line 299 of file MainbusComponent.cc.
References Component::AddChild(), AddressDataBus::AddressSelect(), Component::AsAddressDataBus(), UnitTest::Assert(), BigEndian, ComponentFactory::CreateComponent(), data, Component::FlushCachedState(), GXemul::GetCommandInterpreter(), GXemul::GetRootComponent(), ComponentFactory::HasAttribute(), refcount_ptr< T >::IsNULL(), LittleEndian, Component::PreRunCheck(), AddressDataBus::ReadData(), CommandInterpreter::RunCommand(), Component::SetVariableValue(), UNITTEST, UNITTESTS, and AddressDataBus::WriteData().