Are there any good, existing software tools available to assist in generating C header files with appropriate #defines for register offsets as well as bit definitions from VHDL? If any such tools do exist, what restrictions to they place on the VHDL and how are things that should be exported designated?
So far, I've found these tools but they aren't exactly what I'm looking for:
Based upon these tools I am also interested if the proper workflow is to generate both the C and the VHDL rather than trying to go directly from VHDL (perhaps with extra tags in the comments) to C.
You could have a look at doxygen, it supports the VHDL language and by using intermediate files you may be able to extract the information more or less easily. A by-product would be your RTL code documentation.
Another option is to build a C parser from the Yacc/Lex definitions, you can find several ones here. From there, you can parse the VHDL, extract the information (you will have to determine how to retrieve the definition of your registers) and produce a C header file. It's probably quite complicated.
But if I were you, I would really proceed differently and define the register offsets and fields in a separate file (for example, in XML), and write a small script to generate both C headers and a VHDL package, this would save you a lot of time and would be more robust from a flow point of view.
That would also help in building any documentation.
You could of course automate the process with a makefile/or in a script that prepares the database before simulation/synthesis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With