myhdl 0.7

Python as a Hardware Description Language

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
LGPL (GNU Lesser General Public License) 
3.0/5 1
Jan Decaluwe
ROOT \ Science and Engineering \ Electronic Design Automation (EDA)
MyHDL is an open source Python package that lets you go from Python to silicon. It can help you to use Python as a hardware description and verification language.

Furthermore, you can convert implementation-oriented MyHDL code to Verilog and VHDL automatically, and take it to a silicon implementation from there.


Python's power and clarity make MyHDL an ideal solution for high level modeling. Python is famous for enabling elegant solutions to complex modeling problems. Moreover, Python is outstanding for rapid application development and experimentation.

The key idea behind MyHDL is the use of Python generators to model hardware concurrency. Generators are best described as resumable functions. MyHDL generators are similar to always blocks in Verilog and processes in VHDL.

A hardware module is modeled as a function that returns generators. This approach makes it straightforward to support features such as arbitrary hierarchy, named port association, arrays of instances, and conditional instantiation. Furthermore, MyHDL provides classes that implement traditional hardware description concepts. It provides a signal class to support communication between generators, a class to support bit oriented operations, and a class for enumeration types.

Simulation and Verification

The built-in simulator runs on top of the Python interpreter. It supports waveform viewing by tracing signal changes in a VCD file.

With MyHDL, the Python unit test framework can be used on hardware designs. Although unit testing is a popular modern software verification technique, it is still uncommon in the hardware design world.

MyHDL can also be used as hardware verification language for Verilog designs, by co-simulation with traditional HDL simulators.

Conversion to Verilog and VHDL

Subject to some limitations, MyHDL designs can be converted to Verilog or VHDL. This provides a path into a traditional design flow, including synthesis and implementation. However, the convertible subset is much wider than the standard synthesis subset, and includes features that can be used for high level modeling and test benches.

The converter works on an instantiated design that has been fully elaborated. Consequently, the original design structure can be arbitrarily complex. Moreover, the conversion limitations apply only to code inside generators. Outside generators, Python's full power can be used without compromising convertibility.

Finally, the converter automates a number of tasks that are hard in Verilog or VHDL directly. A notable feature is the automated handling of signed arithmetic issues.

Last updated on December 19th, 2010


#hardware description #hardware verification #Python library #Python #hardware #description #verification

Add your review!