README.md

    Collection of SystemVerilog exercises for the School of Digital Circuit Synthesis

    Русский

    Not a day without a line in Verilog

    Collection of tasks of increasing complexity

    Yuri Panchul, 2021-2024

    Links

    Installation instructions

    The tasks can be solved with any Verilog simulator that supports SystemVerilog. And also with the free Icarus Verilog simulator, which, although it does not support all of SystemVerilog, does support Verilog 2005 with some SystemVerilog elements, sufficient for solving our tasks. Icarus Verilog is used with GTKWave, a program for working with timing diagrams. We will not need GTKWave for the first ten tasks, but it is worth installing it together with Icarus Verilog for the future.

    Installation on Linux

    Under Ubuntu and Debain based Linux you can install Icarus Verilog and GTKWave with the command:

    sudo apt-get install verilog gtkwave


    Note:

    If you have an old version of Linux distribution (Ubuntu), then when you install Icarus Verilog you will get an old version that does not support always_comb, always_ff and many other SystemVerilog constructs. How to solve this problem:

    1. Checking iverilog version

      iverilog -v
      

      If the iverilog version is less than 11, go to point 3.

    2. Installation of preliminary packages

      sudo apt-get install build-essential bison flex gperf readline-common libncurses5-dev nmon autoconf
      
    3. Download the latest version of iverilog

      To date (8.25.2024) the latest version of Iverilog: 12.0 Go here and download the archive.

    4. Assembly iverilog

      • Extract the archive:

        tar -xzf verilog-12.0.tar.gz
        
      • Enter into the verilog folder:

        cd verilog-12.0
        
      • Configure iverilog:

        ./configure --prefix=/usr
        
      • Run the make checks

        make check
        

        As a result, several inscriptions of HELLO, World! Will appear in the terminal

      • Install icarus

        sudo make install
        

    Verilator

    Additionally, to check the code for some syntactic and stylistic errors, you can install Verilator (version 5.002+).

    For Ubuntu 23.04 and above:

    sudo apt-get install verilator

    For earlier versions of Ubuntu or other distributions, you can install Verilator along with OSS CAD Suite.

    If using OSS CAD SUITE, for setting the environment, it is recommended to use export PATH="<extracted_location>/oss-cad-suite/bin:$PATH" instead of source <extracted_location>/oss-cad-suite/environment, because latter requires additional unset VERILATOR_ROOT command.

    To perform the check, add the --lint or -l option to the script: ./run_linux_mac.sh --lint

    The result will be written to lint.txt


    Installation on Windows

    The Icarus Verilog version for Windows can be downloaded from this site

    Video Instructions for the installation of icarus verilog on Windows

    Installation on Apple Mac

    Icarus can even be put on Apple Mac, which is unusual for EDA tools (EDA - Electronic Design Automation). This can be done in the console using the Brew:

    brew install icarus-verilog

    Video Instructions for the installation of icarus verilog on macos

    Execution and checking tasks

    To check the tasks for Linux and MacOS, you need to open the console in the folder and start the script ./run_linux_mac.sh. It will create a file log.txt with the results of compilation and simulation of all set tasks.

    To check the tasks for Windows, you need to open the console in the task folder and run the bat file run_windows.bat. This will also create a file log.txt with the results of the check.

    After the test for all tasks will show PASS.

    GTKWave alternative

    Instead of GTKWave you can use cross-platform waveform viewer Surfer.

    It looks much nicer on modern screens (and especially on Wayland), works faster and you can even try it out in your web browser without installing.

    Surfer

    Recommended literature that will help in solving problems

    1. Harris D.M., Harris S.L., “Digital circuitry and computer architecture: RISC-V”. There is a version for a tablet for a previous edition (based on MIPS architecture), but there are shorter slides for lectures.

    2. Романов А.Ю., Панчул Ю.В. и коллектив авторов. «Цифровой синтез. Практический курс»

    Конвейеры
    0 успешных
    0 с ошибкой