Skip to main content
Using VHDL (by installing GHDL) on Code Ocean

Executing VHSIC Hardware Description Language on Code Ocean.

Updated over 5 years ago

VHDL is a "hardware description language." The easiest way to use it on Code Ocean is to use GHDL, an "open-source simulator" that "allows you to compile and execute your VHDL code". GHDL is available on GitHub.

To execute VHDL code on Code Ocean:

  1. start from an Ubuntu 16.04 or 18.04 base environment (or whatever is needed);

  2. Use the postInstall script to run the following code:

#!/bin/bash

buildDeps="ca-certificates gnat make zlib1g-dev"
apt-get update -qq && apt-get install -y $buildDeps

release="20181129" # or whichever release is appropriate
curl -L https://github.com/ghdl/ghdl/archive/$release.tar.gz | tar xz
cd ghdl-$release
./configure --prefix=/usr/local
make && make install

apt-get purge -y --autoremove $buildDeps && rm -rf /var/lib/apt/lists/*

The GHDL executable will then be located in /usr/local/bin/ghdl during runtime. 

Example capsule:

Did this answer your question?