Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
  • Groups
    • Research Collaboration and Enablement
    • DesignStart
    • Education Hub
    • Innovation
    • Open Source Software and Platforms
  • Forums
    • AI and ML forum
    • Architectures and Processors forum
    • Arm Development Platforms forum
    • Arm Development Studio forum
    • Arm Virtual Hardware forum
    • Automotive forum
    • Compilers and Libraries forum
    • Graphics, Gaming, and VR forum
    • High Performance Computing (HPC) forum
    • Infrastructure Solutions forum
    • Internet of Things (IoT) forum
    • Keil forum
    • Morello Forum
    • Operating Systems forum
    • SoC Design and Simulation forum
    • 中文社区论区
  • Blogs
    • AI and ML blog
    • Announcements
    • Architectures and Processors blog
    • Automotive blog
    • Graphics, Gaming, and VR blog
    • High Performance Computing (HPC) blog
    • Infrastructure Solutions blog
    • Innovation blog
    • Internet of Things (IoT) blog
    • Operating Systems blog
    • Research Articles
    • SoC Design and Simulation blog
    • Tools, Software and IDEs blog
    • 中文社区博客
  • Support
    • Arm Support Services
    • Documentation
    • Downloads
    • Training
    • Arm Approved program
    • Arm Design Reviews
  • Community Help
  • More
  • Cancel
Arm Community blogs
Arm Community blogs
SoC Design and Simulation blog Docker enables Arm Cycle Model Studio on Ubuntu
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI and ML blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded blog

  • Graphics, Gaming, and VR blog

  • High Performance Computing (HPC) blog

  • Infrastructure Solutions blog

  • Internet of Things (IoT) blog

  • Operating Systems blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tags
  • Cycle Model Studio
  • Docker
  • SystemC Cycle Models
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

Docker enables Arm Cycle Model Studio on Ubuntu

Jason Andrews
Jason Andrews
October 23, 2019

Arm Cycle Model Studio (CMS) is a useful tool to create SystemC simulation models from Verilog RTL source code. SystemC models that are created with CMS run well with a variety of simulators and are easy to share with others inside and outside of a company. SystemC models are commonly used for architecture analysis, IP selection, and low-level early software development. The Accellera SystemC reference implementation is easy to build from source and runs on most any operating system.

The Cycle Model Studio Installation Guide calls for Red Hat Enterprise Linux 6.6 or CentOS 6.6. These Linux distributions may be found on some corporate networks, but many people have either upgraded to newer versions or are using a different Linux distribution such as Ubuntu. My current favorite desktop Linux distribution is Ubuntu Budgie, but I frequently try different distributions on various machines. Ubuntu is used for many types of software development and it is common to find scripts targeting Ubuntu for things like package management.

The requirement for Red Hat or CentOS makes it difficult to incorporate CMS into a project which is based on Ubuntu. Docker provides an easy solution to the problem and enables CMS to run on other operating systems, including Windows. For today, let us see how to use Docker to run CMS and create models on an Ubuntu machine.

For this exercise the following steps are demonstrated:

  • Install CMS on an Ubuntu machine.
  • Try a simple example that is provided with CMS (and fail).
  • Create a Docker image with CentOS 6.6.
  • Build the example successfully using the Docker image.

CMS Installation

The CMS installation is easy on Linux, simply download the product from Arm IP Exchange using an Arm Developer account and untar the file.

$ mkdir cms; cd cms
$ tar xzf ~/Downloads/Arm-CycleModel-release-v11_0_4.tgz

Now CMS is ready to use. There is a setup file in the etc/ directory

For Bourne shell source <install-dir>/etc/setup.sh

For C-Shell source <install-dir>/etc/setup.csh

I am using bash so use the .sh file:

$ . ~/cms/etc/setup.sh

Try an example which comes with CMS.

$ cd ; cp -r $CARBON_HOME/examples/twocounter .
$ cd twocounter
$ make

/home/jasand01/cms/makefiles/Makefile.libs:25: *** Makefile.libs: 1 Unsupported Linux64 version - Ubuntu 18.04.2 LTS \n \l.  Stop.

CMS runs this command to determine the Linux distribution:

