Category:Simulation

From Texas Instruments Wiki
Jump to: navigation, search

Simulator

Introduction

A simulator, also known as an instruction set simulator, is a software tool for developing application/algorithm programs on TI’s DSPs. Simulators are an excellent platform for application development because they provide greater visibility into application behavior, are readily available, and are easy to use. Additional simulator characteristics that are critical to application development are simulation speed, simulation accuracy, and the ability to run complete applications.

Texas Instruments (TI) offers instruction set simulators — which ensure quick deployment of applications — into end systems as an integral part of the Code Composer Studio IDE. The rich integrated development environment (IDE) offers a number of features to speed up the various phases of application development, debug, and optimization. Code Composer Studio IDE supports complete application simulation, easy migration between simulation and emulation environments, device level simulation, BIOS and RTDX.

Advantage of Simulator

Simulators provide an excellent development platform that helps the developer meet their goals. The advantages of simulation are summarized below:

  1. Simulators are available early – even before hardware is available.
  2. They are easy to use. They require just the workstation. No additional setup is required. Simulators, being a software solution, can be distributed easily and are usually less expensive.
  3. They provide excellent control and repeatability to the user – a simulator can run in an identical manner time after time. In the hardware scenario, repeatability of external events like interrupts is almost impossible to guarantee.
  4. They are more flexible. Some aspects could be ignored if necessary, to provide an environment more suited to the particular phase of development. For example, the algorithm development could be performed on a CPU-only simulator, ignoring all the device effects such as memory latencies. Once an algorithm optimized for the CPU architecture is available, it could be optimized in the device context for memory placement.
  5. They can provide visibility into the application behavior as well as resource usage. The details, which can be provided on the simulators, may be difficult to obtain on the hardware.

Simulators, however, do have their limitations. They are not real systems; they only mimic reality, and are therefore normally limited in the extent to which they can model hardware.

Type of Simulator

TI provides different flavors of simulator and they are abstracted based on the range of details and extend of hardware modeled.

Range of details:

  • Functional
- Provides a programmer view of the model
  • Cycle Accurate
- Models 100% pipeline and latencies

Extend of Hardware modeled:

  • CPU/Core simulator
- Models the CPU core only
  • Device Simulator
- Models the CPU, caches, DMA and peripherals.
  • System/SOC Simulator
- Multi-core simulator with multiple cores. Ex: ARM +DSP

Simulator Usage

Below is the tabled on simulation usage in various phases of application development.
Steps Recommended Simulation Usage
(a) Algorithmic Development (Functional)

C/linear assembly/assembly level algorithm development Test algorithm for functional correction

CPU Functional simulator

To validate algorithm and a functional device simulator if some peripheral usage is essential for application functioning.

(b) Algorithmic Development (Performance Optimization)

Measure code size and performance Perform generic algorithmic optimizations Perform ISA specific optimizations (pipeline hazards, parallelism, bank conflicts…)

CPU Cycle-accurate simulator.

Determine bottlenecks through the profiler and other analysis tools. A functional device simulator may also be used, if cache effect optimizations also need to be performed or the application uses some peripherals like timer.

(c) Application Integration (Functional)

Integrate various algorithms Add code to use peripherals to transfer data between environment and device. Use DMA for data transfer between peripherals and algorithms or between algorithms

Device Functional simulator.

This allows usage of device level features and provides highest simulation speed.

(d) Application Integration (Performance Optimization)

Optimize memory placement Cache optimizations DMA optimizations

Device Cycle-accurate Simulator

Measure performance on hardware or cycle-accurate device simulators Device cycle-accurate simulator to determine bottlenecks, the profiler and other analysis tools to optimize. Device cycle-accurate simulator provides in-depth visibility into the sources of bottlenecks.

Simulator Usage During Application Development

Debugging Applications on Simulators

