EVBU - An Open Source 68HC11 Simulator

Andrew Sterian
Padnos College of Engineering & Computing
Grand Valley State University


Top-Level | BUFFALO Emulation | Peripheral Emulation | Waveform I/O Version 0.5
March 10, 2002
Display Panel | Output Waveforms | Input Waveforms | Simulation Details | Cursors

The port pins of the 68HC11 interact with the user via the waveform I/O panel. On this panel, an interface similar to that of a logic analyzer is presented. Each port pin uses a horizontal window to display its logic level as a function of time. For output pins, every change in logic level generates a rising or falling edge in the window, at the right time (measured in cycles). For input pins, a separate text file is constructed by the user and loaded into the waveform I/O panel, where it is displayed just like an output waveform. During simulation, this input file provides a logic level stimulus to the input port pin, once again with times measured in cycles.

The Display Panel

When the parallel I/O peripheral module is loaded (unless --no-pio is specified as a command-line option) a waveform I/O display panel is presented along with the main BUFFALO command window. If the display panel fails to display, it probably means that wxPython is not correctly installed, wxWindows is not correctly installed, or something similar. Check the displayed error messages for clues.

If this is your first time using the waveform I/O panel, I suggest creating a new waveform so you can investigate the options as you are reading this text. Select the Waveform->Add Waveform... menu, click on PA0 at the top of the Port Pin list box, then click the Browse button near the bottom right. Find the EXAMPLE.STI file that came with the EVBU software. Click OK to dismiss the dialog. You should see a new waveform in the display panel labelled PA0.

Each waveform is split into two windows, the label window on the left and the data window on the right. In the data window, the logic level of the port pin is shown as a function of time (in cycles). The yellow tick marks in the data window represent divisions. The number of cycles in one division is given by the Scale value near the top of the panel. Try adjusting the Scale text box to 1000 and see how the waveform changes in appearance. The yellow tick marks don't change in spacing or position, but the waveform expands and compresses.

The spacing of the tick marks can be changed using the Zoom value of the panel. The Zoom text box changes the number of pixels between each tick mark. The combination of Zoom and Scale serve to set (indirectly) the number of pixels per cycle, although this quantity is not manipulated directly. Try clicking on the Zoom In, Zoom Out, and Zoom All buttons. The latter is useful for viewing your whole waveform.

Note that the Zoom buttons do not affect the Scale. You may need to modify both Scale and Zoom to get a satisfactory view of your waveform.

The Start Time is used to shift the waveform to the left or right. The Start Time can be modified in three ways: by setting a value (in cycles) directly in the text box, by clicking the +Div or -Div buttons, which shift the waveform by one division, or by clicking on the Zero button which returns the start time to 0. Note that the Shift-Right and Shift-Left key combinations can also be used instead of the +Div and -Div buttons. Similarly, Ctrl-Z zeros the start time.

Note that the View menu duplicates many of the button interfaces on the panel.

Once a waveform is displayed, right-clicking somewhere in the waveform displays a pop-up menu where many useful actions can be performed. The waveform can be deleted, edited (the dialog is brought up again where the port pin and stimulus file, if applicable, can be changed), and other functions (described below).

Double clicking (with the left button) on a waveform automatically brings up the edit dialog.

Output Waveforms

While reading this section, you may find it useful to create a Port A pin 6 waveform (PA6) and to load the EX1.S19 file for simulation.

Output waveforms are displayed with a black background in the display panel. When an output-only pin is selected in the Add Waveform... dialog, the Stimulus File box in this dialog is disabled to indicate that stimulus only applies to input pins.

Port pins that are bidirectional will have the Stimulus File text box enabled. Note the following:

Currently, there is no way to reverse a pin's direction in the middle of simulation. It is possible, however, to instantiate two separate waveforms of the same port pin, one as input and one as output (assuming the pin is bidirectional).

As an illustration, create the PA6 waveform, as suggested above, and load the EX1.S19 file using the LOAD BUFFALO command. Then, type GO 1040 to begin simulation. Once simulation completes, switch to the waveform I/O panel and press the Zoom All button. You should see three edges generated on PA6, approximately 2000 cycles apart (setting the Scale to 1000 makes this easier to see). Study the EX1.C file to see how the source corresponds to the observed output.

