Using pip to Manage HDL Components
Posted on 27 Jan 2024 in Automation • 2 min read
Attention, I am going to advocate non-traditional development flow. Relax and take it easy.
The Problem
In the world of HDL languages, we have natural reusable containers like packages and modules. However, the infrastructure does not include any standard package manager like we have in modern programming languages. With this kind of tool you can smoothly manage variety of components, versions and dependencies with ease.
So, in HDL world it is quite common to invent in-house flows and tools to make reusable components manageable. We even have open source solutions addressing this like well-known FuseSoc.
The Idea
But what if you take a package manager from any popular language and try to adapt it to HDL?
I've chosen Python pip for this experiment, because Python has become widely used in ASIC/FPGA flows, and pip
itself is just about everywhere. Its packages are straightforward to create, publish, and use. And the last reason - why not, it should be fun!
The Solution
Basically, you don't need anything to distribute HDL via pip
. Just pack and publish in any convenient way to local or global repository.
However, you'll likely need a way to get the path to sources, or a filelist, or other components necessary for compiling and simulating your HDL. That's why I hid such and other boilerplate inside pip-hdl
package. As a result, only two extra files for 5-10 lines of code are required to build a package with HDL inside. These files can even be automatically generated by the tool. And with that, you are ready to go!
Here is my proof-of-concept: github repo, detailed guide and examples. Package pip-hdl is available at PyPi.
Please explore these resources for a better understanding of how it works. Keep in mind, though, that this project is still in its early stages and hasn't been used in production or tested extensively yet.
Bottom Line
As a result, you can get all the power of pip for a UVM agent, FIFO or other component for almost free. And it comes with clear dependency control, versioning and straightforward delivery method to the machine. Isn't that great?