jitx package#

JITX Python API#

The JITX Python API is a set of classes that can be used to build a design in Python. The core principle of the API is that, when run, your code constructs an object tree that is then inspected. This means that creating an object and attaching them to other objects is what drives the construction of the design, and not function calls. The root of the tree is an instance of a Design subclass. The JITX runtime will inspect your project looking for Design subclasses which are then instantiated on request.

The inspection mechanism will traverse lists, tuples, and dictionaries, as well, thus objects can be added to arrays and dictionaries as needed when building the object tree.

The API is designed to be as simple as possible, and to be as close to Python as possible. The API is designed to be used with a Python language server, such as PyLance/pyright, to provide autocompletion and type checking.

Note

There are a few mechanisms designed to make API usage cleaner by allowing instantiated objects as class attributes, but there are caveats to be aware of when doing more involved logic, and when in doubt, all logic can also be placed in the initializer of the class. Runtime errors involving an unexpected “Instantiable” object is indicative of this type of error.

class Current[source]#

Context registry object, where each field is a property that will get the currently registered context value. If no such context is currently active, it will raise an exception. This is purely for convenience, the contexts can be accessed directly.

The main purpose of this is to allow introspection of the environment. Note that any accessed context value will be part of the memoization key, and thus if the environment changes a memoized element will be reevaluated, and thus use of current circuit or component should be used with care.

There is already an instance of this class, current, which can be used directly.

design#

The current design being built

substrate#

The substrate of the current design

circuit#

The current circuit being constructed

component#

The current component being constructed

current = Current#

Singleton, the “current” context registry.

Subpackages#

Submodules#