Inhalt
Topic:.readme_VhdlScript.
pStyle=std tableStyle=stdTable
This example is got from practice: A FPGA-Design (Field Programmable Gate Array, hardware logik) is designed with VHDL (Very High Speed Integrated Circuit Hardware Description Language). The ports or registers of such an FPGA are disposed in the address range of the processor.
The access to this registers are done in C programming language.
Some registers, wich addresses are closed together, should be arranged in struct-Definitions in the C-language. This struct can be used in simulations without the hardware too, by definition of simple instances of this structs, maybe with a emulation of the FPGA-functionality. At most a simple emulation is proper, but a test script is able to use
too.
Registers, which are disposed in other address ranges, should be defined with another struct. The access to this several structs shoud be done in the target system using macros, which contains the hardware adresses as constants.
At first, the corresponding headerfile for C-access should be written manually. There may be used some helpers using a good editor: search'nreplace, column editor, regular expressions etc. But a little problem is: The addresses are not in the same step-width in any case, and may be not in order. A manual imaging may be fault-prone, any address should be look at carefully. But an algorithm can sort the entries and can test the address-steps in a simple way.
The creation of the ZBNF-syntax-script was done in estimate half an hour, including the recognition of the given content of
the VHDL-input-data. The Java program to create the header-file was written in estimate 2 hours. The resulting header-file
isn't able to use without any post processing. It should adapted in the embedded software, but the struct-definitions are correct. The Java-programm may be improved if further requirements are known. At example the registers with
same name but incremented number at end-of-name may be imaged as an array.
The manual creation of the header-file can't be done in this 3 hours, the input data were more complex as here shown (the example is shortened).
The example contains:
<DIR> srcJava VhdlScript2Header.manifest del_results.bat makeJar_VhdlScript2Header.bat runConversion.bat vhdl.zbnf ADDRESSES.vhd Fpga.reference.h
srcJava: Directory with java-source org/vishia/zbnf/example/vhdlScript/Vhdl2Header.java
VhdlScript2Header.manifest manifest-file for jar.
del_results.bat: helper to clean.
makeJar_VhdlScript2Header.bat: Windows-batch file to compile the sources and create the jar-file.
runConversion.bat: Windows-batch file to run the program: parse and create header.
vhdl.zbnf: Syntax of the vhdl-file.
ADDRESSES.vhd: Inputfile VHDL-Script.
Fpga.reference.h: The expected result: Test result with changed conditions should be compared with it.
If makeJar_VhdlScript2Header.bat and runConversion.bat are invoked, the following files should be created:
VhdlScript2Header.jar Fpga.h