Posted on

Setting up virtual CPU environment on Windows

This is a short howto to get a Linux specific Virtual Chip running on a Windows OS:

  1. Download and install the Docker Toolbox
  2. Download and install the Xming X-Server
  3. Download MaSoCist docker container
  4. Run ‘Docker Quickstart terminal’, normally installed on your desktop. Be patient, the environment takes some time to start up
  5. Run the command below to import the container tgz
    docker import masocist-$VERSION.tgz masocist-test

    (Substitute $VERSION by the file version you’ve obtained via the Download)

  6. Prepare the Xming server by running XLaunch and configuring as follows using the Wizard:
    • Multiple Windows
    • Start no client
    • No access control selected (Warning, this could cause security issues, depending on your system config)
  7. Start the container using the script below
docker run -ti --rm -u test -w /home/test/src -e DISPLAY=192.168.99.1:0 -v /tmp/.X11-unix:/tmp/.X11-unix masocist-test bash

You might save this script to a file like run.sh and start it next time from the Docker Quickstart terminal:

. run.sh

Once the container is started, you’ll be in the /home/test/src directory. To run the simulation, enter the sim/ subdirectory:

cd masocist-$VERSION/sim

and type

make run

If all went well, you’ll see the GTKwave windows popping up. If the display is not showing and an error appears on the console, you might have a different IP address configured for your docker system.

A few more notes:

  • All changes you will make to this docker container are void on exit. If this is not desired, remove the ‘–rm’ option and use the ‘docker ps -a’ and ‘docker start -i <container_id>’ commands to reenter your container. Consult the Docker documentation for details.
  • Closing the GTKwave window will not stop the simulation!
  • Ctrl-C on the console stops the simulation, but does not close the wave window
  • The UART output of the virtual SoC is printed on the console (“Hello!”). Virtual UART input is not supported on this system, but can be implemented using tools supporting virtual COM ports and Windows pipes.
  • Once you have the Docker container imported, you can alternatively use the Kitematic GUI and apply the above options, in particular:
    • -v: Volume mounts to /tmp/.X11-unix
    • -e: DISPLAY environment setting