Input Waveforms

While reading this section, you may find it useful to create a Port A pin 0 waveform (PA0) and to load the EX2.S19 file for simulation. For PA0, set the stimulus file to EX2.STI from the EVBU source distribution.

Input waveforms are displayed with a grey background in the display panel. When an input or bidirectional pin is selected in the Add Waveform... dialog, the Stimulus File box in this dialog is enabled to allow you to specify a stimulus file that defines the waveform. As mentioned in the previous section, if the Stimulus File text box is left blank for a bidirectional pin, the pin is assumed to be an output, otherwise it is assumed to be an input.

The format of a stimulus file is simple: it is a plain text file with two columns. The first column is the cycle number, the second is the value of the waveform at that cycle time. For example:

0 0
100 1
900 0
1000 1

This stimulus file begins the waveform with 0, then a rising edge occurs at cycle 100, a falling edge at cycle 900, and a final rising edge at cycle 1000.

Blank lines and lines beginning with '#' (comment lines) are ignored. The cycle times must be written in strictly ascending order. Cycle times must be written in base 10.

Examine the EX2.STI file and use it as stimulus for Port A pin 0 (PA0) before you run the EX2.S19 example file (see EX2.C for the source code). This example should clarify the above concepts.

Once the stimulus file is loaded, further changes to the file are not automatically reflected in the stimulus waveform. To effect a change, the waveform must be reloaded from the source file. This can be accomplished by right-clicking on the waveform and selecting Reload Stimulus from the pop-up menu.

Simulation Details

The waveform I/O display is tied to the cycle counter of the simulator. Note that this is not the same as the TCNT timer counter register. The simulator maintains its own cycle count that does not roll over beyond 0xFFFF as it has many more bits of precision (in fact, it is a Python 'long' type hence has a really really large number of bits). Note that the CYC BUFFALO command manipulates the simulator's cycle count, hence the waveform I/O cycle count is also affected.

In practice, it is expected that programs are started with the GO command. This serves to automatically reset the cycle counter to 0. For waveform I/O, this means that input stimulus files are applied starting at a cycle number of 0, and that output waveforms are cleared (i.e., all previous output activity is discarded).

All of the other methods of resuming program execution (e.g., the P command, the STOPAT command, etc.) do not reset the cycle counter and simply cause waveform I/O to continue where the last cycle count left off.

Cursors

The waveform display supports two cursors (or markers, as they are sometimes called) that can help locate events and measure the relative times of two events. A cursor is simply a vertical line that appears on all waveform windows and whose location (in time, measured in cycles) appears at the top right of the panel window. The difference in time between the two cursors is displayed in the C2-C1 box.

By default, the cursors are not displayed. Both cursor 1 and cursor 2 may be displayed manually from the View menu (or by the shorcut keys Ctrl-1 and Ctrl-2) or by right-clicking on a waveform and selecting one of the items from the pop-up menu.

The EX1.S19 example from above may be helpful at this point. Create a PA6 waveform and run EX1.S19 from address 0x1040. Click the Zoom All button to see the whole waveform. Just prior to the first rising edge, right-click on the waveform and select Cursor 1 Here. You will see a red cursor appear where you clicked. You will see the time location of cursor 1 in the C1 text box at the top right.

The cursors may be moved manually by left-clicking and dragging the top of the cursor (i.e., the pointer-shaped thingy).

Right-click again on the waveform (anywhere) and select Cursor 2 Here. A cyan cursor should appear, and you should see the difference in time between the two cursors in the C2-C1 box.

Another interesting way of positioning the cursors is by "snapping" them to an edge. Right-click again just prior to the first rising edge and select Cursor 1 to Next Edge. Cursor 1 will automatically move to the exact cycle of the next rising (or falling) edge of the waveform. Repeat this step for cursor 2 just prior to the subsequent falling edge. You will see that the duration of the pulse is (C2-C1) 2043 cycles.


Back to the top-level documentation

© 1999-2002, Copyright by Andrew Sterian; All Rights Reserved. mailto: steriana@claymore.engineer.gvsu.edu