Skip to content

Modeling a Circuit

Daniel Stanley edited this page Oct 2, 2023 · 3 revisions

This wiki is a quick guide to getting started with Fixture, but if you have further questions you can also consult the examples and adapt them to your needs. If you are still stuck, email the developer at Daniel+fixture@Stanley5.com.

In order to run Fixture for circuit analysis you will need a spice circuit to simulate, a simulator configuration file, and a circuit configuration file. Then, you can run the tool with python.

Installation

See the main readme, here.

spice Circuit to Simulate

Image showing original and modified versions of a spice circuit

Generally, as a user you will already have the circuit you want to simulate. Often, you do not need to make any changes. Here are a few cases where you may want to consider modifying the circuit before running Fixture:

  • Adding a load. Fixture will not add any explicit load to the output of your circuit (unless you specify a capacitive load in the Simulator Configuration File). We encourage users to add a realistic load (possibly the next stage of the circuit) in the spice file directly. If the load may change depending on inputs to a different part of the circuit, those inputs and their effects can also be added to the circuit being modeled.
  • Process variation. If you want to model process variation you can run Fixture multiple times with different spice files corresponding to different corners or Monte Carlo variations. You can also add additional input pins that control variation of specific components (e.g. an input that maps to a voltage-controlled resistor, to emulate a resistor that varies due to process variation).

Additional Instructions for Cadence Virtuoso

If you want to export a circuit from Cadence Virtuoso, you can do that through the GUI menus. First, set up an ADEL window for that schematic (which will probably include an instance of the circuit plus load). This is where you include any global variable values. You MUST also set the model libraries under setup -> model libraries. It’s also best to turn off saved nodes with Results -> save all... -> check “None” for “Select Signals to Save” (Fixture will manually add the necessary saves when calling spectre; you can add more saves here if you plan to manually debug the waveforms, but the psf file size will grow and the python library can’t handle that very well). Then export the netlist with simulation -> netlist -> create. Make a note of the location of the exported netlist; you will need it for the config file (you can also move it somewhere convenient, but then you will have to move it again every time you modify the circuit).

Simulator Configuration File

This file is the place to set up the simulator. It includes some information specific to your circuit, like the voltage level to use for digital inputs, and also information for the simulator executable, such as command-line arguments to include the correct libraries. The full list of possible parameters is found here. The parameters control simulation handled by the fault library, and descriptions for most of those parameters can be found here.

The tests/configs/ folder has many test config files, including some for ngspice, hspice, and spectre.

Circuit Configuration File

This is the file where you guide Fixture to properly exercise your circuit and create a model that will suit your specific needs. There are a lot of options, so the file has its own wiki page here.

Running Fixture

You can run the tool from any directory, and it will create its build folder called checkpoint_folder/ in that directory. It will also create a directory called plots/ in that directory for plots about circuit behavior. Run the tool with:

python -m fixture.run path/to/config.yaml

The tool will output some information to the terminal, including the models it fit. Those models can also be found under checkpoint_folder/TestName/regression_results.yaml, where the TestName depends on which test was run. The plots/ folder is extremely useful for debugging. It creates a lot of different plots, and it is worth taking the time to look around and see which ones are most useful to you.

Clone this wiki locally