Skip to content

VXAPPS/cmake-ghdl-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmake-ghdl-compiler

Compiler Definition for GHDL usage. Use VHDL projects with outside build and standard CMake configuration as known for other applications.

Build

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE:STRING=Debug|Release ../cmake-ghdl-compiler
make -j`nproc`

Dependencies

GHDL and GtkWave is required to use this example.

Compiler Definition

Just use cmake/modules inside your project to compile and run VHDL projects with GHDL.

Simulation Targets

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

Known Issues

Currently the Ninja generator is not able to elaborate the designs, because he write too fast into the same definition file of GHDL.