MyHDL on Ubuntu

Posted on 2010/02/23

6


MyHDL is a Hardware Description Language, such as Verilog and VHDL, but you write in Python. To quote the official website:

MyHDL is an open source Python package that lets you go from Python to silicon. With MyHDL, you can 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.

For those unfamiliar with it, Python is a scripting language designed to be easy to learn, easy to write and easy to extend; it is broadly adopted for graphical applications, websites, mathematics,  games

I don’t know if MyHDL will become a widespread description language for hardware blocks, but I see a lot of potential for testbench and verification. Verilog and VHDL become narrow when you need to write a high-level block, so it comes natural to use a higher-level language; but SystemVerilog and SystemC (the industry most popular ones) have a steep learning curve with respect to Python and MyHDL. Moreover, hardware design projects often need the creation of tools to assist the simulation and verification flow (for example parsing the simulation output, or stimulus data generation); if a designer is already proficient in MyHDL, then those tools can be quickly done in Python.

MyHDL can be downloaded from its sourceforge project page, but I wanted to ease the installation on Ubuntu and the subsequent software updates, so I “debianized” the package (following the complete packaging guide from Ubuntu wiki) and put it on my Launchpad PPA. In order to install MyHDL, the procedure is the following, and is very similar to that explained on this gnome-do tutorial.

Install MyHDL on Ubuntu

  • Open Synaptic from the main menu: System –> Administration –> Synaptic Package Manager¬† (insert the password).
  • Open the repository settings from the Synaptic menu: Settings –> Repositories.
  • In the “Other Software” tab, click the “+ Add…” button.
  • Write “ppa:balau82/ppa” and click the “+ Add Source” button.

    Add Balau PPA to install MyHDL

    Add Balau PPA to install MyHDL

  • Copy the following data; I suggest using the “copy to clipboard” button that appears when you hover the mouse pointer on the top right of the code block:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10

mI0ESyO5zAEEAK6YqY9orY4jRnQ8LAPiq5d7eEuLrVak6zy+n0GGu/ZdZrsINNUzmmPGmCUT
N3qInDXzHJp0y+Fl6heeuXv4WNwrGvudit9qJUISbTSQdd8KFRqrxPhzhrEYsR9NRJsXzYD1
27dbsAaByLy6mg4zS69sWBoVroUolAeQNWOuQqllABEBAAG0G0xhdW5jaHBhZCBCYWxhdSBT
dGFnaW5nIFBQQYi2BBMBAgAgBQJLI7nMAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ
ybyblrvqs+4TqwP/Zs4agXPVE3ZZyybXxANvU8OeHzL1MSZW0yA52iHNXJb6PPTlVBBz6pA4
iuPpM6jrf3QHyFmsHBSBwUPGyP1uSUTH0tpiEU6p4viOIWFk+CpNcNKo7jo7RFXyywYZgsPO
G+bgk6DL3v3Vhxtvm01DtuqiaPrVGk6o8ILxdUTznBI=
=41Rf
-----END PGP PUBLIC KEY BLOCK-----
  • Go to the Authentication tab, right-click in the white space and click “Add key from paste data”.
  • Close the “Software Sources” window and click the “Reload” button on Synaptic.
  • Search for the package with name “myhdl” and install it.
  • Close Synaptic.

Install MyHDL on Ubuntu from the command line

Open the terminal and run the following commands

sudo add-apt-repository ppa:balau82/ppa
sudo apt-get update
sudo apt-get install myhdl

This will install all the required packages for myhdl including gpg key.

Thanks to Ubuntu Geek for the installation instructions.

To get started, many examples are provided in “/usr/share/doc/myhdl/examples“, and more information can be found on the MyHDL cookbook.

About these ads
Posted in: Hardware, Software