Skip to Content
Maestro Docs
Coding and HDL

SPICE

Describe a circuit as a netlist and have it simulated with ngspice.

In a SPICE question you describe an analogue circuit as a netlist: a list of components and the nodes they connect. Maestro simulates it with ngspice and checks the numbers it prints.

What you write and what you are given

  • You write: the components only, in main.cir. Use node names such as in, out and 0 (ground), as the question states.
  • You are given: a read-only testbench file (tb.cir) in the Testbench tab. It includes your circuit, adds the source, runs the analysis and prints the result.

A small example

For a low-pass RC filter question, your file might contain only:

R1 in out 1k
C1 out 0 159n

The testbench then applies a signal at a given frequency and prints the gain, for example GAIN -3.0103 (in dB).

How it is graded

The printed numbers are compared with the expected numbers. SPICE questions use a tolerance, usually a small percentage, so tiny rounding differences are fine. Every number must still be present on the right line.

Errors

ngspice warnings and errors appear as Runtime error. A common cause is a node that doesn't connect to anything, or a component value with a wrong unit. Remember m means milli and meg means mega.

Cases

A question can run several test cases. Each case sets a different parameter, for example the frequency, and the testbench uses it.