E-Book, Englisch, 366 Seiten
Aarno / Engblom Software and System Development using Virtual Platforms
1. Auflage 2014
ISBN: 978-0-12-800813-3
Verlag: Elsevier Science & Techn.
Format: EPUB
Kopierschutz: 6 - ePub Watermark
Full-System Simulation with Wind River Simics
E-Book, Englisch, 366 Seiten
ISBN: 978-0-12-800813-3
Verlag: Elsevier Science & Techn.
Format: EPUB
Kopierschutz: 6 - ePub Watermark
Virtual platforms are finding widespread use in both pre- and post-silicon computer software and system development. They reduce time to market, improve system quality, make development more efficient, and enable truly concurrent hardware/software design and bring-up. Virtual platforms increase productivity with unparalleled inspection, configuration, and injection capabilities. In combination with other types of simulators, they provide full-system simulations where computer systems can be tested together with the environment in which they operate. This book is not only about what simulation is and why it is important, it will also cover the methods of building and using simulators for computer-based systems. Inside you'll find a comprehensive book about simulation best practice and design patterns, using Simics as its base along with real-life examples to get the most out of your Simics implementation. You'll learn about: Simics architecture, model-driven development, virtual platform modelling, networking, contiguous integration, debugging, reverse execution, simulator integration, workflow optimization, tool automation, and much more. - Distills decades of experience in using and building virtual platforms to help readers realize the full potential of virtual platform simulation - Covers modeling related use-cases including devices, systems, extensions, and fault injection - Explains how simulations can influence software development, debugging, system configuration, networking, and more - Discusses how to build complete full-system simulation systems from a mix of simulators
Daniel Aarno has been working with the Simics full system simulation product since 2006. His positions have ranged from software developer, customer project manager (including pre-sales) to engineering manager responsible for the modeling tools and model development in Simics at Intel. He has a number of publications, including journal and conference publications , book chapters and the book, Recognizing Intentions, on robotics and artificial intelligence.
Autoren/Hrsg.
Weitere Infos & Material
1;Front Cover;1
2;Software and System Development using Virtual Platforms;4
3;Copyright Page;5
4;Contents;6
5;Foreword;14
6;Acknowledgments;16
7;1 Introduction;18
7.1;Virtual Platforms;19
7.1.1;Terminology;20
7.2;Simulation and the System Development Lifecycle;21
7.2.1;Hardware Development and Design;22
7.2.2;Pre-Silicon;22
7.2.3;Platform Development;23
7.2.4;Application Development;24
7.2.5;Debugging;25
7.2.6;Testing and Integration;26
7.2.7;Deployment;28
7.2.8;Maintenance;28
7.2.9;Training;29
7.2.10;Longevity Support;31
7.2.11;Certifiable and Safety-Critical Systems;32
7.3;Model-Driven Development;33
7.3.1;Processor-in-the-Loop Testing;33
7.3.2;Hardware-in-the-Loop Testing;34
7.3.3;Integration Testing;34
7.4;Book Outline;35
7.5;Trademark Information;36
8;2 Simics fundamentals;38
8.1;Simics† Architecture and Terminology;38
8.2;Running Real Software Stacks;40
8.3;Interacting with Simics;40
8.3.1;Software Debugging;43
8.3.2;Scripting;43
8.4;Configurations and the Simics Object Model;45
8.4.1;Attributes;45
8.4.2;Interfaces;46
8.4.3;Haps;46
8.4.4;Ports;47
8.4.5;Documentation and Metadata;47
8.4.6;Call Chain and Locality;47
8.4.7;Changing the Configuration;47
8.5;Components;48
8.6;Time in Simics;49
8.7;Abstraction Levels;50
8.8;Event-Based Simulation;52
8.8.1;Multiprocessor Scheduling;54
8.8.2;Cycle-Accurate Simulation;55
8.9;Memory Maps;56
8.9.1;Hierarchical Memory Maps;57
8.9.2;RAM, ROM, and Flash;57
8.9.3;PCI and Other Memory-Mapped Interfaces;58
8.9.4;Multiprocessor Memory Maps;59
8.10;Memory Images;59
8.11;Checkpointing;61
8.11.1;Portability and Implementation Independence;62
8.11.2;Differential Checkpoints;63
8.11.3;Session State and Simulation State;63
8.12;Determinism and Repeatability;63
8.12.1;Reverse Execution;64
8.12.2;Recorders;65
8.13;Simics Performance Technology;66
8.13.1;Simulation Speed Measures;66
8.13.2;Multiprocessor Simulation Speed Measurement;67
8.13.3;Speed Variability;68
8.13.4;Temporal Decoupling;69
8.13.5;Performance Effects of Changing Target Timing;73
8.14;Models and Extensions;75
9;3 Develop and debug software on Simics;78
9.1;Development Means Testing;78
9.2;Agent-Based Debugger;80
9.3;Debugging Using Simics;81
9.3.1;System-Level Debugger;82
9.3.2;OS Awareness;82
9.3.3;Simics Breakpoints;85
9.3.4;Reverse Debugging;86
9.3.5;Navigating in Time;87
9.3.6;Debugging Hard-to-Talk-to Targets;89
9.3.7;Multicore Debugging;89
9.3.8;Low-Level Debug;93
9.3.9;UEFI BIOS Debugging;96
9.3.10;User-Level Debugging;96
9.4;Performance Analysis;98
9.4.1;Profiling Instruction Counts;98
9.4.2;Cache and Memory;98
9.4.3;Impact of Hardware Accelerators;99
9.5;Inspecting the Hardware State;100
9.5.1;Counting Hardware Events;100
9.5.2;Device Registers;100
9.5.3;Memory Mappings;101
9.5.4;System Panel;102
9.6;Fault-Injection and Boundary Conditions;103
9.6.1;Configuration Changes;103
9.6.2;Changing the Software State;105
9.6.3;Hardware Fault Injection;105
9.6.4;Test Result Check;108
9.7;Using Checkpoints;108
9.7.1;Save the Boot Time;108
9.7.2;Save Work and Continue Later;108
9.7.3;Positioning for Analysis;109
9.7.4;Share Setups;109
9.7.5;Nightly Boot;109
9.7.6;Adding Actions;110
9.7.7;Annotations;111
9.7.8;Bug Transportation;113
9.7.9;Cloning Setups;114
9.7.10;Record–Replay Debugging;114
9.7.11;Differential Checkpoint Saving;115
9.7.12;Gear Shift;116
9.8;Loading Software;117
9.9;Continuous Integration;120
9.9.1;Software Test Automation on Simics;121
9.10;Shortcuts in the Software Stack;122
9.10.1;Incomplete Software;123
9.10.2;Simulator-Aware Software;123
9.10.3;Backdoor Outputs;125
10;4 System configuration in Simics;128
10.1;Simics Component System;130
10.1.1;Preconfiguration Objects;130
10.1.2;Component Connectors;132
10.1.3;System Metadata;132
10.2;Setup Scripts;134
10.2.1;Hardware Setup Scripts;136
10.2.2;Software Setup Scripts;136
10.2.3;Script Parameters;138
10.2.4;Script Branches;138
10.2.5;System Panel;140
10.3;Automating Target Configuration and Boot;142
11;5 Networking;146
11.1;Network Simulation in Simics;146
11.1.1;Network Interfaces;146
11.1.2;Packet-Based Physical-Level Transport;148
11.1.3;Ethernet Modeling;148
11.1.4;Other Networks;150
11.1.5;Network Timing and Configuration Cells;151
11.1.6;Latency Management;154
11.1.7;Scheduling and Multithreading;155
11.1.8;Network Timing and Bandwidth Simulation;156
11.2;Simulated Network Nodes;157
11.2.1;Service Node;158
11.2.2;Sensors and Actuators;158
11.2.3;Traffic Generators;159
11.2.4;Network Testers;160
11.2.5;Rest-of-Network Simulation;160
11.3;Traffic Inspection and Modification;161
11.3.1;Traffic Modification;161
11.3.2;Ethernet Inspection with Wireshark;162
11.4;Scaling Up the Network Size;162
11.4.1;Infinite Inventory;163
11.4.2;Hypersimulation;163
11.4.3;Multithreading Simics;164
11.4.4;Distribution;164
11.4.5;Memory Page Sharing;166
11.4.6;Stubbing Network Nodes;166
11.5;Connecting the Real World;167
11.5.1;Dedicated Real-Network Modules;168
11.5.2;Availability of Hardware Ports;169
11.5.3;Timing Issues;169
11.5.4;Real-Time Mode;170
11.6;Ethernet Real-Network Variants;171
11.6.1;Network Address Translation and Port Forwarding;171
11.6.2;Ethernet Bridging;172
11.6.3;Host Access;173
11.7;Programming New Networks;175
12;6 Building virtual platforms;178
12.1;The Purpose of the Model;178
12.1.1;What to Model;179
12.1.2;How to Model;181
12.1.3;The Modeler;182
12.2;Virtual Platforms in Simics;182
12.2.1;Following the Hardware Structure;187
12.3;Device Modeling Language;189
12.3.1;Overview of DML;189
12.3.2;DML Compilation Process;189
12.3.3;Reactive Modeling Style;190
12.3.4;Model Performance;191
12.4;Reusing Existing Information;191
12.4.1;Register Maps;191
12.4.2;Device Functionality;192
12.5;DML Features;192
12.5.1;Inline Documentation;193
12.5.2;Register Maps;195
12.5.3;Templates;197
12.5.4;Bit Field Decoding;198
12.5.5;Endianness and Partial Accesses;200
12.5.6;C-like Core Language;201
12.5.7;Memory Layouts;201
12.5.8;Interfaces to Other Models;202
12.5.9;Simics Attributes;202
12.5.10;Functionality Templates;205
12.6;Creating Device Models;205
12.6.1;Setting Up the Environment;205
12.6.2;Test Methodology;205
12.6.3;Adding a Model to the Simulation;207
12.7;Completing the Device Model;208
12.8;Reserved Registers and Missed Accesses;214
12.8.1;Reserved Registers;216
12.9;Creating Models in Other Languages;217
12.9.1;Module Scanning;218
12.9.2;Module Loading;218
12.9.3;Class Registration;219
12.9.4;Objects;221
12.9.5;Attributes;221
12.9.6;Interfaces;223
12.9.7;Logging;226
12.9.8;Events;226
13;7 DMA: A concrete modeling example;228
13.1;DMA Device Description;228
13.1.1;Functional Description;229
13.2;Implementing the Basic DMA Device Model;231
13.2.1;Unit Testing;231
13.2.2;Simulating Time;232
13.2.3;Scatter-Gather List Support;239
13.2.4;Avoiding Deadlock;243
13.3;Creating a PCI EXPRESS (PCIe) Model;244
13.4;Creating a Component for the DMA Model;244
13.5;Creating a Device Driver;250
13.5.1;Driver Overview;251
13.5.2;Bring it all Together;251
14;8 Simulator extensions;254
14.1;Introduction;254
14.1.1;Applications of Extensions;254
14.1.2;Script or Extension;256
14.1.3;Device or Extension;256
14.2;Implementing Extensions;257
14.2.1;C or Python;257
14.2.2;Attribute Values;258
14.2.3;Callback Functions;258
14.2.4;Getting to a Safe Context;259
14.2.5;Special Concerns When Creating Extensions;260
14.2.6;On-the-Fly Python Objects;261
14.3;Cache and Memory Simulation;261
14.3.1;Simics’ Generic Cache Model;263
14.4;Fault Injection;266
14.4.1;Modifying Memory and Registers;267
14.4.2;Error Reporting Registers in Devices;267
14.4.3;Intercepting Traffic;267
14.4.4;Intercepting Memory Accesses;269
15;9 Simulator integration;274
15.1;Introduction;274
15.1.1;Physics and the Environment;274
15.1.2;Computer Architecture;275
15.1.3;Hardware Validation;278
15.1.4;Reusing Existing Models;278
15.2;Problems and Solutions;280
15.3;Run Control;280
15.4;Launching and Embedding;281
15.4.1;Embedding Simics;282
15.5;Time Management;282
15.5.1;Synchronization Intervals;283
15.5.2;Simics Temporal Decoupling;284
15.5.3;Simics and SystemC Time;284
15.6;Communications;286
15.6.1;Dedicated Communications Modules;286
15.6.2;Devices for I/O;287
15.6.3;Bypassing Devices;288
15.6.4;Push or Pull;289
15.6.5;Abstraction Level Change and Transactors;290
15.6.6;State Transfer in Checkpoints;291
15.7;Frontends;293
15.8;Running Simics from Other Programs;294
15.8.1;Virtual Lab Management;294
15.9;Record–Replay Debugging of Target Software;295
15.10;Running on a Simics Target;297
15.11;Multiple Simulator APIs;298
15.12;Simics Processor API;298
16;10 Intel® architecture bring-up;300
16.1;Pre-Silicon Process;300
16.1.1;Early Collaboration with Hardware Architects;301
16.1.2;New Instruction Set Support and Usage;302
16.1.3;Collecting Requirements from Customers;303
16.1.4;BIOS Development and Enabling Capabilities Using Simics;305
16.1.5;Software and Simulator Cross-Validation;305
16.1.6;UEFI BIOS Debug;306
16.1.7;JEDEC Memory Module Support;307
16.1.8;Fault Injection and RAS;307
16.1.9;Machine Check Errors;308
16.1.10;Device-Specific Faults;309
16.2;Early OS Enabling;310
16.2.1;Compatibility Hardware Level for Legacy Drivers;311
16.2.2;BIOS SATA Mode Switching;311
16.2.3;Common OS Installation Steps;312
16.3;Post-Silicon Process;312
16.3.1;Post-Silicon Modeling;313
16.4;Post-Silicon Case Study: PXE;317
16.4.1;PXE Overview;317
16.4.2;Server-Side Software Support;319
16.4.3;Service Node as Server;319
16.4.4;Virtual Platform as Server;320
16.4.5;Client-Side Software Support;320
16.4.6;Integrated BIOS Approach;320
16.4.7;NIC OpROM Approach;321
16.4.8;PXE Final Results;323
17;Appendix A: Source code;326
17.1;Chapter 6: Counter Device;326
17.2;Chapter 7: DMA Device;330
18;References;352
19;Index;358
Chapter 1 Introduction
Chapter 1 explains why virtual platforms and full-system simulation like Simics is a critical tool for developing today’s complex computer-based systems. It describes how Simics helps deliver new solutions faster, and develop, debug, and maintain evermore complex systems throughout the lifecycle of a product. The chapter provides a high-level overview of why and where Simics is being applied to solve problems for software and system developers. Keywords
virtual platform; product lifecycle; shift left; model-driven development; continuous integration; pre-silicon Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it. —Alan Perlis, Epigrams on Programming, 1982 In just a few years, electronic systems have become significantly more complex. Now, even comparatively simple designs include multiple processors, a mixture of CPU types, digital signal processing (DSP), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), and other devices. Complementing the diverse combinations of hardware, today’s systems employ a variety of operating systems and application stacks that until recently would not have been combined within a single product or solution. Unfortunately, however, as these systems have grown in complexity, the development tools and processes that were refined when single processors and basic client–server architectures were the rule have not kept pace. As a result, today’s system developers are challenged to find new ways to define system architectures, develop and integrate millions of lines of code, and deploy such complex systems. They must do this in ways that reduce risk and shorten the schedule while simultaneously resulting in a higher-quality product that is easier to support and maintain. In addition to the growing complexity, the market also expects new systems to be delivered at a much higher pace. The product development lifecycle of most electronic systems has been significantly shortened over the last decade. Thus, today’s system developers are faced with two significant challenges: deliver new solutions faster, and develop, debug, and maintain ever more complex systems. Virtual platforms can help in addressing these two challenges. The goal of this book is to inspire and educate the reader to find new ways to leverage the power of virtual platforms and full system simulation to improve their systems’ design and development activities. With this book we seek to share our experience, gathered over more than a decade, from working with our customers to help them realize the advantages of working in a simulation environment. This book is focused on virtual platforms created in Wind River Simics†, and although Simics offers many unique features, many of the techniques and challenges discussed apply to other virtual platform solutions as well. At one level the book will address how to use Simics simulations to achieve your development goals as a leader of an organization. At another level, the book will discuss how to use Simics simulations to get actual tasks done. The book offers best practices along with real-life examples to help you understand how to get the most out of your Simics implementation. Design patterns and architectures that have been proven to work when building complex simulation systems involving many separate components are described. While the book is not intended to be a user manual, it is a comprehensive book on simulation using Simics, and we have tried to provide enough details for the book to be useful for someone trying to implement the concepts described. This chapter introduces the reader to why virtual platforms and full-system simulation like Simics is a critical tool for developing today’s complex computer-based systems. The chapter defines the basic terminology and provides a high-level overview of why and where Simics is being applied to solve problems for software and system developers. The chapter concludes with an outline of the remaining chapters of the book. Virtual Platforms
A virtual platform is a model of a hardware system that can run the same software as the hardware it models. The virtual platform is simulated on a host computer that may be different from the hardware modeled by the virtual platform. For example, a big-endian Power Architecture system with a controller area network (CAN) bus and other peripherals running VxWorks† can be simulated on a typical little-endian Intel® Architecture PC running a Linux† or Windows† operating system. A virtual platform is not limited to modeling a single processor or board, but can represent anything from a basic board with only a processor and memory to a complete system made up of network-connected boards, chassis, racks, and models of physical systems. The key property of a virtual platform is its ability to run unmodified binaries of the software that will finally run on the real system, and run it fast enough to be useful for software developers. Such software includes low-level firmware and boot loaders, hypervisors, operating systems, drivers, middleware, and applications. Therefore, the virtual platform accurately models the aspects of the real system that are relevant for software, such as CPU instruction sets, device registers, memory maps, interrupts, and the functionality of the different devices. On the other hand, the virtual platform is typically not concerned with modeling the detailed implementation of the hardware, such as internal buses, clocks, pipelines, and caches. By focusing the model on the hardware–software interface and functionality it is possible to achieve good performance and produce a virtual platform very early in the product lifecycle—two critical features required to address the aforementioned challenges. Terminology
There are many terms in use for the kind of technology that Simics represents. This section defines some of the terminology the reader may come in contact with. Simulation is a very broad term, used in many different fields. At its core, it means that you use computer software to build a model of some phenomenon you want to study and then run this simulator to understand the behavior of the modeled system. A simulation provides more flexibility than the real system, allows parameters to be set freely, provides better insight into the internal workings, and allows for the replay and repetition of scenarios. It also fundamentally avoids the need to build physical prototypes or experiments, which speeds up development. Simulation is used in every field of science and engineering. Simulations are used to predict weather, crash-test cars, design aircraft, understand economic mechanisms, and find new medicines. This book is primarily concerned with the simulation of a digital computer system (the target) using another digital computer system (the host). Full-system simulation (FSS) is a term commonly used to describe Simics, and it captures the fact that the simulation targets an entire target system. Originally, the point of a full system was that the digital computer hardware model was sufficiently complete to run a real operating system (Magnusson et al., 1998). Over time, it has grown in scope, and today a full system often includes factors external to the digital computer hardware, such as models of the surrounding world and inputs and outputs from the outside. It also includes the use of the simulator to model collections of digital computer systems, such as multiple machines in a network or multiple boards in a rack. A simulation that cannot simulate more than a single system-on-chip (SoC) or board is not really a FSS today. Virtual platform is the established term in the world of electronic design automation (EDA) for a piece of software that works like a piece of hardware and is capable of running software in lieu of the real hardware. Virtual platforms are used at many levels of abstraction, from cycle-accurate models that correctly emulate all pins and signals on buses and inside devices, to programmer’s view (PV) and transaction-level models (TLMs) that essentially work like Simics does. Virtual platforms are considered to be development tools. Emulation is a term commonly used to indicate a software layer that lets a piece of software run on a platform it was not initially targeted to run on. Well-known examples are the Mac† 68k emulator that Apple† used in the migration from the 68k-family of processors to the PowerPC† family, and the Rosetta emulator that allowed PowerPC binaries to run on Intel® Architecture in Apple’s next architectural transition. Simulators for old videogame platforms, such as the Nintendo† Entertainment System (NES), are also known as emulators to the public. We thus consider emulation in the software realm to mean something that runs software by translating binaries and operating system calls, where the primary use is to run software, not to develop it. Virtualization in the IT world means the use of virtual machines to run multiple software loads on a single host. Virtualization as a principle traces its beginnings back to the IBM System/360 line in the 1970s, and today there is a wealth of virtualization solutions available on standard Intel hardware such as KVM, VMware†, Xen, Hyper-V, Virtualbox, and many others. A virtual machine runs a real operating system, but often employs special drivers and input/output (I/O) mechanisms...