$ $CARBON_HOME/bin/carbon_rh_release
Unsupported

Clearly, Ubuntu is not a supported OS so it is time to solve the problem with Docker.

Install Docker

The first step is to build a Docker image with a supported operating system. I will use CentOS 6.6 from Docker Hub. Make sure that Docker is installed. For this case Docker Community on Ubuntu is perfect. A Docker ID to access Docker Hub is also recommended to store your images. Visit Docker Hub and create a new account using the “Sign up for Docker Hub” link.

A quick way to install Docker and add your user to the docker group (so sudo is not required on any docker commands) is:

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
$ sudo usermod -aG docker $USER

Create a Dockerfile

Below is a Dockerfile that is used to get the operating system, install extra packages required by CMS, setup a new user account called user1, and to add the CMS setup.sh information to the .bashrc for the new user.

Change the ARMLMD_LICENSE_FILE value to match the port and host of your license server.

FROM centos:6.6
 
RUN echo "root:docker" | chpasswd
 
RUN yum -y groupinstall "Additional Development" "Compatibility Libraries" "Development t
ools" "Perl Support"  && yum clean all
RUN yum -y install gstreamer-plugins-base && yum clean all || true
 
RUN useradd --create-home -s /bin/bash -m user1 -u 1000 && echo "user1:docker" | chpasswd
 
WORKDIR /home/user1
 
USER user1
 
# adjust the path to the CMS install and the license server as needed
RUN echo -e "source $HOME/cms/etc/setup.sh\nexport ARMLMD_LICENSE_FILE=7010@localhost" >> /home/user1/.bashrc

One trick that is used in the Dockerfile is to create the new user account (user1) with the same user id as the host user account. In my case, the user id is 1000. Change this to match your user id obtained from the id command or by running:

$ echo $UID
1000

Build the Docker Image

To create a docker image from the Docker file, run the build:

$ docker build -t jasonrandrews/centos6-cms -f Dockerfile .

I like to tag the image with my Docker ID so I can directly push it to the Docker Hub, but it is not necessary. Replace my ID (jasonrandrews) with yours or just remove it from the tag name.

You should see the image being built and after some time conclude with a success message similar to:

Successfully built 2b8526d5e084
Successfully tagged jasonrandrews/centos6-cms:latest

The image is now created on the local machine. If you want to save it in your account for use in the future or to use it on other machines run:

$ docker push jasonrandrews/centos6-cms

Run the Docker image

To use the new Docker image to run CMS a couple of tricks are used. Since we already have CMS installed on the Ubuntu host (from our first attempt), it can be accessed from the same place using a volume. The same is true for the example we tried to build, it can stay on the host machine and be accessed using a volume.

This is where the matching user id comes in. If you encounter write permission errors from the container to the volume, it means the user id probably does not match. There are other ways around it using chown and chmod, but I found the user id to be the cleanest way.

The FlexLM server is outside of the container so use host networking to find the license server on the local network VIA the ARMLM_LICENSE_FILE environment variable.

The run command is:

$ docker run -it –-rm --network host -v ~/cms:/home/user1/cms -v ~/twocounter:/home/user1/twocounter  jasonrandrews/centos6-cms /bin/bash

A shell will start with the CentOS 6.6 container and I can build the example now. It is also possible to generate a SystemC wrapper for model.

[user1 ~]$ ls
cms  twocounter
[user1 ~]$ cd twocounter/
[user1 twocounter]$ make
/home/user1/cms/bin/cbuild   twocounter.v  -o  libtwocounter.a
        CBUILD, Arm Cycle Model Compiler, Version 11.0.4
 
     All Rights Reserved. Use, disclosure or duplication without
   prior written permission of Arm Inc. is prohibited.
 
Copyright (c) 2002-2019 by Arm Limited (or its affiliates). All Rights Reserved.
 
For technical support send email to support-esl@arm.com
#  1  Elapsed: 0:00:00 Complete:  0%
#  2  Elapsed: 0:00:00 Complete:  0%

<< some output omitted >>