Simulators offer very high visibility into the behavior and resource usage of the application. This visibility can be a great aid in quickly developing completely validated applications. Various aids to debug are:

  1. Basic debug support
  2. Data visualization aids
    • Help provide better visualization of the data to be able to debug quickly. These aids could be probe points and various data visualization aids like eye diagrams, peripheral viewers, watch windows, etc.
  3. Code Coverage tools
    • This aid in ensuring that adequate testing has been performed. If the tests are not sufficient, these tools can help highlight aspects that are not covered. This feedback can help develop more tests in order to ensure completeness of validation.

Running Complete Applications on Simulators

A simulator has only limited utility if it is not capable of running complete applications. The important factor in determine the usage is the completeness of solution. The completeness of the solution is determined in terms of accurate simulation of the CPU as well as device details so that it is possible to run applications without any modifications. The solution should be able to provide some mechanism to model inputs from and log outputs to the system not being simulated (i.e., the environment). The ability to support complete operating systems and other software frameworks is critical. Below are the features of TI simulators that are targeted at enabling complete applications to run without modifications.

  1. Pin Connect
    • Inputs can be defined for interrupts and other pins. Allows periodic or non-periodic inputs to be captured so that inputs from the environment can be captured.
  2. Port Connect
    • Ranges of memory can be connected to files. When connected for reading, all reads from the memory range are performed from the file. When connected for write, all writes are logged to a file. This allows a simple mechanism to abstract external peripheral systems, FIFOs or other inputs. Outputs can also be easily logged.
  3. Real Time Data eXchange (RTDX)
    • Applications that use the RTDX feature to add additional visibility or control can be run on the simulator in the identical manner. Only the simulation specific library needs to be used.

Optimizing Applications on Simulators

Simulators being software solutions can provide a high degree of visibility into the application behavior as well as usage of various resources. This visibility can be very useful in optimizing the applications quickly. Summary information on the overall application cycle count, program size and power consumed can help assess whether the goals are being met. Detailed information can provide insight into the application behavior and resource usage.

Optimization tools

  1. Profiler
    • The profiler allows profiling any event over functions or user defined ranges. Exclusive or inclusive profiles may be performed. For each range the maximum and minimum count of event may also be obtained. The data may be saved to a text file for later processing. The profiler is available on all Code Composer Studio IDE targets.
  2. Multi-event Profiler
    • The multi-event profiler tool available through the ATK in the Code Composer Studio IDE release can be used to view profile data over various functions and source lines. Exclusive profile of multiple events can be viewed simultaneously. The data can be viewed and processed as a Microsoft Excel spreadsheet which provides powerful analysis and visualization capabilities.
  3. Simulator Analysis
    • The simulator analysis plug-in can be used to obtain counts of various events simultaneously in an interactive manner. The tool also enables breaking on the event occurrence, which can be useful to locate the exact state when the event occurs. The simulator analysis is available on the C6000 and the C5500 simulation platforms.
  4. Pipeline Analysis Tool
    • The pipeline analysis tool is available on the C5500 simulators. It enables observing the cycle-by-cycle state of the processor pipeline. The resources being used and the sources of stalls can be visualized in the GUI. The tool also simultaneously provides the summary counts of important events like stalls, instructions, etc. It also provides valuable information to understand resource usage of the CPU, which may be used for optimizing the assembly code.
  5. Cache Analysis Tool
    • The cache analysis tool provides a temporal view of the cache accesses. Hits and miss patterns can be viewed on address basis over time. Analyzing the cache access patterns can be very useful in determining sources of performance loss due to the cache activity. The tool provides source level information for any access. It can also show what addresses may be in conflict with a given address. The ability to see the access patters as well as conflicts helps optimize placement as well as algorithms for cache usage. The cache analysis tool is available through the ATK over the Code Composer Studio IDE release.

List of Simulator

List of Simulator available in CCSv3.3 - link

List of Simulator available in CCSv4 - link

List of Simulator available in CCSv5 - link

List of Simulator available in CCSv6 - link

FAQs/Troubleshooting

FAQs & Troubleshooting on simulator - link

  1. Multi Core Debugging FAQs

Support

Please use the following resources for support: