Modelsim SE UART-Socket FLI Demo

Last Updated: 14-Sep-2003

 

 

This page contains a simple example of a UART connected via the FLI interface to an external terminal. Characters transmitted to and received from the terminal will be re-directed to the UART.  For this demo the UART is connected in loopback mode (TX connected to RX) so that any characters typed in on the terminal will be echoed back.

The socket interface code is very generic and can easily be adopted for other TCL communication purposes like connecting Matlab to Modelsim or connecting 2 Modelsim simulators.

Download Demo Files

Software used

Running the Demo

Note: HDL_Designer users, compile the FLI C course as described above but copy the uart_test.so to Modelsim's work directory instead.
Note: you may want to use the -wlfslim vsim argument if you are running long simulation (see Modelsim's Command Reference manual).
 

FLI Code

To look at the source code in HTML click here. If you compile the code for Windows use #define WIN32 otherwise comment it out. You might also want to comment out the #define ASK_SERVER_NAME line and fill in your server name and port number as shown in the example below.

//#define ASK_SERVER_NAME

#ifndef ASK_SERVER_NAME
    #define PORTNUMBER  2000
    #define SERVERNAME  "achilles"
#endif

The receiver (Terminal to UART) contains a simple FIFO. You can set the FIFO depth using the #define MAXBUFFER variable.