Skip to content

Usage guide

Circuits designed in CircuitBrew are written as standard Python classes using the following rules:

Netlisting

  1. Inherit from Module 1.
  2. Every Port must be defined as a class attribute.
  3. Every Module must have a def build(self) method.
  4. Every sub-instance to be emitted as part of your Module must be assigned as an instance attribute on the Module using self.
  5. Every build method needs a self.finalize() statement at the end.

Other than that, you can use bog-standard Python to construct your instances/connectivity.

Modeling

  1. Implement an async def sim(self): method
  2. Recv from the input ports, transform the inputs, and send on the output ports

All of these concepts are covered in-depth in the examples


  1. Inherit from Leaf if you're going to emit raw spice without any sub-modules