API reference - Class GenericDeviceClass

Notation used in Ruby API documentation

Module: db

Description: A generic device class

Class hierarchy: GenericDeviceClass » DeviceClass

This class allows building generic device classes. Specifically, terminals can be defined by adding terminal definitions. Terminal definitions should not be added dynamically. To create your own device, instantiate the GenericDeviceClass object, set name and description and specify the terminals. Then add this new device class to the Netlist object where it will live and be used to define device instances (Device objects).

In addition, parameters can be defined which correspond to values stored inside the specific device instance (Device object). This class has been added in version 0.26.

Public methods

void_assign(const GenericDeviceClass other)Assigns another object to self
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]new GenericDeviceClass ptr_dupCreates a copy of self
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
voidadd_parameter(DeviceParameterDefinition ptr parameter_def)Adds the given parameter definition to the device class
voidadd_terminal(DeviceTerminalDefinition ptr terminal_def)Adds the given terminal definition to the device class
voidclear_parametersClears the list of parameters
voidclear_terminalsClears the list of terminals
[virtual,const]boolcombine_devices(Device ptr a,
Device ptr b)
Combines two devices.
voidequivalent_terminal_id(unsigned long original_id,
unsigned long equivalent_id)
Specifies a terminal to be equivalent to another.
voidsupports_parallel_combination=(bool f)Specifies whether the device supports parallel device combination.
voidsupports_serial_combination=(bool f)Specifies whether the device supports serial device combination.

Detailed description

_assign

Signature: void _assign (const GenericDeviceClass other)

Description: Assigns another object to self

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_dup

Signature: [const] new GenericDeviceClass ptr _dup

Description: Creates a copy of self

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

add_parameter

Signature: void add_parameter (DeviceParameterDefinition ptr parameter_def)

Description: Adds the given parameter definition to the device class

This method will define a new parameter. The new parameter is added at the end of existing parameters. The parameter definition object passed as the argument is modified to contain the new ID of the parameter. The parameter is copied into the device class. Modifying the parameter object later does not have the effect of changing the parameter definition.

add_terminal

Signature: void add_terminal (DeviceTerminalDefinition ptr terminal_def)

Description: Adds the given terminal definition to the device class

This method will define a new terminal. The new terminal is added at the end of existing terminals. The terminal definition object passed as the argument is modified to contain the new ID of the terminal.

The terminal is copied into the device class. Modifying the terminal object later does not have the effect of changing the terminal definition.

clear_parameters

Signature: void clear_parameters

Description: Clears the list of parameters

clear_terminals

Signature: void clear_terminals

Description: Clears the list of terminals

combine_devices

Signature: [virtual,const] bool combine_devices (Device ptr a, Device ptr b)

Description: Combines two devices.

This method shall test, whether the two devices can be combined. Both devices are guaranteed to share the same device class (self). If they cannot be combined, this method shall do nothing and return false. If they can be combined, this method shall reconnect the nets of the first device and entirely disconnect the nets of the second device. It shall combine the parameters of both devices into the first. The second device will be deleted afterwards.

equivalent_terminal_id

Signature: void equivalent_terminal_id (unsigned long original_id, unsigned long equivalent_id)

Description: Specifies a terminal to be equivalent to another.

Use this method to specify two terminals to be exchangeable. For example to make S and D of a MOS transistor equivalent, call this method with S and D terminal IDs. In netlist matching, S will be translated to D and thus made equivalent to D.

Note that terminal equivalence is not effective if the device class operates in strict mode (see DeviceClass#strict=).

supports_parallel_combination=

Signature: void supports_parallel_combination= (bool f)

Description: Specifies whether the device supports parallel device combination.

Parallel device combination means that all terminals of two combination candidates are connected to the same nets. If the device does not support this combination mode, this predicate can be set to false. This will make the device extractor skip the combination test in parallel mode and improve performance somewhat.

Python specific notes:
The object exposes a writable attribute 'supports_parallel_combination'. This is the setter.

supports_serial_combination=

Signature: void supports_serial_combination= (bool f)

Description: Specifies whether the device supports serial device combination.

Serial device combination means that the devices are connected by internal nodes. If the device does not support this combination mode, this predicate can be set to false. This will make the device extractor skip the combination test in serial mode and improve performance somewhat.

Python specific notes:
The object exposes a writable attribute 'supports_serial_combination'. This is the setter.