MyHDL Project Introduction

MyHDL is a Python package that extends Python as a hardware description language (HDL). MyHDL empowers implementation of complex digital circuits that can be targeted towards ASIC and FPGA technologies.

Jan Decaluwe is the creator and BDFL. The MyHDL project has been around for many years and has had many successes bringing a modern and software influenced approach to HDL development. MyHDL has been used for various FPGA projects and numerous ASIC projects 1.

The following are good starting points to learn more about MyHDL:

Also see the idea pages at lowRISC and FOSSI.

MyHDL Community

The MyHDL mailing-list and the #myhdl IRC channel on Freenode can be used to interact with the MyHDL community. Most questions can be answered in one of these two outlets.

Questions can also be posted to:

The IRC channel is informal and typically a question will be part of a time-limited conversation. On the mailing-list more users/developers will have a chance to comment on the question and the question will receive more feedback over time.

Before a question is posted to the mailing-list or IRC care should be taken to construct a useful question. Simple guidelines for posting questions to the community:

  1. Limit the scope of the questions.
  2. Briefly state what is to be accomplish.
  3. Give a small example embedded in the question.
  4. Clearly state the question in the context of the simplified problem.
  5. It is ok to link original code (or attach) as a reference but it should not be required to answer the question.

Example, don't post code and state: "it doesn't work, help".
Determine where the issues is and create a specific question to the problems independent of the context of the project. The easier the question is to understand and test (e.g removing extraneous information) the faster the question will be answered.

Mentors will be in a position to help dig through the project code. To get the highest probability of a timely and useful answer the above recommendation should be used when posting to the mailing-list.

This exhaustive essay on, interacting and getting questions answered by asking well-thought questions, is a good guide.

Writing Your GSoC Application

A common template is available to help bootstrap the student proposals. For more information on GSoC see the GSoC website in particular the student FAQ is a good place to start for new students and the student guide is a thorough review of the program.

Getting Started with MyHDL

Using MyHDL

The MyHDL manual outlines how to design digital circuits with MyHDL. MyHDL installation instructions thoroughly cover installing the MyHDL package.

The following is a list of additional examples and projects that can be used as first exercises and references:

Contributing to MyHDL Package

The MyHDL project has outlined a development process that should be followed by each participant. This includes writing enhancement proposals for projects that contribute directly to the MyHDL package. Certain project ideas are based on existing MEPs. The student proposal will be natural start to a MEP if needed.

The cores developed with MyHDL are intended to be incorporated into a single repository 3 at the end of the project.

Project Ideas

The project ideas fall into two categories:

  1. Enhancements to the MyHDL package.
  2. Implementing cores with MyHDL.

All projects require programming in Python, previous knowledge of HDL design, and many of the MyHDL specific projects (i.e. non-cores) require experience with compilers (familiarity with the Python compiler package desirable).

The MyHDL package uses the LGPL license, all work submitted to the MyHDL package will be LGPL.

MyHDL Package Project Ideas

General Hierarchy Analyzer

This development is intended to have a single hierarchy analyzer. This analyzers will use the common components from the rest of the conversion code and provide additional reusable components. This would also support MEP110.

This project requires knowledge of compilers and the Python compiler support and packages. This is an advanced project that will support the overall MyHDL conversion code structure, reusability, and comprehension. Students interested working on this project should review the MEP114 and its impact. This project shall support the MEP114 @mydhdl.block inclusion.

Potential mentor(s):

. Oscar Diaz, dargor0* on IRC and @dargor0 on github

Cosimulation Signal Extraction

It is possible through the foreign language interfaces (VPI/DPI) to extract all the signals in from the Cosimuation simulator and build a dict or object on the Python side. Performing this action will simplify and automate connecting a Python/MyHDL verification environment to a Verilog/VHDL simulation.

This project will require a student to investigate the MyHDL Cosimulation and research the simulator foriegn-language-interfaces, in particular VPI and/or DPI for Verilog Cosimulations and VHPI for VHDL simulations (note Cosimulation with VHDL is not currently possible due to the lack of open-source simulators with a complete VHPI or other FLI). This task requires moderate skill level, general simulator knolwedge and will require Python and C coding. This work will mainly be completed with the Icarus Verilog or CVC simulators.

An alternative, is to parse the top-level block ports and automatically build the interface. A rough version of this mehtod has been used in other projects.

2D List-of-Signal Conversion

The MyHDL conversion currently handles converting a list-of-signals. But it is often desired to use multi-dimension (list of lists) to structure data and/or signals. This project will involve exploring the list-of-signal conversion, proposing an architecture for multi-dimension conversion, a complete set of tests, and an implementation for the conversion.

Fixed-point Compiler

This project will develop the backend compiler for the proposed fixbv type. The fixbv has been proposed in MEP111.

MyHDL Cores Project Ideas

The following projects are the development and/or ports of common building blocks used in many complex digital systems. These are not intended to be straight ports. They are intended to be designed in the MyHDL philosophy bringing many software concepts to hardware design and creating modular and scalable cores.

Gigabit Ethernet MAC

This project involves porting a Gigabit Ethernet Medium Access Controller (GEMAC) core to MyHDL. The GEMAC is typically used to stream data in and out of an FPGA versus the lower throughput in common IO Ethernet connections.

The project has a reference Verilog design and a test framework.
The test framework will be used to validate the core and encourage test driven design.

Like all the cores being implemented in MyHDL these cores should be designed bus agnostic. The GEMAC requires in/out data-path and optional memory-map interface. If the optional memory-map interface is not included the default configuration should easily be set during instantiation. The core should support many different standards for the different type if interfaces. The following is an example that shows how the interfaces are past to the core:

