Compiler Definition for GHDL usage. Use VHDL projects with outside build and standard CMake configuration as known for other applications.
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE:STRING=Debug|Release ../cmake-ghdl-compiler
make -j`nproc`
GHDL and GtkWave is required to use this example.
Just use cmake/modules inside your project to compile and run VHDL projects with GHDL.
Create a simulation target for testbench. Example:
add_custom_target(sim_example COMMAND ${CMAKE_GHDL_COMPILER} -r ${PROJECT_NAME} --stop-time=1000ns --disp-time --wave=${PROJECT_NAME}.ghw WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Display the wave output from simulation of testbench. Example:
add_custom_target(sim_example_wave COMMAND ${GTKWAVE} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.ghw DEPENDS sim_example WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Run a custom target
make sim_example|sim_example_wave
Currently the Ninja generator is not able to elaborate the designs, because he write too fast into the same definition file of GHDL.