Skip to content

NickolayTernovoy/SystemVerilog-DigitalDesign-tasks

Repository files navigation

Digital Design Tasks and Modules

This repository contains a collection of tasks and modules related to computer arithmetic, digital design, and implementations inspired by various textbooks, courses, and scientific papers.


Features

  • Testing:
    • Supports SystemVerilog-based testbenches.
    • Supports Python-based cocotb testbenches for flexible and reusable testing.
  • Simulators:
    • Successfully tested with Icarus Verilog 12.0 and Verilator 5.030.

Modules Structure

  • hdl/: Contains the hardware description files:
    • Solution file: A completed implementation of the described task.
    • Empty template file: Includes I/O definitions for custom logic implementation.
      • To test your custom implementation, replace the top module for the DUT in the testbench and run tests from the tb folder.
  • tb/: Contains testbenches for verifying designs.
  • venv_cocotb/: Virtual environment folder (auto-generated by Python).
    • Includes scripts, installed libraries, and configuration files for the virtual environment.

How to Use

Running Tests

  1. Navigate to the folder of the module you are interested in.
  2. To run tests, go to the tb folder and execute the appropriate testing command.

Setting Up a Python Virtual Environment

Follow these steps to set up and activate a Python virtual environment for the project:

  1. Ensure Python is installed: Verify Python 3 installation with:

    python3 --version
    

    If not installed, download it from python.org.

  2. Create a Virtual Environment: Run the following command in the root directory of your project:

    python3 -m venv venv_cocotb
    
  3. Activate the Virtual Environment: Use the following command to activate the virtual environment:

    source venv_cocotb/bin/activate
    

    Once activated, the terminal prompt will display (venv_cocotb).

  4. Install Dependencies: With the virtual environment activated, install the required Python libraries from the requirements.txt file:

    pip install -r requirements.txt
    
  5. To deactivate the virtual environment, simply run:

    deactivate
    
  6. Fixing Issues with the Virtual Environment: If you encounter issues with the virtual environment (e.g., incorrect Python version or broken configuration):

  • Delete the venv_cocotb folder:
    rm -rf venv_cocotb
    
  • Repeat the steps above to recreate and configure the virtual environment.

Testing Using Cocotb

Cocotb Test with Icarus Verilog

  1. Install Dependencies:

    • Icarus Verilog:
      sudo apt install iverilog  # For Linux
      brew install icarus-verilog  # For macOS
      
  2. Run the Test: In the tb folder, execute:

    make SIM=icarus
    

Cocotb Test with Verilator

  1. Install Verilator:

    sudo apt install verilator  # For Linux
    brew install verilator      # For macOS
    
  2. Run the Test: In the tb folder, execute:

    make SIM=verilator
    

Notes

  • Always activate the virtual environment before running tests or project-related Python commands.
  • Modify the tb folder's testbench as needed to use custom DUT implementations from the hdl folder.

System Requirements

Non-Python Dependencies

  • iverilog: Version 12.0 or higher. Install via:

    • macOS:
      brew install icarus-verilog
      
    • Linux:
      sudo apt install iverilog
      
  • verilator: Version 5.030 or higher. Install via:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published