PyRTL provides a collection of classes for Pythonic register-transfer level design, simulation, tracing, and testing suitable for teaching and research. Simplicity, usability, clarity, and extensibility rather than performance or optimization is the overarching goal. Features include:
.vcd
as
projects scaleWhat README would be complete without a screenshot? Below you can see the waveform rendered right on the terminal for a small state machine written in PyRTL.
examples/
directory. You can also try the examples
on
MyBinder.If you are just getting started with PyRTL it is suggested that you start with
the examples/
first to get a sense of the "thinking with PyRTLs" required to
design hardware in this way. If you are looking for a deeper understanding,
dive into the code for the object Block
. It is the core data structure at the
heart of PyRTL and defines its semantics at a high level -- everything is
converted to or from the small, simple set of primitives defined there.
The package contains the following files and directories:
pyrtl/
The src directory for the modulepyrtl/rtllib/
Finished PyRTL libraries which are hopefully both useful
and documentedexamples/
A set of hardware design examples that show the main idea
behind pyrtltests/
A set of unit tests for PyRTL which you can run with pytest
docs/
Location of the sphinx documentationTesting requires the Python packages tox
and pytest
. Once installed a
complete test of the system should be possible with the simple command tox
and nothing more.
Picking a first project
PyrtlError
that is not covered and add a unit test in
tests/
that will hit it.Coding style
Workflow
development
branch is the primary stable working branch (everyone is
invited to submit pull requests)Documentation
examples/
All functions should follow the following (Sphinx parsable) docstring format:
"""One Line Summary (< 80 chars) of the function, followed by period.
:param param_name : Description of this parameter.
:param param_name : Longer parameter descriptions take up a newline with four
leading spaces like this.
:return: Description of function's return value.
A long description of what this function does. Talk about what the user
should expect from this function and also what the users needs to do to use
the function (this part is optional).
"""
# Developer Notes (Optional):
#
# These would be anything that the user does not need to know in order to use
# the functions.
# These notes can include internal workings of the function, the logic behind
# it, or how to extend it.
docs/README.md
.docs/release/README.md
.We love to hear from users about their projects, and if there are issues we will try our best to push fixes quickly. You can read more about how we have been using it in our research at UCSB both in simulation and on FPGAs in our PyRTL paper at FPL.
It is always important to point out that PyRTL builds on the ideas of several other related projects as we all share the common goal of trying to make hardware design a better experience! You can read more about those relationships on our PyRTL project web page.