cbadc.circuit.digital_control.MultiPhaseDigitalControl

class cbadc.circuit.digital_control.MultiPhaseDigitalControl(instance_name: str, analog_system: AnalogSystem, digital_control: DigitalControl, in_high: float, in_low: float, out_high: float, out_low: float, dither_offset: int = 0)[source]

Bases: SubCircuitElement

The default digital control circuit.

Parameters
  • instance_name (str) – The instance name of the digital control circuit.

  • analog_system (AnalogSystem) – The analog system to which this digital control circuit belongs.

  • digital_control (MultiPhaseDigitalControl) – The digital control circuit to which this digital control circuit belongs.

  • in_high (float) – The high input voltage of the comparator.

  • in_low (float) – The low input voltage of the comparator.

  • out_high (float) – The high output voltage of the comparator.

  • out_low (float) – The low output voltage of the comparator.

  • dither_offset (int) – The offset of the dither control circuit.

Methods

__init__(instance_name, analog_system, ...)

add(*elements)

Add elements to the subcircuit

add_terminal(terminal[, index])

Add a terminal to the component

add_terminals(terminals)

Add multiple terminals to the component

check_connections()

Check that all terminals are connected

check_subckt_names()

Check that all subcircuit names are unique

connect(first, second[, name])

Add a connection between two terminals

connect_upstream()

Connect all terminals of the subcircuit to the parent circuit

connects(*connections)

Add connections to the subcircuit

get_ngspice([connections])

Get the ngspice call for the component

get_spectre([connections])

Get the spectre call for the component

get_sub_circuit_definitions([dialect])

Get the spice definition of the subcircuit

get_terminals()

Get the terminals of the component

Attributes

add(*elements: CircuitElement)

Add elements to the subcircuit

Parameters

elements (CircuitElement) – The elements to add

add_terminal(terminal: Terminal, index: int = -1)

Add a terminal to the component

Parameters
  • terminal (Terminal) – The terminal to add

  • index (int, optional) – The index to add the terminal at, by default -1, i.e., at the end

add_terminals(terminals: List[Terminal])

Add multiple terminals to the component

Parameters

terminals (List[Terminal]) – The terminals to add

check_connections()

Check that all terminals are connected

Raises

ValueError – If a terminal of the subckt is not connected

check_subckt_names()

Check that all subcircuit names are unique

Raises

ValueError – If a subcircuit name is not unique

connect(first: Terminal, second: Terminal, name='')

Add a connection between two terminals

Parameters
  • first (Terminal) – First terminal

  • second (Terminal) – Second terminal

  • name (str, optional) – Name of the connection, by default tries to inherit the name of the first named terminal

Notes

  • If the terminals are already connected, the connection is not changed

  • If one of the terminals is already connected, the other terminal is added to the connection

  • If neither of the terminals is connected, a new connection is created

  • If both terminals are connected to different connections, the connections are merged

  • If both terminals are connected to the same connection, the connection is not changed

  • If one of the terminals has a name, the connection is named after the terminal with the name

  • If both terminals have a name, the connection is named after the first terminal

  • If neither of the terminals have a name, the connection is unnamed

connect_upstream()

Connect all terminals of the subcircuit to the parent circuit

Notes

  • If a terminal is already connected, the connection is not changed

  • If a terminal is not connected, a new connection is created

  • If a terminal has a name, the connection is named after the terminal

connects(*connections: Tuple[Terminal, Terminal])

Add connections to the subcircuit

Parameters

args (list[tuple[Terminal, Terminal]]) – The connections to add

get_ngspice(connections: Optional[Dict[Terminal, Port]] = None)

Get the ngspice call for the component

get_spectre(connections: Optional[Dict[Terminal, Port]] = None)

Get the spectre call for the component

get_sub_circuit_definitions(dialect: SpiceDialect = SpiceDialect.ngspice) List[str]

Get the spice definition of the subcircuit

get_terminals() List[Terminal]

Get the terminals of the component