cbadc.circuit.testbench.OpAmpTestBench

class cbadc.circuit.testbench.OpAmpTestBench(analog_frontend: AnalogFrontend, input_signals: List[Sinusoidal], clock: Clock, GBWP: float, DC_gain: float, vdd_voltage: float, C_int: float = 1e-14, C_amp: float = 1e-14, title='CBADC OpAmpTestbench', control_signal_vector_name='control_signals.out', verilog_ams_library_name='verilog_ams_library.vams')[source]

Bases: TestBench

The OpAmpTestBench class is a testbench for the OpAmp class.

Parameters
  • analog_frontend (AnalogFrontend) – The analog frontend state space model.

  • input_signals (List[Sinusoidal]) – The input signals to the analog frontend.

  • clock (Clock) – The clock signal.

  • GBWP (float) – the gain-bandwdith product of the opamp.

  • DC_gain (float) – the DC gain of the opamp.

  • vdd_voltage (float) – the supply voltage of the opamp. Vss is assumed to be 0.

  • C_int (float, optional) – the internal integration capacitance of the opamp, by default 1e-14

  • C_amp (float, optional) – the first order pole capacitance of the opamp, by default 1e-14

  • title (str, optional) – the title of the testbench, by default “CBADC OpAmpTestbench”

  • control_signal_vector_name (str, optional) – the name of the control signal vector, by default ‘control_signals.out’

  • verilog_ams_library_name (str, optional) – the name of the verilog ams library, by default ‘verilog_ams_library.vams’

Methods

__init__(analog_frontend, input_signals, ...)

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([check])

returns the ngspice testbench as a string

get_spectre()

return the spectre testbench as a string

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(check=True) str

returns the ngspice testbench as a string

get_spectre() Tuple[str, str]

return the spectre testbench as a string

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