Developing design: moving average filter. Part 1 – introduction.

I wanted to briefly describe main steps which should be taken to correctly implement designs in VHDL (but of course it works for any other languages). As an example I chose simple moving average filter. The purpose is not to build something difficult, but to show how to build working, well-tested designs.

What are these steps?

1. Specification

Before you start coding, you have to be able to answer some basic questions like:

  • How should a design work?
  • How should it look finally?
  • How should it behave in unexpected situation?

You should write or get specification of the project with all details and understand it. Before any work, you should clarify all your thoughts, worries, doubts etc.

2. Methodology

This part is specific for hardware languages. Important is not only knowledge about what you have to implement, but how the code will be placed in the hardware as well. Remember that at the end, your code will be translated to real gates and registers. VHDL is a language where you have to care about target hardware and understand what compiler will do with your code.  Your project should be optimised for specific target. You have to take into account timings, resources, speed. Remember also that designs have their own life. Even simple projects are developed for a long time and new versions are created one after another. If you don’t prepare the code for it at the beginning, with every new modification will be harder and harder to add changes. All these things matter here. When you start writing the code it must be as simple as possible, but meet all requirements.

3. Tests

When you know what to do, and how to do, next step is to think how can it be tested? How can you be sure that created design will behave as it should and as it is described in the specification? What should you do to ensure that you project works properly and risk of any bugs is low?

4. Implementation

After all that ‘boring’ steps, comes time to start coding:

  • write your design
  • create and write all tests for it
  • verify the design and if it has any bugs fix them

Sometimes it seems that steps 1 – 3 are not so important and time spent for it is wasted, because there are no visible results after that. This is not true. Sometimes spending more time on that first steps, saves much more time later, during developing and implementation. Many times I took a part in projects where thinking how to do it, took more than 90% of whole time reserved for the project.

Leave a Reply

Your email address will not be published. Required fields are marked *