Don’t worry; Aldec’s Riviera-Pro is not up before Judge Roy Snyder, but is now runnable in a Docker Container. I can already sense some of you thinking, what is Docker, and why would I want to use it?
At FirstEDA, we believe that having the correct methodology is critical to successful design and verification. Whether using statement or functional coverage, having the right verification methodology, be it OSVVM, VUnit, Cocotb or UVM, is crucial in achieving the best out of open-source tools like Jenkins, QEMU or Oracle’s VM VirtualBox. Over the years, we have conducted webinars, and published conference papers, blog posts and technical articles on most of these. So, returning to the question, “What is Docker and why would I want to use it?”:
Docker has emerged as a game-changer in the dynamic software development landscape, revolutionising how applications are built, shipped, and deployed. Like so many tools that our software development colleagues use, we can benefit from them when verifying our RTL designs. Employing Docker allows you to quickly deploy consistent, scalable, and rapidly deployed verification environments using containers that have lower overhead & faster startup times compared to traditional VMs.
If you’re new to the world of containers and wondering what all the buzz is about, you’ve come to the right place. In this blog post we’ll unravel the mysteries of Docker and explore how it can simplify your verification workflow.
What is Docker?
At its core, Docker is a platform for developing, shipping and running applications in ‘containers’. A container is a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, and system tools. Containers ensure your application runs consistently across different environments, whether a developer’s laptop, a testing server, or a production system.
Before we dive into how to use Docker, let’s understand some key concepts:
- Dockerfile: A Dockerfile is a script that contains instructions for building a Docker image. It specifies the base image, the verification tools, and any dependencies or configurations.
- Image: An image is a lightweight, standalone, and executable package that includes everything needed to run your verification flow. It’s a snapshot of a file system and the verification platform and libraries you need to run verification on your design.
- Container: A container is an instance of a Docker image. It encapsulates the verification flow and its dependencies, such as libraries and tools, ensuring consistent and reliable performance across different designs.
With the release of Riviera-PRO 2023.10, Aldec can provide a Dockerfile, which you can use after a small amount of configuration to build your own Riviera-PRO Docker image. Currently, you must email email@example.com or file a support ticket via the Aldec Portal to gain access to the Dockerfile and associated files.
How to Use Docker
Step 1: Install Docker
The first step is to install Docker on your machine. Installation instructions for various operating systems are on the official Docker website (https://docs.docker.com/get-docker/).
Currently, I have only tested this on Linux.
Step 2: Customise the Dockerfile
Aldec supplies two files for setting up Riviera-PRO to run in Docker: The Dockerfile itself and build.sh, which is used to automate the building of the Docker image. We first need to add licensing details to the Dockerfile, so open the Dockerfile in your favourite text editor.
The Dockerfile contains the instructions to build the Docker image, and it starts with the image for Ubuntu 23.04 with the FROM command. It then adds the prerequisites for Riviera-PRO with the RUN command. Next comes the required environment variables with the ENV command and, finally, the Riviera-PRO executables with the COPY command.
Add the ALDEC_LICENSE_FILE environment variable to the ENV section as below:
Ensure the TCP port and IP Address are correct for your network license. Save the edited Dockerfile.
Step 3: Build the Docker Image.
Copy the Riviera-PRO 2023.10 Linux installer to the same folder as the Dockerfile, then run the build script:
source build.sh Riviera-PRO-2023.10.081-Linux64.run
The script will execute and call docker build; this will take a few minutes.
Use the following command to see your available Docker images:
‘aldec/riviera-pro’ is the image that was just created.
Step 4: Run the Docker Container
To use the image, we use the docker run command as below:
docker run –rm -v /$(pwd)://work -w //work aldec/riviera-pro sh -c ‘vsim -c -do runme.do’
- run : Creates and starts the container.
- –rm : Automatically removes the container when it exits.
- -v : bind mount a volume to share a folder between the host and the container. In this example, the current path in the host is used ($(pwd)), and it is bound to /work inside the container.
Note: that both paths must be absolute.
- -w : sets the working directory inside the container, i.e., where the commands we provide as arguments are executed.
- aldec/riviera-pro : We want to create a container from this image.
- sh -c : the command executed when the container is created.
In this case, we run the simulator in console mode with the script runme.do.
Because we bound a local host folder to the container containing our design and verification environment, once the verification run is finished, all the results are left on the local machine, and the container is removed automatically.
While Docker and Virtual machines are both technologies used for virtualisation, they have different architectures and offer distinct advantages. Here are some benefits of Docker over traditional virtual machines:
- Resource Efficiency: Docker shares the host OS kernel, reducing overhead.
- Performance: Containers have lower overhead & faster startup times.
- Isolation: Containers use namespaces and control groups for isolation.
- Portability: Docker ensures consistent application performance across environments.
- Scalability: Easy to scale horizontally by creating multiple containers.
- Versioning and Rollback: Docker images can be versioned for easy rollbacks.
- Ecosystem and Community: Large Docker community with a vast ecosystem.
- Regression Integration: Well-suited for CI/CD pipelines and regression environments.
- Reduced Maintenance Overhead: Docker containers are lightweight and easier to maintain.
- Faster Deployment: Deployment with Docker is typically faster compared to VMs.
In this brief guide, we’ve only scratched the surface of what Docker can do. As you continue your Docker journey, you’ll discover more advanced features, such as Docker Compose for managing multi-container applications, Docker Swarm for orchestration, and more.
Hopefully, you found this information valuable and helpful, and to paraphrase Judge Roy Snyder, “Engineers will be Engineers”.