Vision and Security Technology Lab
Home Projects
People/Photos
Projects Quick Links
Adaptive High Dynamic Range Imaging C2FUSE INSPECCT GPS-Based Tracking System for Trauma Patients Intelligent Imaging System NCIIA Network Security NSF Privacy ONR FAMME Privacy Enhanced Camera Projective Biometric Invariants Revocable Biometrics with Robust Distance Metrics SEE Port Semquest NEATR Trauma-Net UAV Underwater Imaging
People Quick Links
Mary (Joy) Aquino David Bacon Abhijit Bendale Terrance Boult Benjamin Cable Patrick Caldwell Ankur Chattopadhyay Jonathan Dugan Chris Eberle Christopher Gilbert Dennis Ippoliti R.C. Johnson Erica Kirkbride Shane Kirkbride Andrew Kurfess Palden Lama Josh Lawson Edith Leung Miguel Lezcano Mackenzie Lowrance Anthony Magee Andrew Purkett Kyle Roucis Walter Scheirer Justin Schiff Daniel Szarkowski Kim Tran Benjamin Wood
Contact Us
Job Openings
Search
Vision and Security Technology Lab

VPI Simulation With ModelSim On Windows

These instructions should work similar for any UNIX version of ModelSim, just change the paths and parameters from "Windows" style to "UNIX" style. I do not have a UNIX version of ModelSim available for testing.

Requirements

  • ModelSim PE or ModelSim Xilinx edition (Free limited download)
  • OpenCV Library
    The paths below are derived from the windows installer default install paths of OpenCV version 1.0
  • C/C++ compiler
    ModelSim claims support for MinGW (gcc) and Microsoft Visual C++ 4.1 or greater. ModelSim has stated that Cygwin GCC will not work.
I successfully used MinGW. http://www.mingw.org/ an OpenSource distribution of gcc (GNU Compiler Collection)

Command Line Building the Sensor and Display libraries

The OpenCV runtime dll's will need to be available. I found the easiest method, is to copy all the runtime dll's to the working directory.

These consist of:

cv100.dll, cvcam100.dll, cxts001.dll, highgui100.dll, ml100.dll, cvaux100.dll, cxcore100.dll

The .dll's can be found in the OpenCV directory C:\Program Files\OpenCV\bin

The OpenCV headers will also be needed, however, those can either be copied or referenced with a compiler include directive. The command-line below references the include files as if OpenCV is installed in C:\Program Files\OpenCV

The ModelSim VPI header is also included from the ModelSim installation directory. Change paths as necessary in the command line below.

Compile the sensor module

  • g++ -c -o imageSensor.o imageSensor.cpp -Ic:/Program\ Files/OpenCV/cv/include -Ic:/Program\ Files/OpenCV/cxcore/include -Ic:/Program\ Files/OpenCV/otherlibs/highgui -Ic:/Modeltech_xe_starter/include

Link the sensor module

The ModelSim VPI library must be linked into our VPI module as well as the OpenCV libraries. The ModelSim library mtipli will be referenced from its install location while the OpenCV libraries have been copied into the working directory.
  • g++ -shared -o imageSensor.dll imageSensor.o -L. -Lc:/Modeltech_xe_starter/win32xoem -lcxcore100 -lhighgui100 -lcv100 -lmtipli

Compile and link the display module

g++ -c -o imageDisplay.o imageDisplay.cpp -Ic:/Program\ Files/OpenCV/cv/include -Ic:/Program\ Files/OpenCV/cxcore/include -Ic:/Program\ Files/OpenCV/otherlibs/highgui -Ic:/Modeltech_xe_starter/include
g++ -shared -o imageDisplay.dll imageSensor.o -L. -Lc:/Modeltech_xe_starter/win32xoem -lcxcore100 -lhighgui100 -lcv100 -lmtipli

Command Line Simulation with ModelSim

  1. Create the Verilog library
    vlib work

  2. Compile the Verilog files
    vlog sensor.v
    vlog top.v

  3. Run a simulation
    You must find an image file and place it in the working directory as "image.jpg". (The file path is set as a parameter in the top.v file)

    vsim -c -pli imageSensor.dll -pli imageDisplay.dll testbench

After a brief period of time, a window should appear on the screen and your image should appear. Depending upon the speed of the simulation machine and size of the image, it may take several seconds to even a minute. Its best to try this first on a small image <= 640x480. On an 1.6GHz machine with a 640x480 input image, it will take around 20sec.

ModelSim GUI

Create a project with sensor.v and top.v as you usually would with any other Verilog project. When you get ready to generate a simulation, open the "Simulation Properties" dialog and select the "Others" tab. In the "Other Vsim Options" box enter: "-pli sensor.dll -pli display.dll"

Run the simulation and you should see a window with your image file appearing after a bit of simulation running. Using the "wave" window, you should be able to trace the signals and see the VACT, HACT and pixel data "D" for your image file.

UCCS Content Approval Seal
© Copyright 2003-2006 V.A.S.T. Laboratory
At the University of Colorado at Colorado Springs
The Vast lab is deeply involved in the new Bachelor of InnovationTM degree at UCCS, and actively working with many local companies.