With Simics, it is easy to automate target configuration tasks that are time con- suming and require extensive manual intervention in the physical world. Both FIGURE 4.8
System panel for a physics simulator and control computer.
125 Automating Target Configuration and Boot
inputs to the target software and actions on the target hardware can be turned into Simics scripts and repeated any number of times, and they can be parameterized as well. Using a full script language makes it possible to create very flexible and smart configuration systems.
Automated target configuration in Simics covers both the hardware and soft- ware components of the target system, using settings for configuration variables and custom actions. Each time the script is run, the same target system setup is created, which makes it easy to recreate a particular setup over and over again in virtually no time at all.
Booting a system to a useful prompt often involves setting various para- meters on the boot prompt, as well as logging in with a username and password. With Simics, such tasks are automated using scripts that wait for prompts to appear and then supply the requisite responses. The scripts are typically parameterized to allow other scripts and the user to control aspects of the system boot, such as changing the disk images, login names, and password used.
FIGURE 4.9
System panels as hierarchical components.
Target boot-up scripts are also used to vary the configuration of a target sys- tem automatically. For example, a script that boots up VxWorks on Simics can intercept the VxWorks boot ROM prompt and use its configuration commands to set the network addresses of the target system. In this way, a single boot ROM and OS image can be used, with its networking parameters set when the target system is booted.
REAL-WORLD STORY: ONE OS IMAGE PER MAC
Sometimes, software is not very cooperative in the quest for flexible configuration. Software built to run on real systems does not necessarily include easy ways to change things like network addresses or hardware MACs—after all, that is a very dangerous operation in a real system. In many cases, this can be fixed with post-boot scripts doingifconfigon a system. However, if there is no simple way to fix it, the only solution is to use brute force. One example of this was an early RTOS configuration for a model of the PPC440-based Ebony development board. The Ebony BSP was really just an example intended to get a customer going, and it made some simplifying assumptions, including using a MAC address hard-coded in the compiled code.
Because we needed to run more than one Ebony instance at a time, there was only one solution:
compile a set of OS images, each with a different hard-coded MAC and IP address.
The startup scripts would track how many Ebony instances had been created and use a new OS image for each successive start until we ran out of images. We ended up using five different images, which was sufficient to prove what we wanted to prove—namely, that we could run interestingly large networks in Simics using the PPC440 and the RTOS of interest.
Simics scripts can also automate the creation of networks of machines, including mixed networks and racks. In some cases, a script will list the precise set of machines to be created, while in other cases variables guide the number of machines to create. Most Simics target systems come with a “multi” script that creates several identical machines, except that each machine has its own Ethernet MAC address and IP address generated. The code in the script simply generates a new address for each successive machine, usually just by adding 1 to the address of the previous machine. More complex cases can involve auto- matically building setups containing multiple networks and multiple types of machines to fit certain test scenarios.
REAL-WORLD STORY: NETWORK EDUCATION USING SIMICS
Wind River Education Services provides user training for a variety of topics, including Wind River operating systems and tools, as well as more general topics like networking. Training always includes hands-on labs, which can complicate logistics for training sessions. Shipping boards and configuring networks is time consuming and error-prone. It is also not feasible to build network lab setups for every student, because even a small network involves five or more pieces of hardware plus cables to connect them (Guenzel, 2013). One such setup per class might be possible, but it would be hard to maintain its reliability as it was moved around. Simics offers a very nice alternative, and Wind River Education Services uses some generator scripts that take parameters for the type of network to build, and then generates a setup with multiple networks and machines of different types.
127 Automating Target Configuration and Boot
One example, shown in the illustration , has four router machines all running VxWorks, alongside four “node” machines that communicate via the routers. The node machines use both Wind River Linux and VxWorks as their operating systems.
Simics VxWorks
Router 7
VxWorks
Router 5 VxWorks
Router 6
VxWorks
Router 4
VxWorks
Target 0
VxWorks
Target 1
Simulated Ethernet links WR Linux
Target 2
WR Linux
Target 3
Wireshark probes
An example setup of multiple networks and machines of different types.
It is worth noting that all the network interfaces in this setup need to have appropriate IP addresses set, and that this is really hard to do manually but very simple for the generation script.
For more details on this Simics use, see Guenzel (2013).
CHAPTER
5
Networking
The network is the computer.
—John Gage, Sun Microsystems, 1984
Network simulation is an integral part of Simics, and many Simics target systems are networked in one way or another. Simics is used in the real world to simulate very large networks of systems, scaling up to several thousand target processors spread across dozens or even hundreds of networked boards.
Networks are used in Simics target systems in many different ways. The sim- plest case is a single computer board that is connected to the outside world via an Ethernet link. There are target systems that just combine a few separate compu- ters over Ethernet to model a small office network. Scaling up, target systems can be racks where a sophisticated backplane containing tens of separate network links connect ten or more boards into a single system. Networks are often built into hierarchies where systems with internal networks (e.g., a rack) are connected to other systems over long-distance links. Simics models and simulates even these systems. Simics has been used to model a range of different networks, including Ethernet, serial, I2C, MIL-STD-1553, ARINC 429, Packet-over-Sonet (POS), Asynchronous Transfer Mode (ATM), and Controller Area Network (CAN).