A Component is a node in the configuration tree that makes up an emulation setup. More...
#include <Component.h>
Public Member Functions | |
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... | |
virtual AddressDataBus * | AsAddressDataBus () |
Returns the component's AddressDataBus interface, if any. 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 () | |
Static Public Member Functions | |
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... | |
Protected Member Functions | |
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... | |
virtual bool | PreRunCheckForComponent (GXemul *gxemul) |
Checks the state of this component, before starting execution. More... | |
virtual void | FlushCachedStateForComponent () |
Resets the cached state 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... | |
A Component is a node in the configuration tree that makes up an emulation setup.
The Component is the core concept in GXemul. All devices, CPUs, networks, and so on are components.
Definition at line 62 of file Component.h.
|
protected |
Base constructor for a Component.
See also: the Create() function.
className | The name of the component class. It should be a short, descriptive name. For e.g. a PCI bus class, it can be "pcibus". For a MIPS CPU, it can be "mips_cpu". |
visibleClassName | The visible name of the component class. It should be a short, descriptive name. For e.g. a PCI bus class, it can be "pcibus". For a MIPS CPU, it can be "cpu". |
Definition at line 42 of file Component.cc.
References AddVariable(), and Component().
Referenced by Component().
|
inlinevirtual |
Definition at line 83 of file Component.h.
References ComponentCreateArgs::gxemul.
void Component::AddChecksum | ( | Checksum & | checksum | ) | const |
Adds this component's state, including children, to a checksum.
checksum | The checksum to add to. |
Definition at line 1253 of file Component.cc.
References Checksum::Add(), and Serialize().
Referenced by CheckConsistency(), and DummyComponent::GetAttribute().
void Component::AddChild | ( | refcount_ptr< Component > | childComponent, |
size_t | insertPosition = (size_t) -1 |
||
) |
Adds a reference to a child component.
childComponent | A reference counted pointer to the child component to add. |
insertPosition | If specified, this is the position in the vector of child components where the child will be inserted. If not specified (or -1), then the child will be added to the end of the vector. |
Definition at line 595 of file Component.cc.
References GetParent(), GetVariable(), GetVisibleClassName(), SetParent(), SetVariableValue(), and StateVariable::ToString().
Referenced by Clone(), TestMIPSMachine::Create(), TestM88KMachine::Create(), SGI_IP32_Machine::Create(), CycloneVHMachine::Create(), SGI_IP30_Machine::Create(), HP700RXMachine::Create(), MVME187Machine::Create(), DummyComponent::GetAttribute(), GXemul::IsTemplateMachine(), and MainbusComponent::WriteData().
|
inlineprotected |
Adds a custom state variable to the Component.
This function is only meant to be called from the component's constructor.
name | The variable name. |
variableHandler | A pointer to the handler that knows how to serialize/deserialize the variable. |
Definition at line 586 of file Component.h.
Referenced by RAMComponent::RAMComponent().
|
inlineprotected |
Adds a state variable of type T to the Component.
This function is only meant to be called from the component's constructor.
name | The variable name. |
variablePointer | A pointer to the variable that the name should be connected to. |
Definition at line 563 of file Component.h.
Referenced by CacheComponent::CacheComponent(), Component(), CPUComponent::CPUComponent(), DummyComponent::GetAttribute(), I960_CPUComponent::I960_CPUComponent(), M88K_CPUComponent::M88K_CPUComponent(), MemoryMappedComponent::MemoryMappedComponent(), MIPS_CPUComponent::MIPS_CPUComponent(), RAMComponent::RAMComponent(), and RootComponent::RootComponent().
|
virtual |
Returns the component's AddressDataBus interface, if any.
Reimplemented in RAMComponent, CacheComponent, CPUComponent, and MainbusComponent.
Definition at line 367 of file Component.cc.
Referenced by DYNTRANS_INSTR(), FileLoader::Load(), FileLoader_aout::LoadIntoComponent(), FileLoader_bout::LoadIntoComponent(), FileLoader_raw::LoadIntoComponent(), FileLoader_ELF::LoadIntoComponent(), CPUComponent::PreRunCheckForComponent(), MainbusComponent::WriteData(), CacheComponent::WriteData(), and RAMComponent::WriteData().
|
virtual |
Returns the component's CPUComponent interface.
Reimplemented in CPUComponent.
Definition at line 360 of file Component.cc.
Referenced by DYNTRANS_INSTR().
|
virtual |
Returns the component's RootComponent interface.
Reimplemented in RootComponent.
Definition at line 353 of file Component.cc.
Referenced by GetRunningGXemulInstance(), and GXemul::SetRootComponent().
bool Component::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.
Definition at line 1226 of file Component.cc.
References AddChecksum(), Deserialize(), refcount_ptr< T >::IsNULL(), and Serialize().
Referenced by DummyComponent::GetAttribute(), and RAMComponent::WriteData().
|
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 in M88K_CPUComponent, MIPS_CPUComponent, I960_CPUComponent, and RootComponent.
Definition at line 969 of file Component.cc.
References StateVariable::GetName(), GetParent(), GetRunningGXemulInstance(), GXemul::GetSnapshottingEnabled(), GetUI(), GXemul::ModifyStep(), StringHelper::ParseNumber(), UI::ShowDebugMessage(), and StateVariable::ToInteger().
Referenced by RootComponent::CheckVariableWrite(), I960_CPUComponent::CheckVariableWrite(), MIPS_CPUComponent::CheckVariableWrite(), M88K_CPUComponent::CheckVariableWrite(), and SetVariableValue().
refcount_ptr< Component > Component::Clone | ( | ) | const |
Clones the component and all its children.
The new copy is a complete copy; modifying either the copy or the original will not affect the other.
Definition at line 76 of file Component.cc.
References AddChild(), Clone(), ComponentFactory::CreateComponent(), StateVariable::Custom, GetClassName(), StateVariable::GetType(), and refcount_ptr< T >::IsNULL().
Referenced by Clone(), ComponentFactory::GetAllComponentNames(), DummyComponent::GetAttribute(), GXemul::ModifyStep(), and RAMComponent::WriteData().
|
static |
Deserializes a string into a component tree.
messages | A stream where errors/warnings may be reported. |
str | The string to deserialize. |
pos | Initial deserialization position in the string; should be 0 when invoked manually. (Used for recursion, to avoid copying.) |
Definition at line 1130 of file Component.cc.
Referenced by CheckConsistency(), and RAMComponent::WriteData().
void Component::DetectChanges | ( | const refcount_ptr< Component > & | oldClone, |
ostream & | changeMessages | ||
) | const |
Compare an older clone to the current tree, to find changes.
Any changes found are written as messages to changeMessages. Typical use of this function is to input a "light clone" which is taken before running a single execution step, to find out any side effects of that execution step.
oldClone | The original component tree to compare to. |
changeMessages | An output stream where to send messages. |
Definition at line 198 of file Component.cc.
References GenerateShortestPossiblePath(), GetChildren(), GetClassName(), GetVariable(), and StateVariable::ToString().
Referenced by BackwardStepCommand::Execute().
|
virtual |
Execute one or more cycles.
Note 1: A component must attempt to execute exactly the number of specified cycles.
Note 2: If e.g. a breakpoint is reached, or some fatal error occurs (such as an unimplemented feature in the emulation of the component is triggered), then it is ok to return fewer than the requested number of cycles. Execution will then stop (or the breakpoint will be handled, etc).
Note 3: The framework will only call this function if the component has a StateVariable named "frequency". Components that do not have any frequency do not execute anything periodically by themselves.
gxemul | A pointer to the GXemul instance. |
nrOfCycles | The requested number of cycles to run. |
Reimplemented in CPUDyntransComponent.
Definition at line 333 of file Component.cc.
Referenced by DummyComponent::GetAttribute().
|
virtual |
Executes a method on the component.
Note 1: The method name must be one of those returned by GetMethodNames(vector<string>&), either in the class itself or by one of the base implementations.
Note 2: The base class' member function should only be called if this class does not handle the method.
gxemul | A reference to the GXemul instance. |
methodName | The name of the method. |
arguments | A vector of arguments to the method. |
Reimplemented in RAMComponent, CacheComponent, and CPUComponent.
Definition at line 406 of file Component.cc.
Referenced by CPUComponent::ExecuteMethod(), CacheComponent::ExecuteMethod(), and RAMComponent::ExecuteMethod().
vector< string > Component::FindPathByPartialMatch | ( | const string & | partialPath, |
bool | shortestPossible = false |
||
) | const |
Finds complete component paths, given a partial path.
E.g. if the following components are available:
root.machine0.isabus0 root.machine1.pcibus0 root.machine1.pcibus1 root.machine2.pcibus0 root.machine3.otherpci
then a search for "pci" would return
root.machine1.pcibus0 root.machine1.pcibus1 root.machine2.pcibus0
(note: not otherpci)
A search for machine1 would return
root.machine1
Multiple words separated by "." should also be possible, so "machine2.pcibus" will find "root.machine2.pcibus0", but "machine.pcibus" will not match anything.
Searching for an empty string ("") returns a vector of all component paths.
partialPath | The partial path to complete. |
shortestPossible | Return shortest possible paths, instead of full paths. |
Definition at line 912 of file Component.cc.
Referenced by DummyComponent::GetAttribute().
void Component::FlushCachedState | ( | ) |
Resets the cached state of this component and all its children.
For performance reasons, while an emulation is running, it is usually a good idea to cache e.g. pointers to various things. However, after pausing an emulation, and continuing again, these pointers may not be valid. FlushCachedState() should be called before Run() is called.
Definition at line 317 of file Component.cc.
References FlushCachedStateForComponent().
Referenced by ConsoleUI::MainLoop(), and MainbusComponent::WriteData().
|
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 in CPUComponent, and MainbusComponent.
Definition at line 327 of file Component.cc.
Referenced by FlushCachedState(), MainbusComponent::FlushCachedStateForComponent(), and CPUComponent::FlushCachedStateForComponent().
|
virtual |
Generate details about the component.
Reimplemented in CacheComponent, and MemoryMappedComponent.
Definition at line 417 of file Component.cc.
References GetCurrentFrequency(), GetVariable(), StateVariable::ToInteger(), and StateVariable::ToString().
Referenced by MemoryMappedComponent::GenerateDetails(), CacheComponent::GenerateDetails(), and GenerateTreeDump().
string Component::GeneratePath | ( | ) | const |
Generates a string representation of the path to the Component.
The path consists of "name.name...name.name" where the last name is the name of this component, and the preceding names are names of parents.
If a component does not have a "name" state variable, then the class name in parentheses is used instead (which may make the path non-unique).
Definition at line 686 of file Component.cc.
References GeneratePath(), GetClassName(), GetVariable(), and StateVariable::ToString().
Referenced by GeneratePath(), GenerateShortestPossiblePath(), and DummyComponent::GetAttribute().
string Component::GenerateShortestPossiblePath | ( | ) | const |
Generates a short string representation of the path to the Component.
This function generates a string which is the shortest possible sub-path required to uniqely identify a component in the tree. (Actually, not really the shortest. For example if a component is called root.machine0.mainbus0.ram0, then the shortest string may be "ra". This function will return "ram0".)
If there are components a.b.x, a.b.y, and a.c.x, then the shortest possible paths for the three components are "b.x", "y", and "c.x" respectively.
Definition at line 721 of file Component.cc.
References GeneratePath(), and GetParent().
Referenced by DetectChanges(), DummyComponent::GetAttribute(), FileLoader::Load(), MainbusComponent::PreRunCheckForComponent(), CPUComponent::PreRunCheckForComponent(), and ConsoleUI::ShowDebugMessage().
string Component::GenerateTreeDump | ( | const string & | branchTemplate, |
bool | htmlLinksForClassNames = false , |
||
string | prefixForComponentUrls = "" |
||
) | const |
Generates an ASCII tree dump of a component tree.
branchTemplate | Used for recursion. Start with an empty string (""). |
htmlLinksForClassNames | Used to generate HTML links by 'make documentation'. |
prefixForComponentUrls | Placed before component/xyz.html in html links to components. |
Definition at line 459 of file Component.cc.
References GenerateDetails(), GetChildren(), GetClassName(), GetVariable(), and StateVariable::ToString().
Referenced by GXemul::DumpMachineAsHTML(), GXemul::GenerateHTMLListOfComponents(), MainbusComponent::PreRunCheckForComponent(), and GXemul::Run().
|
static |
Creates a Component.
The reason for having this helper, instead of simply calling the constructor of a specific Component, is to make templates work in a reasonable and straight-forward manner. (Note: This concept of templates is unrelated to the C++ concept of templates. It just happens to be the same word.)
E.g. DummyComponent::Create() returns a new DummyComponent, but TestMIPSMachine::Create() returns a new MachineComponent (with some pre-defined child components), not a TestMIPS component. Get attribute information about a Component.
attributeName | The attribute name. |
Definition at line 66 of file Component.cc.
Referenced by DummyComponent::GetAttribute(), MainbusComponent::GetAttribute(), MachineComponent::GetAttribute(), I960_CPUComponent::GetAttribute(), CacheComponent::GetAttribute(), RAMComponent::GetAttribute(), MIPS_CPUComponent::GetAttribute(), and M88K_CPUComponent::GetAttribute().
Components & Component::GetChildren | ( | ) |
Gets pointers to child components.
Definition at line 674 of file Component.cc.
Referenced by DetectChanges(), GXemul::DumpMachineAsHTML(), GXemul::GenerateHTMLListOfComponents(), GenerateTreeDump(), ComponentFactory::GetAllComponentNames(), DummyComponent::GetAttribute(), CopyComponentCommand::GetLongDescription(), MoveComponentCommand::GetLongDescription(), MainbusComponent::PreRunCheckForComponent(), CPUComponent::PreRunCheckForComponent(), and GXemul::Run().
const Components & Component::GetChildren | ( | ) | const |
Gets pointers to child components, as a const reference.
Definition at line 680 of file Component.cc.
string Component::GetClassName | ( | ) | const |
Gets the class name of the component.
Definition at line 54 of file Component.cc.
Referenced by Clone(), DetectChanges(), GeneratePath(), GenerateTreeDump(), ComponentFactory::GetAllComponentNames(), and DummyComponent::GetAttribute().
|
virtual |
Returns the current frequency (in Hz) that the component runs at.
Reimplemented in CPUComponent.
Definition at line 343 of file Component.cc.
Referenced by GenerateDetails().
|
virtual |
Retrieves a component's implemented method names.
Note that a component's implementation should call its base class' GetMethodNames(vector<string>&) too. However, when methods are executed, the most specific implementation (i.e. not the base class) will get a chance first to execute the method.
names | A vector of strings, where method names should be added. |
Reimplemented in RAMComponent, CacheComponent, and CPUComponent.
Definition at line 393 of file Component.cc.
Referenced by CommandInterpreter::GetHistoryLine(), CPUComponent::GetMethodNames(), CacheComponent::GetMethodNames(), and RAMComponent::GetMethodNames().
Component * Component::GetParent | ( | ) |
Gets this component's parent component, if any.
Note: Not reference counted.
Returns NULL if there is no parent component.
Definition at line 381 of file Component.cc.
Referenced by AddChild(), CheckVariableWrite(), GenerateShortestPossiblePath(), DummyComponent::GetAttribute(), GetRunningGXemulInstance(), and CPUComponent::PreRunCheckForComponent().
const Component * Component::GetParent | ( | ) | const |
Definition at line 387 of file Component.cc.
|
protected |
Returns a reference to the current GXemul instance.
Definition at line 569 of file Component.cc.
References AsRootComponent(), RootComponent::GetOwner(), and GetParent().
Referenced by CheckVariableWrite(), CPUDyntransComponent::DyntransToBeTranslatedDone(), CPUComponent::FunctionTraceCall(), CPUComponent::FunctionTraceReturn(), and GetUI().
|
protected |
Gets an UI reference for outputting debug messages during runtime.
Definition at line 583 of file Component.cc.
References GetRunningGXemulInstance(), and GXemul::GetUI().
Referenced by RootComponent::CheckVariableWrite(), MIPS_CPUComponent::CheckVariableWrite(), M88K_CPUComponent::CheckVariableWrite(), CheckVariableWrite(), DYNTRANS_INSTR(), CPUDyntransComponent::DyntransReadInstruction(), CPUDyntransComponent::DyntransToBeTranslatedDone(), CPUComponent::FunctionTraceCall(), CPUComponent::FunctionTraceReturn(), M88K_CPUComponent::GetAttribute(), and SetVariableValue().
StateVariable * Component::GetVariable | ( | const string & | name | ) |
Gets a pointer to a state variable.
NOTE: The returned pointer should be used immediately after the call. It will in general not be valid after e.g. an AddVariable call.
name | The variable name. |
Definition at line 949 of file Component.cc.
Referenced by AddChild(), RootComponent::CheckVariableWrite(), DetectChanges(), DYNTRANS_INSTR(), BackwardStepCommand::Execute(), MemoryMappedComponent::GenerateDetails(), GenerateDetails(), GeneratePath(), GenerateTreeDump(), DummyComponent::GetAttribute(), CopyComponentCommand::GetLongDescription(), GXemul::GetStep(), FileLoader_bout::LoadIntoComponent(), and FileLoader_aout::LoadIntoComponent().
const StateVariable * Component::GetVariable | ( | const string & | name | ) | const |
Gets a pointer to a state variable.
NOTE: The returned pointer should be used immediately after the call. It will in general not be valid after e.g. an AddVariable call.
name | The variable name. |
Definition at line 959 of file Component.cc.
void Component::GetVariableNames | ( | vector< string > & | names | ) | const |
Retrieves a component's state variable names.
names | A vector of strings, where method names should be added. |
Definition at line 941 of file Component.cc.
Referenced by CommandInterpreter::GetHistoryLine().
string Component::GetVisibleClassName | ( | ) | const |
Gets the visible class name of the component.
Definition at line 60 of file Component.cc.
Referenced by AddChild().
const refcount_ptr< Component > Component::LightClone | ( | ) | const |
Makes a light clone of the component and all its children.
Modifying the original component will not affect the component returned by this function.
The new copy is not a complete copy. Expensive data structures are not copied, only "light" data structures. For example, RAM memory cell contents is not cloned.
The main purpose of this function is to allow e.g. a single stepper to take a light clone, run one step, and the compare the current component tree with the light clone, to see what was modified in the step.
Definition at line 192 of file Component.cc.
Referenced by BackwardStepCommand::Execute().
const refcount_ptr< Component > Component::LookupPath | ( | string | path | ) | const |
Looks up a path from this Component, and returns a pointer to the found Component, if any.
The first name in the path should match the name of this component. If so, this function moves on to the next part of the path (if there are more parts) and looks up a child with that name, and so on.
Alternatively, the path may be a partial match.
path | The path to the component, consisting of names with "." (period) between names. |
Definition at line 778 of file Component.cc.
Referenced by DYNTRANS_INSTR(), DummyComponent::GetAttribute(), BackwardStepCommand::GetLongDescription(), and FileLoader::Load().
|
virtual |
Returns whether a method name may be re-executed without args.
Typical examples may be a RAMComponent which has a "dump" method, or a CPUComponent which has "dump" and "unassemble" methods.
Note that a component's implementation should call its base class' MethodMayBeReexecutedWithoutArgs(cosnt string&) too.
methodName | The name of the method. |
Reimplemented in RAMComponent, CacheComponent, and CPUComponent.
Definition at line 399 of file Component.cc.
Referenced by DummyComponent::GetAttribute(), CPUComponent::MethodMayBeReexecutedWithoutArgs(), CacheComponent::MethodMayBeReexecutedWithoutArgs(), RAMComponent::MethodMayBeReexecutedWithoutArgs(), CPUComponent::WriteData(), and RAMComponent::WriteData().
bool Component::PreRunCheck | ( | GXemul * | gxemul | ) |
Checks the state of this component and all its children, before starting execution.
Definition at line 298 of file Component.cc.
References PreRunCheckForComponent().
Referenced by RootComponent::CheckVariableWrite(), ConsoleUI::MainLoop(), MainbusComponent::WriteData(), and CPUComponent::WriteData().
|
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 in M88K_CPUComponent, MIPS_CPUComponent, CPUComponent, MainbusComponent, I960_CPUComponent, and RootComponent.
Definition at line 310 of file Component.cc.
Referenced by PreRunCheck().
size_t Component::RemoveChild | ( | Component * | childToRemove | ) |
Removes a reference to a child component.
childToRemove | A pointer to the child to remove. |
Definition at line 655 of file Component.cc.
References SetParent().
Referenced by DummyComponent::GetAttribute().
void Component::Reset | ( | ) |
Resets the state of this component and all its children.
Definition at line 281 of file Component.cc.
References ResetState().
Referenced by DYNTRANS_INSTR(), GXemul::Reset(), and RAMComponent::WriteData().
|
protectedvirtual |
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 in M88K_CPUComponent, MIPS_CPUComponent, RAMComponent, I960_CPUComponent, CacheComponent, and CPUComponent.
Definition at line 291 of file Component.cc.
Referenced by DummyComponent::GetAttribute(), Reset(), and CPUComponent::ResetState().
void Component::Serialize | ( | ostream & | ss, |
SerializationContext & | context | ||
) | const |
Serializes the Component into a string stream.
ss | An ostream which the Component will be serialized to. |
context | A serialization context (used for TAB indentation). |
Definition at line 1070 of file Component.cc.
References SerializationContext::Indented(), and SerializationContext::Tabs().
Referenced by AddChecksum(), CheckConsistency(), and RAMComponent::WriteData().
void Component::SetParent | ( | Component * | parentComponent | ) |
Sets the parent component of this component.
Note: Not reference counted.
parentComponent | a pointer to the parent component. |
Definition at line 375 of file Component.cc.
Referenced by AddChild(), DummyComponent::GetAttribute(), and RemoveChild().
bool Component::SetVariableValue | ( | const string & | name, |
const string & | expression | ||
) |
Sets a variable to a new value.
name | The variable name. |
expression | The new value. |
Definition at line 1030 of file Component.cc.
References CheckVariableWrite(), GetUI(), StateVariable::SerializeValue(), StateVariable::SetValue(), and UI::ShowDebugMessage().
Referenced by AddChild(), TestMIPSMachine::Create(), SGI_IP30_Machine::Create(), SGI_IP32_Machine::Create(), TestM88KMachine::Create(), CycloneVHMachine::Create(), MVME187Machine::Create(), HP700RXMachine::Create(), I960_CPUComponent::Create(), MIPS_CPUComponent::Create(), M88K_CPUComponent::Create(), DYNTRANS_INSTR(), BackwardStepCommand::Execute(), DummyComponent::GetAttribute(), FileLoader::Load(), FileLoader_raw::LoadIntoComponent(), RootComponent::RootComponent(), MainbusComponent::WriteData(), and RAMComponent::WriteData().