#188  Elapsed: 0:00:01 Complete: 82%
Note 2039: Performing compile...
#189  Elapsed: 0:00:02 Complete: 100%
#189  Elapsed: 0:00:02 Complete: 100%
Note 111: Successfully created libtwocounter.a.
0 warnings, 0 errors, and 0 alerts detected.
env -i LANG=C COMPILER_PATH=/home/user1/cms/Linux64/bin HOME=/home/user1 LD_LIBRARY_PATH=/home/user1/cms/Linux64/gcc/lib64 /home/user1/cms/Linux64/gcc73/bin/gcc -I. -I/home/user1/cms/include    -c  twocounter.c  -I/home/user1/cms/include
env -i LANG=C COMPILER_PATH=/home/user1/cms/Linux64/bin HOME=/home/user1 LD_LIBRARY_PATH=/home/user1/cms/Linux64/gcc/lib64 /home/user1/cms/Linux64/gcc73/bin/g++ -I. -I/home/user1/cms/include -L/home/user1/cms/Linux64/gcc73/lib64 -Wl,-rpath,/home/user1/cms/Linux64/gcc73/lib64    twocounter.o -o twocounter.exe libtwocounter.a -L/home/user1/cms/Linux64/lib -L/home/user1/cms/Linux64/lib/ES6 -L/home/user1/cms/Linux64/lib/gcc7/shared -L/home/user1/cms/Linux64/lib/gcc7 -Wl,-rpath,/home/user1/cms/Linux64/lib -Wl,-rpath,/home/user1/cms/Linux64/lib/ES6 -Wl,-rpath,/home/user1/cms/Linux64/lib/gcc7/shared -Wl,--enable-new-dtags -Wl,-dn -Wl,-dy -lcarbon5        -lnffw -lrt -ldl -lpthread
./twocounter.exe   >   twocounter.out
diff -b twocounter.out twocounter.gold

[user1 twocounter] $ carbon systemCWrapper libtwocounter.io.db Wrote: libtwocounter.gen.ccfg
Wrote: libtwocounter.systemc.cpp
Wrote: libtwocounter.systemc.h

The compiled model files are available on the host machine and can be used in a SystemC simulation project on Ubuntu or another Linux distribution.

Because there is nothing to save in the container, exit and automatically remove the container (with the  --rm flag on the docker run command).

Summary

Cycle Model Studio has limited support for Linux distributions, but Docker is a very easy way to compile models using a container. The compiled models can be used in SystemC simulations running on Ubuntu or most any other 64-bit Linux distribution. Incorporating a Docker container into a modeling project makes it easy for model developers and platform creators to continue to work on the Linux distribution they have, such as Ubuntu, and avoid having to work on multiple machines and copy files back and forth. If you are involved with SystemC simulation for architecture analysis, IP selection, and low-level early software development and have existing RTL IP give Cycle Model Studio a try.

Try Cycle Model Studio

Anonymous
  • Jason Andrews
    Offline Jason Andrews over 3 years ago in reply to ms-user

    Hi, 

    Yes, the same thing can be applied to Fast Models. There are some Docker files for Arm Fast Models and Development Studio at https://github.com/ARM-software/Tool-Solutions/tree/master/docker 

    Look in the arm-tool-base/ and the arm-tool-interactive/ directories. 

    Thanks,

    Jason

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • ms-user
    Offline ms-user over 3 years ago

    Can a similar approach be applied to Fast Model tools?

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
SoC Design and Simulation blog
  • Arm Virtual Platform co-simulation solution accelerates SoC verification

    Daniel Owens
    Daniel Owens
    Avery Design Systems’ co-simulation design verification solution that integrates SystemC-based Arm virtual platforms with a SystemVerilog environment.
    • December 6, 2022
  • IP exchange and Cycle Models end-of-life update

    Gemma Platt
    Gemma Platt
    Arm Cycle Models and Arm IP Exchange are now End-of-Life, understand what this means to you.
    • May 25, 2022
  • Accelerate IP Selection with the New Arm IP Explorer

    Zach Lasiuk
    Zach Lasiuk
    The newly announced Arm IP Explorer platform represents a step-change in efficiency for the IP selection process when defining a custom System on Chip (SoC).
    • May 4, 2022