How to install TerosHDL on Windows and Linux - tomas-fryza/vhdl-course GitHub Wiki

Note: The official install instructions for new version 5 are available on TerosHDL web pages.

Installation on Windows

  1. Download and install Python.

  2. Start Command Prompt Start > cmd and use the Python package manager to install all required TerosHDL packages.

    # Manually
    pip3 install vunit-hdl
    pip3 install edalize
    pip3 install yowasp-yosys
    pip3 install vsg
    
    # Or all together
    pip3 install teroshdl
    pip3 install cocotb
    
  3. Download and install make for Windows (make-3.81.exe) to C:\APPZ\VHDL (NEVER use accented symbols and spaces in the path to program). Add folder C:\APPZ\VHDL\GnuWin32\bin to System variable PATH in Environment Variables... and restart the computer.

    Hint: In Windows 10 start Settings application, select System, About, Advanced system settings, and click on button Environment Variables...

    Windows environmental variables

  4. Download and unzip ghdl for Windows (ghdl-0.37-mingw32-mcode.zip) to C:\APPZ\VHDL.

  5. Download and unzip gtkwave for Windows (gtkwave-3.3.100-bin-win32.zip) to C:\APPZ\VHDL.

Installation on Linux

  1. Download and install Python.

  2. Start Terminal (typically Ctrl+Alt+T) and install all required packages.

    # Download and install TerosHDL required packages
    pip3 install teroshdl
    
    # Optional
    pip3 install cocotb
    
    # Download and install required tools
    sudo apt-get install make ghdl gtkwave
    

Installation continues for both systems

  1. Download and install Visual Studio Code source code editor.

  2. Run Visual Studio Code, open up the extensions viewer in menu View > Extensions Ctrl+Shift+X, and then typing teros into the search bar. Press Install button on the result TerosHDL.

    TerosHDL installation

    It may take a few minutes depending on your connection speed. Do not close any window and do not open other folders until the installing process is completed.

  3. Optional: Install WaveTrace Visual Studio Code plugin as well. It will be useful to display simulated *.vcd files.

Configuration

Version 2

Click on the TerosHDL icon in the left-hand margin, then on TerosHDL configuration gear at TEROSHDL: PROJECT MANAGER, and set/check the following:

TerosHDL configuration

  1. General > Enable show TerosHDL console: check
  2. General > Select a tool, framework, simulator...: Ghdl
  3. General > Select the waveform viewer: VCDrom
  4. GHDL > Installation path: C:\APPZ\VHDL\GHDL\0.37-mingw32-mcode\bin on Windows or /usr/bin/ on Linux
  5. GHDL > analyze options: --ieee=standard,--std=02
  6. Linters settings > VHDL style checker: VSG
  7. Formatter settings > VHDL formatter: VSG
  8. Formatter settings > VHDL standalone formatter > Indentation: "2 spaces"
  9. Click on button Apply and close

Version 5

Click on the TerosHDL icon in the left-hand margin, then on Open Configuration Menu button in Actions part, and set/check the following:

  1. Formatter > General > VHDL formatter: VSG
  2. Linters settings > General > VHDL style checker: VSG
  3. Tools > General > Select a tool, framework, simulator...: GHDL
  4. Tools > General > GTKWave installation directory: C:\APPZ\VHDL\gtkwave\bin on Windows or /usr/bin/ on Linux
  5. Tools > General > Select the execution mode: GUI
  6. Tools > General > Select the waveform viewer: Tool GUI
  7. Tools > GHDL > Installation path: C:\APPZ\VHDL\0.37-mingw32-mcode\bin on Windows or /usr/bin/ on Linux
  8. Tools > GHDL > analyze options: --ieee=standard,--std=02
  9. Click on button Apply and close

