6.1 TComponent reference

All components are instances of TComponent. The TComponent class defines the features common to all components and consists of the methods described in this section. Features that are unique to certain kinds of components (such as CPUs or memories), are accessed via another class whose methods handle those features. TComponent provides instances of these classes where appropriate. For instance, the CPU method provides a TCPU object for this component. However, if the component is not a CPU, this method would return a NULL. Note that it is possible for a component to provide a User_Interface object as well as one of the others. The methods specific to certain classes are:


Cable

CPU

Keyboard

Memory

User_Interface



TUEC Initialize( TUI_Interface* )


Reinitializes the component. Note that this is not a constructor! It is not necessary for the application to call this method, since Make_Instance should have initialized the component appropriately. This simply allows the component to be initialized again.



TUEC Terminate()


Terminates the component. Note that this is not a destructor, although it should eventually cause the instance to be destructed. By convention, once this method is called, the instance is no longer valid.



integer Serial_Number()


This method returns the number passed during creation (see Make_Instance).



TUEC Add_Notification( TComponent* Component )


Adds the specified component to the list of components to notify along with Parent in Child_Notifications.



TCable Cable()


Returns the TCable interface for a cable component. If the component is not a cable, this method returns NULL.



TComponent* Child_Component( integer Index )


This method returns the Indexth child component for this component. It returns NULL if Index is outside of the range: 0 <= n < Max_child_component. Child components are components owned by this component (such as a motherboard would own the CPU component).



void Child_Notification( TComponent* Child, longint &Notice, int64 &params )


This is called by a component's child components to notify the parent asynchronously of some change. The usage of the params parameter depends upon the notice code. It is ignored unless otherwise specified. The Notice codes are:

0 = Child is about to terminate. As soon as the call returns, the child component will destruct.

1 = Child is requesting termination. If the Notice parameter is unchanged when the call returns, the child will go ahead and terminate. If Notice is set to 0 on return, the child will not terminate. Typically termination is cancelled when the parent component wishes to terminate the child itself.

2 = Child has received asynchronous data.



TUEC Clear_Watchpoint( int64 Address, boolean Memory, integer Access )


Clears a watchpoint at the specified address. Access is the type of access:

1 = Read or write (input or output)

2 = Read (input)

3 = Write (output)



integer Component_Type()


This method returns a value indicating the type of the component, as follows:

0 = Unknown (TComponent)

1 = CPU

2 = Bus

3 = Memory

4 = Motherboard

5 = I/O device

6 = User Interface

7 = Cable

8 = Keyboard



TUEC Connect_Input( TComponent* Component )


For components which accept input, this connects another component to this component's default input port.



TUEC Connect_Output( TComponent* Component )


For components which generate output, this connnects another component to this component's default output port.



TCPU* CPU()


Returns an instance of a TCPU object for this component. If the component is not a CPU, this method returns NULL. This is a reference to an object managed by this component and should not be freed or destructed by calling code.



TDebug_Interface* Debugger()


Returns a pointer to a debugger interface for this component. If the component doesn't support a debugger interface, this method returns NULL.



TUEC Delete_Notification( TComponent* Component )


This removes the specified component from the list of components to be notified. The component must have been added via Add_Notification.



TUEC Deposit( int64 Address, integer Size, pointer Buffer, boolean Memory )


This method writes Size bits of data from the specified address from the specified buffer. Memory is True if this is a memory write versus a I/O write. This is solely for the UI, and the write does no trigger watchpoints or have any other side-effects other than changing the contents of the component.



TUEC Disconnect_Input( TComponent* Component )


This disconnects the specified component from this component's default input port.



TUEC Disconnect_Output( TComponent* Component )


This disconnects the specified component from this component's default output port.



TUEC Examine( int64 Address, integer &Size, pointer Buffer, boolean Memory )


This method reads Size bits of data from the specified address into the specified buffer. Size is updated with the actual number of bits copied. Memory is True if this is a memory read versus an I/O read. This is solely for the UI - the read triggers no watchpoints and must have no other side-effects. In the case where an actual read would result in a change to a component's state, the examine must not make that change and the returned data should reflect what would be returned if a Read were done. Finally, access modes are ignored since this operation must always succeed if the address is valid.



integer Get_Access_Mode( int64 Address, boolean Memory )


Returns the access mode of the specified address. Return values are:

0 = Not supported (address out of range, etc.)

1 = Read/Write (I/O)

2 = Read-only (input-only)

3 = Write-only (write-only)

Memory is true if address is a memory address and false if it is an I/O address. See Set_Access_Mode for more details.



string Get_Exception_Description( integer Index )


Returns a description of the exception with the given index. If the index is invalid, the function returns NULL.



TComponent* Get_Parent()


Returns the parent component of this component. Returns NULL if there is no parent.



boolean Get_Profiling


Returns True if profiling for this component is on.



integer Get_Read_Latency()


Returns the component's default read latency. If the component doesn't support latency, this should return 0.



boolean Get_Signal( string Name, boolean& state )


Returns the state of a signal with the specified name. If the component recognizes the signal name, it returns True. Otherwise it returns False. If the result is True, state is set to the current state of the signal.



string Get_State_Name( integer index )


Returns the name of the state with the specified index. If the index is invalid, the function returns NULL.



integer Get_Tag()


Returns the component's tag value. See Set_Tag for details.



boolean Get_Trace()


Returns True if the component has tracing turned on.



integer Get_Write_Latency()


Returns the component's default write latency. If the component doesn't support latency, this should return 0.



TComponent* Input_Component( integer Index )


This method returns the Indexth input component for this component. It returns NULL if Index is outside of the range: 0 <= n < Max_input_component



TKeyboard* Keyboard()


Returns the TKeyboard interface for a keyboard component. If the component is not a keyboard, this method returns NULL.



TMemory Memory()


Returns the TMemory interface for a memory component. If the component is not memory, this method returns NULL.



string Name()


This method returns a string containing the name of this component.



TComponent* Output_Component( integer Index )


This method returns the Indexth output component for this component. It returns NULL if Index is outside of the range: 0 <= n < Max_output_component



The following methods are supported in Components conforming to version 2.6, or later, of the specification.



TCEF_Logger* Get_Logger()


Returns the current logger assigned to the component.


void Set_Logger( TCEF_Logger* Value )


Sets the component's logger. Use NULL to remove any existing loggers.



6.1 Loggers