1. Christopher Felton
  2. dw2013_examples




The following repository contains the example from the DesignWest 2013 conference. To run the examples Python and the latest version of MyHDL-0.8 needs to be installed. As of 4-25-2013 MyHDL-0.8 has not been release, it will need to be pulled from the source repository.

The dw2013 examples use a new feature in 0.8 the @always_seq. The examples rely on the MyHDL-0.8, this version is targed to be released soon (documentation being updated for the release).

Install MyHDL

To install MyHDL clone from the repository

>> hg clone https://bitbucket.org/jandecaluwe/myhdl

>> hg up -C 0.8-dev

The above will clone the repository and change to the 0.8 branch.

>> cd myhdl

>> python setup.py install

Now the latest MyHDL package should be installed. Once MyHDL is installed the examples can be run. The next step is to clone the examples repositry.

>> hg clone https://bitbucket.org/cfelton/dw2013_examples


Once MyHDL and the dw2013_examples are installed the examples can be run.


This is a simply shift register. The stimulus code is embedded in the m_shift.py file. When running the example it takes a command line argument to specify how many bits to have in the shift register.

>> cd dw2013_examples/shift

>> python m_shift.py 8

For the above command, indicate a shift register with 8 bits and it will generate the following output.

0: 00000001
1: 00000010
2: 00000100
3: 00001000
4: 00010000
5: 00100000
6: 01000000
7: 10000000
8: 00000000
9: 00000000

The shift is initialized with 1 and shift the bit over on each clock cycle. In this directory there are two version m_shift.py and m_mod_shift.py. The both operate the same but the implemenations are slightly different.


This example is a counter that will created a periodic strobe. To run this example do one of the following:

>> python test_strober.py


>> py.test test_strober.py

This example will not print out any information (unless py.test was used) but it will create a VCD file and the converted files.


This is a simple IIR digital filter example. This is a subset of the example available here and here.

>> python test_iir.py -h usage: test_iir.py [-h] [--Nfft NFFT] [--Nloops NLOOPS] [--trace]

optional arguments:
-h, --help show this help message and exit
--Nfft NFFT The size of the DFT (FFT) to use
--Nloops NLOOPS
 The number of loops (DFT frames to average)
--trace Enable tracing, VCD created

WARNING! If large numbers are used for Nfft and Nloops the runtime will be large, remember this is a digital circuit simulation.