What is complete Simulation?

Back to Keil Page >>>
Complete Simulation includes much more than simply simulating the instruction set of a microcontroller. It means simulating your entire target hardware including external signals and I/O.

The Keil µVision2 Debugger provides everything you need to quickly develop high-fidelity simulations that help you test, debug, and prove the stability and quality of your software design.

Keil Software define Complete Simulation to include:

  • Instruction Set Simulation
  • Interrupt Simulation
  • On-Chip Peripheral Simulation
  • External I/O Simulation
  • Debug Scripts/Functions
Why Simulate? >>>
Instruction Set Simulation
The µVision2 Debugger provides complete instruction set simulation for all supported devices. When you view your program in mixed or assembly mode, the op-codes are interpreted and executed as their corresponding MCU instructions would be. All registers and flags are updated accordingly. Instruction timings are simulated as well so you can easily determine how long a function or module takes to execute. Note that pipeline effects are not simulated at this time.
Interrupt Simulation
Interrupts are fully supported and properly simulated in the the µVision2 Debugger. Interrupts are triggered and executed exactly as they would be in a real target system.

An Interrupt System dialog box is designed specifically for each supported device. Each interrupt source as well as its current mode, request, enable, and priority flags are displayed. You may use this dialog to interactively enable and disable interrupts, change the interrupt priority, enable or disable an interrupt request, and change the global interrupt flag.

On-chip Peripheral Simulation
A unique feature of the µVision2 Debugger is its ability to fully simulate the on-chip peripherals of your selected MCU. In most cases all on-chip peripherals are completely simulated. In cases where complete simulation is not yet available, the standard set of 8051 peripherals is supported.

Dialog boxes are provided for timers, counters, I/O Ports, UARTs, PWM Units, A/D converters, D/A Converters, EEPROM Memory, Oscillator Control, I2C, CAN, and so on. You may interactively change the settings for any on-chip peripheral using the controls provided in each dialog. Use this capability to assist in learning how to interface to and control the on-chip peripherals of your target MCU.

External I/O SImulation
It makes no sense to offer dialog boxes and simulation support for on-chip peripherals without some way to inject input into and monitor output from the simulated device. Each simulated peripheral that connects to a pin of the MCU can be stimulated and monitored using virtual target registers (VTREGs) from the debugger command line. Several example will make this more clear.

I/O Ports
Dialogs for I/O ports reflect the internal state of the port (P1) and the state of the pins on the MCU (Pins).

Virtual Target Registers are provided for each port so that you can view and change the state of the pins. PORT1 is the name of the VTREG for I/O Port 1. In the debugger command window, you may enter PORT1 to obtain the current value of the pins on Port 1. Assigning a value to PORT1 sets and clears the corresponding input values to the pins. For example, PORT1 |= 0xAA; sets bits 7, 5, 3, and 1 while PORT1 &= ~0x55; clears bits 6, 4, 2, and 0.

A/D Converters
An A/D Converter reads the voltage present on an input pin and converts it into a binary value. The A/D Converter Dialog (which is of course customized for each simulated device) displays all aspects of ADC configuration as well as the values of the analog input channels.

VTREGs for each analog input are provided. To change the simulated input voltage you simply assign a floating-point value to the appropriate VTREG. For example, AIN0 = 2.5; assigns the value of 2.5 volts to analog input 0.

UARTs
Of course no simulator would be complete without serial port simulation. The µVision2 Debugger provides serial windows for each on-chip UART. Many devices offer dual UARTs and µVision2 provides a separate window for each.

Additionally, you may access the serial port VTREGs and read and write the serial data directly. This may be useful if you have a long string of binary data you wish to include in your simulation.

Debug Scripts / Functions
Many of the simulation features (especially those of peripheral simulation) can be enhanced using the C Script Language that is built-in to the µVision2 Debugger. Scripts (or debugger functions) allow you to completely automate many of the mundane tasks associated with complete simulation. You may, in fact, use the VTREGs along with your program variables to create a sophisticated debugging environment that completely simulates your target platform.

Last Updated: November 27, 2002 16:20

Nohau UK Home >>>