Modelsim SE Socket & FLI Demo
Demo showing Modelsim communicating with an X-Display
Last Updated: 30-July-2003
Quick Windows demo setup
- Download the latest zip file from here (553KB), unzip, install
- If not installed, install Cygwin/Xfree86
- Execute /fern/fli_Cygwin/xdisp/dispfern.exe 2000 in a Cygwin/Xfree86 terminal
- Invoke HDL_Designer, select fern_tb, simulate, enter hostname (your computer network name) and port address 2000
- Alternatively, change directory to fli_dos and execute run.bat in a DOS box
- run modelsim for say 3 ms, observe Fern
Quick Cygwin demo setup
- Download the latest zip file from here (553KB), unzip, install
- If not installed, install Cygwin/Xfree86
- Execute /fern/fli_Cygwin/xdisp/dispfern.exe 2000 in a Cygwin/Xfree86 terminal
- Invoke HDL_Designer, select fern_tb, simulate, enter hostname (your computer network name) and port address 2000
- Alternatively, change directory to fli_gcc and execute run.bat in a Cygwin shell
- run modelsim for say 3 ms, observe Fern
Quick Linux demo setup
- Download the latest zip file from here (553KB), unzip, install
- If not installed, install the Imlib graphics library (available on your installation CDs)
- Execute /fern/fli_linux_rh8/xdisp/dispfern.bin (you might have to chmod +x it)
- Invoke HDL_Designer, select fern_tb, simulate, enter hostname (your computer network name) and port address 2000
- Alternatively, invoke Modelsim, change directory to work_mti, run compile.do and run.do
- run for say 3 ms, observe Fern
Introduction
This page describes a simple demo of a Fractal generator in VHDL which transmits its generated coordinates real-time using FLI-sockets to an X-Display driver running under Cygwin or Linux. For this demo you need Modelsim SE (not PE or any of the OEM versions like XE, AE), HDL_Designer is optional. The X-Display driver and Modelsim FLI interface are written in standard C. I use Microsoft Visual C/C++ 6.0 on windows and GNU gcc 3.x under Linux (Redhat 8.0)/Cygwin. The fern generator is written in synthesisable VHDL.
Tools used
- Modelsim 5.7e SE, note the PE version can not be used for this demo because the FLI (Modelsim C/C++ Interface) is used.
- HDL_Designer 2003a, this is optional, you can run the demo using Modelsim only
- Microsoft Visual C/C++ 6.0 or Cygwin gcc if you want to modify the source files under windows.
- GNU gcc 3.2 if you want to modify the source files under Linux.
- Cygwin/XFree86 for running the X-Display program under windows
- Cygwin/Imlib, graphical library for Cygwin which can be freely downloaded from the web
- Imlib for Linux (Redhat in this case) is available on the installation disks.
Unfortunately there are no static libraries available for X and Imlib, thus the only way to run the display program under windows is to install Cygwin/XFree86
Setting up Cygwin
The output of Modelsim is directed via a TCP socket to a X-Display program called dispfern. This program can run under Linux or Cygwin and uses the standard X and Imlib library. The later one is not installed when you install Xfree86 under Cygwin. On Linux Imlib is normally installed when you select the development libraries during installation.
- If you don't have Cygwin and Xfree86 installed on your PC you can get it from here.
- After installing Cygwin and Xfree86 you might want to change from full screen resolution mode to windowed mode. This is easily done my modifying the startxwin.bat files which is located in <INSTALLATION_DIRECTORY>\cygwin\usr\X11R6\bin\startxwin.bat
- Open up the file with a text editor and change the line start Xwin to start Xwin -screen 0 800 600 to get a 800*600 size window.
- Optionally download and install the Imlib
library (imlib-1.9.10-cygwin-shared-bin.tar.gz) from
here.
The download file contains the Imlib.dll
file which is all you need to run dispfern
General Setup
For the sockets to work you obviously need to have TCP/IP protocol installed.
- Make sure you can ping your computer using your computer network name
or IP address.
The computer name can be obtained by issuing the uname
-n command in Cygwin

- Download the fern design files and unzip them to a suitable directory.
Open up HDL_Designer and select the fern.hdp
project file.
Running the Demo
- For Cygwin/Xfree86, open up an XTerm and browse to the fern/fli_dos/xdisp directory. For Linux the dispfern.bin is located in the fern/fli_linux_rh8/xdisp directory.
- Execute the dispfern program
example Cygwin: ./dispfern.exe 2000
example
Linux: ./dispfern.bin
Note for Linux the TCP port number is hardcoded to 2000, also you might
need to do a chmod +x on the file
to make it executable
The server (dispfern) needs to run before the client
(Modelsim).
- Invoke HDL_Designer and simulate the fern_tb testbench, alternatively run the compile.do and run.do file from the modelsim transcript window.
- During Elaboration Modelsim will ask for the hostname and TCP port number. For the hostname type in your computer name or IP address. The port number should be the same as given to dispfern (2000 in this example).
- Run for 3 ms, a reasonable looking fern (rtl version) will appear after a few seconds of simulation, this on an ancient 866MHz laptop :).
- If you are connected to a network, try running dispfern on another machine :-)