Dynamic MAC control via the AvalonMM bus with a AvalonST streaming data interface.

mmbus = AvalonMM(...)
databus = AvalonST(...)
eth_inst = gemac_lite(glbl, databus, mmbus)

Dynamic MAC control via the Wishbone bus with a FIFOBus streaming data interface.

mmbus = Wishbone(...)
databus = FIFOBus(...)
eth_inst = gemac_lite(glbl, databus, mmbus)

Static configuraiton with a FIFOBus streaming data interface.

cso = gemac_lite.cso()
cso.subnet_mask = 0xFF00001
databus = FIFOBus(...)
eth_inst = gemac_lite(glbl, databus, cso=cso)

By using the interfaces and passing the interface types the core becomes truly modular and scalable.

This project requires digital circuit familiarity, ability to read and understand Verilog and Python. Knowledge of Ethernet standards and protocols will be useful.

Hardware testing is not an explicit requirement of this project but would be a great addition.

The potential mentors for this project are:

  1. Guy Eschemann, tbd on IRC, @geschema on twitter, and @geschema on github

HDMI Source / Sink

An HDMI controller sources and sinks a video stream. The core performs the required encoding and decoding to an HDMI link. It also provides a mechanism to "query" the connected device.

The project has a reference Verilog design and a test framework.
The test framework will be used to validate the core and encourage test driven design.

This project requires digital circuit familiarity, ability to read and understand Verilog, and Python.

The potential mentors for this project are:

DDR3 Controller

The project has a reference design to port and a test framework. The test framework will be used to validate the core and encourage test driven design. The core port/development should also include the embedded memory test

As the cores project overview description indicates, this is not a simple port. The generated core should support the functionality of the reference design but the core should also explore creating a core that is modular and scalable. It should be explored if a single controller can be designed to support multiple interfaces and standards. This typically involves advanced usage of elaboration code.

This project requires digital circuit familiarity, ability to read and understand Verilog, and Python. Knowledge of external memory types and memory controller desired but not required.

The potential mentors:

  • TBD

JPEG Encoder

This project is the design and/or port of a JPEG encoder. Same as the other core projects, the goal is to demonstrate a modern HDL implementation usign MyHDL. Hardware versions of JPEG encoders are common for (basic) video compression. The reference core and test framework is the starting point for this project. This project should convert / implement one component at a time. The following is a suggested order of implementation:

* RGB to YCBCR conversion
* 2D DCT
* Quantizer
* Huffman block
* Misc: FIFOs, etc.
* Top-level

This project requires digital circuit familiarity, ability to read and understand Verilog, and Python.

Leros tiny processor

Leros is a tiny soft-core processor optimized for low-cost FPGAs , written in technology-agnostic VHDL. The architecture is a pipelined 16-bit accumulator, designed with a balance of logic resources and on-chip memory.

Tiny processors applications include:

  • Implement complex states machines with a tiny processor and a tiny assembler program.
  • Implement intelligent peripheral device for auxiliary functions.
  • Many-core applications and massive parallel algorithms.

This project has the architecture documentation and a reference VHDL design to port. The project will include not only the port but also the test framework and testbenches in MyHDL to use test driven design features. A user guide for the processor core is also planned in the project.

Test on real hardware is desirable, in order to compare logic resources usage and real performance of both MyHDL and VHDL implementations.

This project requires digital circuit familiarity and experience with VHDL. A background on computer architecture and microcontrollers is desired but not required.

RISC-V CPU and tools

RISC-V is an open ISA freely available for all types of use. The RISC-V ISA has been designed with small, fast, and low-power real-world implementations in mind, but without "over-architecting" for a particular microarchitecture style.

There are various implementations available in Chisel(1,2), Verilog and Bluespec

The goal of this project is to develop a simple 32 bit RISC-V CPU with support for integer operations, and tools to simplify CPU design and experimentation with MyHDL(such as computing the CPI of the processor with various workloads). These tools could be generalized to work with other CPUs designed in MyHDL.

The various stages of this project include:

  • Developing a pure-python decoder for ISA simulations and testing the decoding hardware.
  • Implementing a decoder in MyHDL and writing tests for it.
  • A working RTL implementation of the CPU in MyHDL without pipelining. This Essentially an ISA simulator, but it can be used to sanity check future implementations.
  • A two or three stage pipeline which can be put on a modern FPGA at a reasonable frequency.
  • A 'proper' six stage in-order pipeline like the Rocket core.
  • Experimenting with other microarchitectural techniques such as multiple-issue, Out of Order execution.

The focus of this project is not just to make a working RISC-V implementation, there are loads of those already out there. Instead, we will focus on demonstrating the benifits of Python and MyHDL for CPU design and Computer Architecture research. Additionally, the shortcomings discovered(such as requiring excessively verbose code for certain kinds of tasks) will be used to propose MyHDL enhancements or create support libraries.

The potential mentors for this project are:

Crypto core

This project is the design and test of a cryptographic core. This core should be designed to be modular, to implement various cryptographic algoritms and operation modes, suport symetric and asymetric encription, and it should be easy to extend. Recommended algorithms to implement are AES, 3DES and RSA, and operation modes to implement are ECB, CBC, CFB, OFB and CTR.

Additional aspects to cover with this project are: * Performance comparison against software implementation. * A modular test mechanism. * Study on possible implementation vulnerabilities.

A reference implementation for this project is openSSL library, although there are some hardware implementations in VHDL and Verilog.

Potential mentors for this project:

Other Cores

There are an unlimited number of cores that can be implemented with MyHDL. Any core can be proposed but will not have the existing support as above project ideas. If a student has a particular core they would like to port to or implement with MyHDL, start a conversation with the community and generate a proposal.

Potential Mentors