Web-Enabled Simulation

# Web-Enabled Simulation and Debugging for Digital Signal Processors and Microcontrollers

Dogu Arifler, Chi Duong, Brian L. Evans, Srikanth Gummadi, Jun Huang, Saleem K. Marwat, Chris M. Moy, and Anna Yuan

Embedded Signal Processing Laboratory, Department of Electrical and Computer Engineering, The University of Texas at Austin

Version 1.3.0 Released (What's new?)

Quick Reference

Running the Simulators and Debuggers - Tips on the User Interface - TMS320C30 Simulator Examples - MC68HC11 Simulator Examples - MC56811 Simulator Examples - MC56LC811 Debugger Examples - Download WEDS Source Code - Documentation and Other Information

## Running the Simulators and Debuggers

The Web-enabled simulation framework will run under any Java 2-enabled browser. If your browser does not support Java 2, you will be automatically forwarded to a URL that starts the Java Plug-in installer. If Java 2 support is enabled, you should see a button centered on the next line:

When you hit this button, a menu of available simulators and debuggers should be displayed. At the present time, we have a TMS320C30 simulator, an MC68HC11, an MC56L811 board debugger, and an MC56811 ISA simulator available for use. Once you select your simulator, a graphical user interface written in Java should appear. We discuss examples using TMS320C30 simulator and MC68HC11 simulator below. We wrote both simulators at UT Austin based in part of freely distributable source code we found on the Internet.

Note that the user interfaces require two-way communication with an application running on a server. If you are behind a company firewall, then you will likely not be able to access the Web-based simulators because firewalls do not let Java applets send information back to the server. If that is the case, then try this Web-based tool from a machine outside the company firewall.

The source code for the framework is freely distributable. Directions to download and install this software are at the bottom of this page. It is straightforward to add your own simulator, debugger, or other command-line tool to the framework because the graphical user interface configures itself based on feedback from the tool.

## Tips on the User Interface

- Resize the GUI according to your preference
- Enter simulator commands in the Command Window
  - The command window is the upper left window with a white background.
  - You can double click on any of the commands in the left column to enter the command in the command window
  - You can cut and paste commands into the command window, e.g., from the command history window (see below)
  - Hit the Evaluate command button (in the upper left portion of the screen) to evaluate the commands in the command window
  - Typing either `exit` or `quit` in the command window will quit the simulator, but the applet and connection to the server will still be active.
- Help menu
  - Gives help on any simulator command
  - Located in the upper right portion of the interface
- Download a file to our server by using the Load option on the File menu.
  - A file is downloaded to a `userprograms` sub-directory to a filename of the user's choice which is accessible from the simulator using the command

        load userprograms/filename

  - A file is limited to 308 Kb in length
  - A file must originate from an HTTP address
  - A previously loaded file will be automatically deleted before a new one is downloaded
  - A downloaded user file will be deleted when the user closes the server connection or exits the applet.
- You can retrieve files you created on our server at

      classes/userprograms/

  using your Web browser.
- Simulator command history is accessible by hitting the book icon
- Quit the applet using the Exit option on the File menu

## TMS320C30 Simulator Examples

We have written our own freely distributable C30 instruction set architecture simulator based on the C30 DSP Starter Kit tools. In this section, we present three examples to run on the C30 simulator. The first example loads one into register R0 and increments R0 33 times. We use this example to explain features of the GUI and the C30 architecture using a pre-assembled program. The second example is an FIR filter. We use this example to explain how to run through a complex program using a pre-assembled FIR filter application. In the third example, the user downloads an assembly language program, assembles it, and runs it. Full source code for all of the examples and the C30 simulator is available.

Example 1: Incrementing a Register

This example loads one into register R0 and increments R0 33 times. For the first example, cut and paste the following commands in the Command Window, which is the upper left window with the white background:

    reset
    load examples/testloop.c30
    +dasm
    step 8

and then hit the Evaluate command button when finished. The command loads in the binary file `testloop.c30`, enables the display of disassembled instructions (`+dasm`), and executes the first 3 instructions in the program, respectively. You should see the following response in the Response Window:

    7 words read from file 'examples/testloop.c30'.
    PC=0x00809802
    NOP
    LDI 1,R0
    RPTS 32
    ADDI 1,R0
    NOP ; flushed
    NOP
    ADDI 1,R0
    ADDI 1,R0

The output shows the execution of the first 3 instructions of a program that loads 1 into register r0 and enters a loop which adds 1 to register r0 a total of 33 times. The TMS320C30 has a four-stage pipeline: fetch, decode, read, and execute. The disassembly of instructions occurs in the decode stage, so the first instruction decoded is a NOP. The repeat (RPTS) instruction repeats the command that follows it N+1 times using a no-overhead hardware loop counter. After the repeat (RPTS) instruction, the pipeline will be flushed and initialized to contain a stream of `ADDI 1,R0` commands.

Next, hit the Register Values button in the middle left of the C30 simulator screen. The register values will be shown in the lower left window. Values that have changed are marked with an asterisk `*`.

You can let the program run to completion by evaluating

    step 33

or hitting the Single step button 33 times. Now, hit the Register Values again, and the last set of register values in the left window will move to the right window, and the current register values are displayed in the lower left window. The current value of R0 should be 0x22 hexadecimal.

Example 2: FIR Filter

Here is an example of an FIR filter program to try out C30 simulator interface. Cut and paste the following commands in the Command Window, which is the upper left window with the white background:

    reset
    load examples/fir.hex
    +dasm
    step 8

and then hit the Evaluate command button when finished. The above commands load the assembled version of the example FIR filter program `fir.asm`, enable the display of disassembled instructions (`+dasm`), and execute the first 8 cycles of the program, respectively. To produce the `fir.hex` file, we used the assembler in the the freely distributable C30 Digital Signal Processor Starter Kit (DSK) tools, which we have now made part of the C30 simulator. See Example 3 below.

You should see the following response in the Response Window:

    144 words read from file 'examples/fir.hex'.
    PC=0x0080987c
    NOP
    LDIU 00080h,DP
    NOP ; interlock
    NOP ; interlock
    LDI @098adH,SP
    LDI 0,R0
    STI R0,@08020H
    STI R0,@08024H

You can look at the values of the registers at any time by hitting the Register Values button in the middle left of the C30 simulator screen. The register values will be shown in the Current Registers window in the lower left portion of the screen. If you hit the Register Values button again, then values in the Current Registers window will be moved into the Previous Registers window in the lower right portion of the screen, and the Current Registers window will be updated.

The program runs through about 150 cycles of initialization of interrupt routines and then waits for an interrupt to occur which signals that an input sample has arrived. At the present time, we do not have a way to trigger an interrupt using the simulator. So, let's skip to the `FIR` code segment, which computes one output sample of the FIR filter, by cutting and pasting the following into the Command Window:

    modify pc 0x00809858
    step 20

You will see the flurry of multiply-accumulate instructions implementing the FIR filter.

Example 3: Downloading and Assembling a Program

In this example, we will revisit the FIR example by downloading, assembling, and running it. First, we will need to download two files. In the C30 simulator window, click the Load option in the File menu. For the URL of the file to be loaded, put

    http://anchovy.ece.utexas.edu/~arifler/wetics/classes/examples/fir.asm

and for the name of the file to save the userprograms directory, use

    fir.asm

When it has been successfully load, the message "User program loaded" will appear in the status box. Before closing the window, download the C3XMMRS.ASM file using the same procedure. You can simply replace fir with C3XMMRS in the dialog window. You can close the window by hitting the Cancel button.

Now, assemble the FIR application by entering the following in the Command Window:

    assm userprograms/fir.asm

This operation will create `userprograms/fir.hex`. Now, load in the application by

    reset
    load userprograms/fir.hex
    +dasm
    step 8

Now, go to Example 2 and continue with the running the application by skipping the load commands at the beginning of the example.

Additional Examples

Additional examples in .c30 and .hex formats are available to run on the TMS320C30 simulator including

- `examples/indirect.c30`
- `examples/dskosc.hex`
- `examples/dsksg.hex`
- `examples/fir.hex`
- `examples/loopaic.hex`
- `examples/math.hex`
- `examples/scan.hex`

For each .hex file, the original C30 assembly language file (.asm file) and its assembled version for the C30 Digital Signal Processor (DSP) Starter Kit (DSK) board (.dsk) are available in the `classes/examples` directory. We have used these programs to validate the C30 simulator by comparing its results instruction by instruction with the programs running on a C30 DSK board. The .c30 extension means a binary file of 32-bit opcodes stored in the same byte order as on a PC. The C30 simulator load command supports both .c30 and .hex formats.

## MC68HC11 Simulator Examples

One example to try out on the Motorola MC68HC11 simulator adds two 32-bit numbers. After typing the following simulator commands in the Command Window, which is the window with the white background, hit the Evaluate command button:

    load examples/add32.s19
    go F800

Then hit the Enable debugging button. The program will take 50 cycles to complete. You can either hit the Single step button several times or type the following in the Command Window:

    step 50

The program calculates the sum of two 32-bit hexadecimal numbers ($12345678 and $9abcdef0) and puts the result ($acf13568) into register D (D = $acf1) and register X (X = $3568). You can look at the register values by hitting the Register Values button in the middle left portion of the C30 simulator screen.

Another available example is called `examples/hexmon40.s19`.

## MC56811 Simulator Examples

We have modified the command-line interface for the Motorola MC56811 simulator to work with our Web-based interface. The command-line interface is stream-based and makes no assumptions about terminal or windows support. The simulator engine is freely distributable by Motorola Inc. in Austin, Texas, as part of their CLAS568 toolset available at http://www.motorola.com/SPS/DSP/tools/index.html. We include the source code for the new command-line interface and pre-compiled Solaris and Windows 95/NT binaries for our command-line interface.

We are in the process of putting examples on-line.

## MC56LC811 Debugger Examples

We have modified the command-line interface for the debugger for the Motorola MC56LC811 board to work with our Web-based interface. The command-line interface is stream-based and makes no assumptions about terminal or windows support. The debugger engine is freely distributable by Motorola Inc. in Austin, Texas, as part of their ADS568 toolset available at http://www.motorola.com/SPS/DSP/tools/index.html. We include the source code for the new command-line interface and pre-compiled Solaris and Windows 95/NT binaries for our command-line interface. Note that we force the Motorola MC56LC811 boards to start in debug mode by evaluating `force s`. The debug mode is required for viewing register values.

We are in the process of putting examples on-line.

## Additional Information

- Documentation on the Web-Based Interface
- Talk on Web-based simulation by Brian L. Evans
- Download source code for the Web-Enabled Simulation framework
- Texas Instruments TMS320C30 Home Page
- Motorola MC68HC11 Home Page

Note that the acronym WETICS stands for "Web-Enabled Texas Instruments C30 Simulator," which adequately described the initial release of this framework (version 0.1 on May 19, 1997) which contained only an interface to the TMS320C30 simulator.

Last updated 05/18/01. Please send comments to Prof. Brian L. Evans at bevans@ece.utexas.edu.