Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share register and bit field definitions between a device driver and the FPGA it controls

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:

  • Vregs by Veripool
  • SpectraReg by PDTi
  • Bitwise by Duolog

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.

like image 700
Tim Kryger Avatar asked Oct 18 '09 19:10

Tim Kryger


1 Answers

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.

like image 74
RedGlyph Avatar answered Oct 18 '22 20:10

RedGlyph