7.9 Foreign Image Formats Including QEMU and VMware 8 Instrumentation
Simics User's Guide  /  II Feature Overview  /  7 Moving Data in and out of the Simulation  / 

7.10 Serial Links

7.10.1 Serial Link Component

Connecting simulated machines over a simulated serial connection is done by creating a ser-link component that connects to the serial devices in the machines. The link object can be thought of as modeling a serial cable that is plugged into the connectors on the devices—and just like a real cable, it is a point-to-point connection that connects exactly two devices.

The link object models serial communication at the character level in a simplified way. The bandwidth for the connection is configured in the link object, which means that the serial devices do not need to be explicitly configured by software.

New ser-link components can be added with the new-ser-link command:

 
simics> load-module ser-link
simics> new-ser-link
Created instantiated 'ser_link' component 'serial_link0'

Serial connectors of other components can then connect to that link. The serial link has two connectors, device0 and device1, representing the two endpoints of the cable. For an QSP-x86 machine, the second UART can be connected to the link the following way:

 
simics> connect serial_link0.device0 board.mb.sb.serial[2]

7.10.1.1 Text and Telnet Consoles

In addition to simulated serial devices, either endpoint of a serial link can be hooked up to a text console. (And just as with serial devices, you have the option of connecting the two endpoints directly without having a link in between—though this is generally much more useful with consoles.)

A text console can open GUI windows on the host computer, and let the user talk to the connected serial device. The text console also has the ability to start a telnet server; the user can then use any telnet program to connect to this server, and talk to the connected serial device.

You create text consoles by instantiating txt_console_comp components, and connecting them to the link or device you want them to talk to, as in the following example:

 
simics> new-txt-console-comp con visible=TRUE
simics> connect con.serial board.mb.sb.serial[2]

7.10.2 Host Serial Console

The text consoles also have the ability to open host serial connections. This is a way of connecting a terminal application through a serial port on the host machine to a serial device object in Simics. The procedure is almost identical in both Linux and Windows. The following examples show how to open host serial connections on a QSP-x86 machine, first in Linux:

simics> board.serconsole.con.host-serial-setup pty = /dev/pts/1
[board.serconsole.con info] Device opened: /dev/pts/1

And the same procedure in Windows:

simics> board.serconsole.con.host-serial-setup pty = COM1
[board.serconsole.con info] Opened: COM1

The host serial connection will operate at the baud rate and other attributes that are set for the physical serial port of the host. In Linux these host settings are edited with stty. In Windows these settings must be edited from a Command Prompt, this is an example:

C:\> mode com1: baud=4800 parity=n data=8 stop=1

It is also possible to open a host serial connection to a virtual serial port. In Linux this is called pseudo-terminal or pseudo-device. If there is no parameter specified to host-serial-setup, any free pts is opened.

However, in Windows a virtual serial port must have been created in advance. There exist several Windows third-party utilities which create virtual serial port pairs for various purposes. In the following example, first such a pair has been created with the port names COM98 and COM99, then a host serial connection can be opened to port 98, and finally the terminal application can connect to port 99 and the two can communicate over the pair:

simics> board.serconsole.con.host-serial-setup pty = COM98
[board.serconsole.con info] Opened: COM98

7.10.2.1 Using host serial connections with Windows HyperTerminal

Once the host serial connection has been configured within Simics it is possible to connect to it using a standard terminal program running on your host system. In this section we will use the HyperTerminal application, which comes bundled with some Windows versions, to connect to the simulated system.

First launch HyperTerminal from Start Menu → All Programs → Accessories → Communications → HyperTerminal. The dialog Connection Description will appear, as shown in Figure 2. Name the Connection "Simics" and press OK. In the next dialog, select the COM-port that Simics has opened in the field Connect using. In the next dialog, just accept the default settings and press OK.

Figure 2. Connecting to Simics using the Windows HyperTerminal

Now, resume the simulation in Simics. The output from the simulated serial console will appear in the HyperTerminal window. See figure 3.

Figure 3. HyperTerminal connected to a simulation

7.9 Foreign Image Formats Including QEMU and VMware 8 Instrumentation