Golf Games and Computer Simulations

golf.pngIn my work at Virtutech trying to explain Simics and its simulation philosophy, it is often a struggle to get people to accept that what seems like pretty brutal simplifications of the world actually work quite nicely. Recently, I found a nice analogy in a golf game/simulator. The type where you swing a real club and send a real golf ball through the air.
First, I think I need to explain what Simics is. Virtutech Simics is a computer system simulation tool that models the hardware of an electronic computer-based system in sufficient detail that you can run the same software on it as you would on the real-world system. The simplest explanation is that it is “virtual hardware”. You can also get philosophical and point to the fact that software and hardware are both turing-complete, and therefore any hardware can be replicated by software and vice versa.

For this discussion, the most important property of Simics is that it strives to be as fast as possible in executing the software. This requires Simics to make some simplifications in its model of the physical hardware, since that is the only way to speed up the simulation. Fundamentally, the more detail you have in a simulator, the slower it is going to evolve the state of the world (run the software in our case). gt

Usually, computer system simulators aim at reproducing the actual behavior of the computer hardware at a great level of detail. The design goal is to be able to reproduce the timing in order to check that performance goals are being met, and to find design bottlenecks to increase the performance. Such simulators are quite detailed, and anyone familiar with the details of the hardware design will easily accept that the simulator is a valid depiction of the real system.

Unfortunately, such detailed simulators are also dog slow. If you are really lucky, you might see an execution speed of a few million hertz, i.e., simulated clock cycles per real-world second. Often it is less. And that is not really fast enough to run modern large software loads in a reasonable amount of real-world time. At that rate, running a program that takes 10 seconds on a real machine that we assumes clocks at 1 gigahertz will take several hours. Each time you run it. Not fun at all, and singularly unsuitable if your goal is something different from understanding the timing of the hardware.

With Simics, we made the decision that what the world also needs is a simulation that can run fast enough to make that 10 second-long program actually run in a reasonable amount of real-world time. Say around a minute or less. This facilitates using the simulator for software development and debugging, testing software and doing classic interactive debugging. Even for large workloads that contain many billions of interesting instructions. In order to achieve such simulation speed, on the order of hundreds of megahertz, you have to simplify.

(The golf simulator is coming up soon)

The easiest place to start simplifying is the details in the timing of the hardware. It is kind of hard to cheat on the functionality, since for real software to run you do need values to be computed in the right way. But if the values are not resulting at exactly the same time as they would in reality, software usually work totally fine anyway. This is to a large extent thanks to the asynchronicity of modern software, which will be the subject of another blog post/essay some day.

It is in getting the intuition why and how pretty drastic simplifications in a model still provide a useful tool that the golfing simulator analogy comes in.

Let’s Play (Virtual) Golf
The golf simulator in question is the large room kind, where you shoot the ball at a screen showing a course. You are using real clubs and real balls, and the simulator measures the ball flight just before it hits the screen to determine where the shot ends up on the course. The aim is to provide a game where even a good golfer can get a satisfying experience akin to playing a real course, and offer a way to help players improve their game.

The defining property of a serious simulator, of any kind, is that it helps you understand the real world or improve your performance in the real world. This goes for flight simulators, combat simulators, driving simulators, not to mention role-playing games in management training and other analog forms of simulation going back to the “Kriegsspiel” of the Prussian army.

This golf simulator definitely had that property.

But it was not in any way a complete simulation of the world. We noted some case where a ball seemed to be bouncing off of some invisible wall on the side of the field when we managed to hit it really bad (the group I was with were all golf novices and did not always send the ball off in the most appropriate direction). If you hit the ball into the virtual crowd, nobody got virtually hurt or tried to duck. The spectators just disappeared so that you could see the ball. That is certainly a limitation, but not one that detracts from the core game.

Another perhaps obvious limitation is that you can only use the golf simulator to play golf. I cannot use it to learn how mow a golf course in the best way, for example. This is something that always has to be kept in mind when using a simulator: if you use it for the wrong purpose, you have no idea on whether the results will be valid or not. The use case and design goal of any simulator has to be kept in mind when using it and deciding on which simulator to use. Note that some simulators can have pretty broad areas of applicability, but you must always be aware of where the boundaries are.

Finally, the simulator offered the typical simulator ability of providing extra insight. When you hit the ball, you could see the angle it took off, its speed, and the distance it traveled. Not all that easy to do out in the field. From what I can tell from the manufacturer’s webpage, they have some pretty cool training tools in addition to the basic golf game.

It is the same with computer system simulations. They are good for certain things and not so good for other things, and you need to use the right simulator for your needs.

More Reading: If you want to read more about computer system simulation in this style, a good starting point is the three-part article I wrote for Embedded.com earlier this year. It can be found here, here, and here.

1 thought on “Golf Games and Computer Simulations”

Leave a Reply

Your email address will not be published. Required fields are marked *