Ver2 Create a new project and simulate it

  1. Click on plus symbol on TerosHDL Projects > Empty project and set the project name, such as comparator.

    TerosHDL new project

  2. Create or copy source VHDL files (design.vhd and testbench.vhd) to any project folder on the disk. Do NOT use accented symbols and spaces in the path to project folder! Click on plus symbol on your new project and add existing files to in by Select files from browser.

    TerosHDL add files

  3. If you have multiple projects, select one by Select project check symbol.

    TerosHDL select project

  4. Select testbench file to simulate by Set as Top check symbol.

    TerosHDL select top

  5. Run the simulation by Start button at TEROSHDL: PROJECT MANAGER or by Run in Run list top-level file.

    TerosHDL run

  6. To display the simulated waveform, click on Run with GUI button. You can move the waveform by pressing Shift key and scrolling the mouse wheel, or you can zoom it by pressing Ctrl and scrolling the mouse. Note: The waveform.vcd file is located in your-home-folder/.teroshdl/build.

    TerosHDL waveform

  7. You can apply formatter settings to open VHDL file by Format check symbol in upper margin or you can generate the documentation by Module generation preview symbol.

    TerosHDL format

Ver2 Implement design using Vivado

  1. In TerosHDL configuration change the following:

    1. General > Select as tool, framework, simulator...: Vivado
    2. Vivado > Installation path: C:\APPZ\Xilinx\Vivado\2020.2\bin on Windows or /home/your-home-folder/bin/Xilinx/Vivado/2020.2/bin on Linux
    3. Vivado > Part: xc7a50ticsg324-1L (it is the device on Nexys A7-50T board, we are using in the course)
  2. Note that in your project, there must be design *.vhd file(s) and constrains *.xdc file, such as nexys-a7-50t.xdc. Do not forget to uncomment the lines corresponding to used pins.

  3. If you have multiple projects, select the one to implement by Select project check symbol.

    TerosHDL select project

  4. Select the top level *.vhd file to implement (not the testbench!) by Set as Top check symbol.

  5. Connect your FPGA board and run the implementation process by Start button at TEROSHDL: PROJECT MANAGER or by Run in Run list top-level file. Note that the whole process may take several minutes.

Schematic viewer on Linux

  1. Get sources and install Yosys.

    git clone https://github.com/YosysHQ/yosys
    cd yosys
    

    Select your compiler in Makefile.

    vim Makefile
    
    # CONFIG := clang
    CONFIG := gcc
    # CONFIG := afl-gcc
    # CONFIG := emcc
    # CONFIG := wasi
    # CONFIG := mxe
    # CONFIG := msys2-32
    # CONFIG := msys2-64
    

    Install dependencies.

    sudo apt install tcl-dev libreadline-dev
    

    Compile and install.

    make
    sudo make install
    

    Get the installed version.

    yosys -V
    
  2. Get sources, build and install GHDL. Note: GHDL must be built with at least version of 8 GNAT (gnat-8).

    git clone https://github.com/ghdl/ghdl
    cd ghdl
    

    Install dependencies.

    sudo apt install gnat
    

    Configure, compile and install.

    ./configure
    make
    sudo make install
    

    Get the installed version.

    ghdl --version
    
  3. Get sources and build ghdl-yosys-plugin

    git clone https://github.com/ghdl/ghdl-yosys-plugin
    cd ghdl-yosys-plugin
    

    Compile and copy generated library ghdl.so to /usr/share/yosys/plugins or /usr/locall/share/yosys/plugins directory. Create this folder if necessary.

    make
    sudo cp ghdl.so YOUR-YOSYS-FOLDER/plugins/
    
  4. In TerosHDL, Open Configuration Menu:

    • Schematic viewer > General > GHDL: GHDL (module) + Yosys
    • To show design using logic primitives rather than RTL, set Schematic viewer > General > Arguments passed to Yosys: synth

Tested on

Version Result (yyyy-mm-dd) Note
Linux Mint 21.1 (Vera) OK (2024-02-27) Office
Windows 10 OK (2024-02-06) HomeOffice
Linux Mint 21.1 (Vera) OK (2023-02-22) Office
Windows 10 OK (2022-10-17) Office
Windows 10 OK (2022-09-09) Lab SC 6.61
Windows 10 OK (2022-04-12) Lab SC 6.61
Linux Mint 20.3 (Una) OK (2022-04-05) Office
# FYI: How to check OS version in Linux
$ cat /etc/os-release

# Or by Neofetch
$ neofetch