Understanding Caravel’s simulation environment

An in-depth look at the dockerized, cocotb-Based simulation framework

In ASIC design, functional simulation is vital for ensuring your logic behaves as expected. Caravel’s simulation environment makes this process straightforward by leveraging cocotb, a powerful Python-based framework, and a Dockerized setup that guarantees consistency across different systems. This article will guide you through the essentials of using Caravel’s simulation environment to validate your designs effectively.

What is Caravel’s Simulation Environment?

Caravel’s simulation environment is designed to streamline the process of validating ASIC designs. It leverages cocotb, a Python-based framework that allows you to write test benches in Python, making it more flexible and powerful than traditional Verilog-based methods. This setup enables you to easily simulate your design, generate stimuli, and validate outputs using Python’s extensive libraries.

To ensure consistency and ease of use across different systems, Efabless utilizes Docker, which packages all the necessary tools and dependencies into a portable container. This means you can run the simulation environment reliably on any system without worrying about setup issues or version conflicts. Together, cocotb and Docker make Caravel’s simulation environment both powerful and user-friendly, providing everything you need to verify your designs effectively.

Setting Up the Caravel Simulation Environment

Getting started with Caravel’s simulation environment involves a few essential prerequisites and straightforward commands. Follow these steps to set up and begin simulating your designs:

Prerequisites: Before you start, make sure you have Docker and pip installed on your system:

  • Docker: Install Docker from the official Docker website, which is available for Windows, macOS, and Linux.
  • pip: Ensure that pip, Python’s package installer, is also installed.

(Recommended) Setup with Makefile

If you’re working within the Caravel user project, you can simplify the setup process by running the following command:

make setup

This command automates the setup process, configuring your environment and ensuring everything is ready for simulation.

Setup manually

  1. Install the Caravel cocotb Package: With pip installed, the first step is to install the Caravel cocotb package. This package includes the necessary tools and scripts for running simulations within Caravel:

    pip install caravel-cocotb
  2. Set Up Your Project Environment: Next, you need to run the setup script to configure your project environment. This script will set up the necessary paths and prepare your simulation environment:
    python3 <project_root>/verilog/dv/setup-cocotb.py <caravel root> <mgmt_core root> <PDK root> <PDK varient> <project root>
    Make sure that you have the Caravel, management SoC, and PDK repositories properly set up, as these are required for the simulation environment.
  3. Pull the Caravel Docker Image: After setting up the environment, pull the Docker image that contains the Caravel simulation tools:
    docker pull efabless/dv:cocotb
    This image includes all the necessary tools, libraries, and dependencies for your simulation tasks.