The program

vhd2vl is a VHDL to Verilog translation program.
It targets the translation of synthetisable RTL.
While far from complete it supports a useful
subset of VHDL, sufficient for complex designs.


Directory structure

readme // This file
src // Source code directory
license // GNU general public license text
grammar // Contains a simplified description of the translator grammar
example // Directory containing a simple VHDL file to test the translator


Compilation

Simply go to the src directory and type make.
The makefile is particularly simple and it should
work on most Unix systems. It has been tested on
Sun and Linux.


Usage

vhd2vl <input file> <output file>

For example, from the src directory after compilation :
vhd2vl ../example/test.vhd test.v


Known problems

This is my first attempt to use YACC (and it shows :-)).
I'm not a sw engineer and I never worked to the
development of commercial sw, so be kind to my effort :-)
It is targeted to synthesisable code, so don't even try it
on testbenches.

The program might fail on something as simple as
comments in the code.
This is because I had to tell YACC where to expect comments
and if it finds one where it does not expect one to be it will
stop with an error.

Another problem is encountered when translating WITH
statements. A commercial VHDL to Verilog translation program
I used translated these with nested <cond> ? <op> : <op>; 
Verilog statements. I didn't like these as they might generate
priority structures during synthesis.
A much better solution (adopted here) is to translate WITH
statements into Verilog CASE statements.
Unfortunately this requires to fill the sensitivity list of
the process containing the CASE statement.
This is a pain to do automatically but it relatively easy to
do manually.
Consequently vhd2vl correctly translates a WITH statement
into a Verilog CASE statement, but it leaves the sensitivity
list of the process empty (and outputs a warning).
Unless you are a real WITH fan you won't find this a major
problem.

Bit aggregates are not really supported. Only things such
as (others => '0') or (others => '1') are supported (very
useful when clearing vectors under reset).

There are other subtle limitations in the translator, even
within the small subset supported. These are due to my
misunderstanding of YACC, VHDL or both as well as YACC's own
limitations and the shortcuts I took.
Consequently vhd2vl might in some cases translate illegal
VHDL with no errors. Make sure that the VHDL you want to
translate is correct in the first place by compiling it with
a proper compiler.

vhd2vl was not written with efficiency (during translation)
in mind. This is not required since translation in itself
is pretty straightforward and modern machines have plenty of
memory and speed.
vhd2vl will not properly clear the memory it uses (but the
OS will do it when it quits) and it does stupid things such
as sequential searches in symbol tables.


Revision history

V 1.0 - First release


Licensing information

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Please review the terms of the license in the license file included
in the distribution.


Acknowledgments

As I had never used YACC before I had to rely on a variety of
texts and existing programs for clues.
Particularly useful was the VHDL to C translator code from
fellow Italian Christian Ghezzi whose code can be found at:


Bugs & comments

vhd2vl was tested on VHDL code implementing Triple DES and
JPEG codec cores sold by Ocean Logic Pty Ltd.
This does not mean it has no bugs, so If you find any or you
want to make suggestions, please contact me on:
oceanlogic@yahoo.com

I'm very busy, but I'll try to get back to you.

Enzo

