Skip to content

This repository contains a minimal configuration for getting started with the Continuous Integration for the VHDL language, by involving the GHDL compiler

License

Notifications You must be signed in to change notification settings

mariobarbareschi/vhdl_ci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

vhdl_ci

This repository contains a minimal configuration for getting started with the Continuous Integration for the VHDL language, by involving the GHDL compiler.


Prerequisites

To compile and simulate VHDL projects, you need to install the following tools:

  • cmake (v > 3.3)
  • ghdl
  • gtkwave (optional)

This repo provides you two CMake macros and some other stuff for managing VHDL entities and testbenches.

Create you first project

Clearly, your VHDL project is made of entities, packages, functions, testbenches, and so on. You have available two CMake macros:

CMake Macros Description
add_vhdl_source( <entity_tag>) add with the symbolic name <entity_tag> into the library work
add_vhdl_library( <library_name> <entity_tag>) add with the symbolic name <entity_tag> into the library <library_name>
add_testbench_source( <test_tag>) add testbench with the symbolic name <test_tag>

Tags are actually used for giving dependencies among entities and testbenches

add_testbench_source(adder_testbench.vhd test_add)
add_dependencies(test_add ripple_carry_adder full_adder half_adder)

Just make sure that the testbench entity name and the associated tag have the same name, otherwise you will eventually fail your simulation. Moreover, avoid to call it simply testbench. The effect of add_testbench_source is to add a job for make such that it compiles entities contained inside the VHDL file, while add_testbench_source creates a job for running a test, evaluating assertions inside the testbench, or simulation, by producing in output a VCD file.

Running the example

To running the demo example, just type into your system shell:

$ git clone https://github.com/mariobarbareschi/vhdl_ci.git
$ cd vhdl_ci
$ mkdir build && cd build
$ cmake ..

Once cmake terminated, you will have available some make jobs ready to be ran:

$ make mux2_1
$ make mux2_1_testbench
$ make mux4_1
$ make mux4_1_testbench
$ make test
$ make sim_mux2_1_testbench
$ make sim_mux4_1_testbench
$ make runtest

Even though the CMake project is based on CTest, running make test will fail, since it does not support dependencies. Instead, run

sh make all test

The GHDL command will be invoked by jobs named like a entities. In particolar, running jobs "testbench.*" causes a GHDL running over them, producing VCD files inside the trace folder, while, by default, GTKWave will be invoked as "*.vcd" file viewer each time a job "sim_*" is actually executed. If you need to change the way GTKWave is ran or even the VCD viewer, define inside your CMakeLists.txt file a variable VCD_VIEWER that specifies the executable you want. For instance, if you are a MacOS user and you installed GTKWave as a system application, define VCD_VIEWER as follows:

set(VCD_VIEWER open -a gtkwave)

Automatic Compilation

In order to directly support the continuous integration, this project provides you a Docker image with all you need for testing your VHDL code. Indeed, the demo of this repository is automatically executed, namely tested, through Travis-CI. By your own, having available Docker, just type:

$ git clone https://github.com/mariobarbareschi/vhdl_ci.git
$ docker build -t vhdl_ci .
$ docker run vhdl_ci /bin/bash -c "mkdir /opt/build && cd /opt/build && cmake .. && make all test"

If you want to skip the docker image build, just pull it from the Docker hub:

$ docker pull mariobarbareschi/vhdl_ci

LICENSE


Contributing

Github is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository.

About

This repository contains a minimal configuration for getting started with the Continuous Integration for the VHDL language, by involving the GHDL compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published