piel.tools.hdl21
================

.. py:module:: piel.tools.hdl21


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/piel/tools/hdl21/circuit/index
   /autoapi/piel/tools/hdl21/simulator/index
   /autoapi/piel/tools/hdl21/units/index


Functions
---------

.. autoapisummary::

   piel.tools.hdl21.configure_ngspice_simulation
   piel.tools.hdl21.configure_operating_point_simulation
   piel.tools.hdl21.configure_transient_simulation
   piel.tools.hdl21.run_simulation
   piel.tools.hdl21.convert_numeric_to_prefix


Package Contents
----------------

.. py:function:: configure_ngspice_simulation(run_directory: piel.types.PathTypes = '.')

   Configures the NGSPICE simulation for the circuit and returns a simulation options class.

   :param run_directory: Directory where the simulation will be run.
   :type run_directory: PathTypes

   :returns: Configured NGSPICE simulation options.
   :rtype: vsp.SimOptions


.. py:function:: configure_operating_point_simulation(testbench: piel.types.AnalogueModule, **kwargs)

.. py:function:: configure_transient_simulation(testbench: piel.types.AnalogueModule, stop_time_s: float, step_time_s: float, **kwargs)

.. py:function:: run_simulation(simulation: Any, simulator_name: Literal['ngspice'] = 'ngspice', simulation_options: Any = None, to_csv: bool = True)

   Runs the simulation for the circuit and returns the results.

   :param simulation: HDL21 simulation class.
   :type simulation: h.sim.Sim
   :param simulator_name: Name of the simulator to use.
   :type simulator_name: Literal["ngspice"]
   :param simulation_options: Options for the simulation. Defaults to None.
   :type simulation_options: Optional[vsp.SimOptions]
   :param to_csv: Whether to save the results to a CSV file. Defaults to True.
   :type to_csv: bool

   :returns: Results of the simulation.
   :rtype: hs.SimResult


.. py:function:: convert_numeric_to_prefix(value: float)

   This function converts a numeric value to a number under a SPICE unit closest to the base prefix. This allows us
   to connect a particular number real output, into a term that can be used in a SPICE netlist.


