cbadc.circuit.digital_control.DitherControl

class cbadc.circuit.digital_control.DitherControl(instance_name: str, analog_system: AnalogSystem, digital_control: DitherControl, in_high: float, in_low: float, out_high: float, out_low: float, clk_delay: float = 0.0, t_rise: float = 1e-15, t_fall: float = 1e-15, rise_delay: float = 1e-15, fall_delay: float = 1e-15, set_delay: float = 1e-15, reset_delay: float = 1e-15, input_load: float = 1e-15)[source]

Bases: SubCircuitElement

The DitherControl class is a subcircuit element that implements a dither control.

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

  • analog_system (AnalogSystem) – The analog system.

  • digital_control (NominalDigitalControl) – The digital control.

  • in_high (float) – The high input voltage.

  • in_low (float) – The low input voltage.

  • out_high (float) – The high output voltage.

  • out_low (float) – The low output voltage.

  • clk_delay (float, optional) – The clock delay, by default 0.0

  • t_rise (float, optional) – The rise time, by default 1e-15

  • t_fall (float, optional) – The fall time, by default 1e-15

  • rise_delay (float, optional) – The rise delay, by default 1e-15

  • fall_delay (float, optional) – The fall delay, by default 1e-15

  • set_delay (float, optional) – The set delay, by default 1e-15

  • reset_delay (float, optional) – The reset delay, by default 1e-15

  • input_load (float, optional) – The input load, by default 1e-15

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

out_low

out_high

out_undef

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