Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Questa Docker Container Example

Table of Contents

1. Build

Build Image
docker build --build-arg USER=$USER --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t questa .

Build args:

  • USER - Sets the username for the container. Set per license server requirements.

  • UID - The host user ID. Used to sync the uid of the host and container.

  • GID - The host group ID. Used to sync the gid of the host and container.

2. Run

Run
docker run -it -v $PWD:/src -w /src -u $(id -u):$(id -g) -e MGLS_LICENSE_FILE --hostname $HOSTNAME --dns-search $DOMAIN questa <command>

Options:

  • -it - Run interactively

  • -v $PWD:/src - Mount the host $PWD inside the container at /src

  • -w /src - Set the container working directory to /src

  • -u $(id -u):$(id -g) - Set the container uid/gid to that of the host uid/gid. Necessary for witing files with proper file ownership from the container to the shared volume.

  • -e MGLS_LICENSE_FILE - Pass the MGLS_LICENSE_FILE environment variable into the container. This environment variable defines the license servers for Questa.

  • --hostname $HOSTNAME - Set the hostname of the container. Set per license server requirements.

  • --dns-search $DOMAIN - Allows the license servers and other non-FQDN to be found on the domain (e.g. example.com).

Parameters:

  • <command> - The shell command to run inside the container.

Example:

Run example
docker run -it -v $PWD:/src -w /src -u $(id -u):$(id -g) -e MGLS_LICENSE_FILE --hostname $HOSTNAME --dns-search $DOMAIN questa qrun -quiet hello_world.v
Example output
QuestaSim-64 qrun 2020.4_2 Utility 2020.12 Dec  5 2020
Start time: 01:28:10 on Mar 20,2021
qrun -quiet hello_world.v
Creating library 'qrun.out/work'.
** Warning: setting ADDR_NO_RANDOMIZE failed - Operation not permitted.
Reading pref.tcl

# 2020.4_2

# vsim -quiet -lib qrun.out/work -c -do "run -all; quit -f" -statslog qrun.out/stats_log qrun_opt -appendlog -l qrun.log
# Start time: 01:28:14 on Mar 20,2021
# //  Questa Sim-64
# //  Version 2020.4_2 linux_x86_64 Dec  5 2020
# //
# //  Copyright 1991-2020 Mentor Graphics Corporation
# //  All Rights Reserved.
# //
# //  QuestaSim and its associated documentation contain trade
# //  secrets and commercial or financial information that are the property of
# //  Mentor Graphics Corporation and are privileged, confidential,
# //  and exempt from disclosure under the Freedom of Information Act,
# //  5 U.S.C. Section 552. Furthermore, this information
# //  is prohibited from disclosure under the Trade Secrets Act,
# //  18 U.S.C. Section 1905.
# //
# ** Warning: License feature 'msimhdlsim' will expire in 5 days.
# run -all
# hello world
#  quit -f
# End time: 01:28:35 on Mar 20,2021, Elapsed time: 0:00:21
# Errors: 0, Warnings: 0
# *** Summary *********************************************
#     qrun: Errors:   0, Warnings:   0
#     vsim: Errors:   0, Warnings:   0
#   Totals: Errors:   0, Warnings:   0

3. Docker Compose

A Docker Compose file is also provided to simplify the above.

Set environment
export MGLS_LICENSE_FILE=...
export USER=...
export HOSTNAME=...
export DOMAIN=...
export UID=$(id -u)
export GID=$(id -g)
Run
docker-compose run questa qrun -quiet hello_world.v