HP 64700 User Manual

Page 1
1 HP 64000-UX
CASE Solutions for Microprocessors
HP 64700-Series Analyzer
Softke y Interface User’s Guide
HP Part No. 64700-97005 Printed in U.S.A. September 1992
Page 2
Page 3
1Notice Hewlett-Packard makes no warranty of any kind with regard to
this material, including, but not limited to, the implied warranties of merchantability a nd fitness for a partic ular purpose.
Hewlett-Pack a rd s hall not be liabl e for errors contained here in or for incidental or consequential damages in c onnec tion with the f urnishing, performance, or use of thi s material.
Hewlett-Packard assumes no responsibility f or the use or reliability of its s oftware on equipment that is not furnis hed by Hewlett-Packard.
© Copy right 1989, 1990, 1992 Hewlett-Packard Company. This document contains proprietary i nformation, which is
protec te d by copyright. Al l rights are reserv ed. No part of this document may be photocopied, reproduce d or transla te d to another language without the prior written consent of Hewlett-Packard Company. The information contained in this document is subject to change without notice.
AdvanceLi nk, Vectra and HP are trademarks of Hewlett-Pac k ard Company.
IBM and PC AT are regi stered trademarks of International Busines s Machines Corporation.
MS- DOS is a trademark of Mi crosoft Corporation. SPARCsystem is a trademark of Sun Micros ystems , Inc. UNIX is a regi stered trademark of UNIX System Laboratories Inc.
in the U. S.A. and other countries. TORX is a registered trademark of Camcar Division of Textron,
Inc.
Hew lett-Pac kar d P.O. Box 2197 1900 Gar den of the God s Road Colora do Springs, CO 80901-2197, U.S.A.
RESTRICTED RIGHTS LEGEND Use, duplication, or dis closure by the U.S. Gov e rnment is subject to restrictions as se t forth in subparagraph (c) (1)(ii) of the Rights in Techni cal Data a nd
Page 4
Computer Software Clause at DFARS 252.227-7013. Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A. Rights for non-DOD U.S. Gov ernment Departments and Agencies are as s et f orth in FAR
52.227-19(c)(1,2).
1Printing History New editions are complete revisions of the manual. The date on
the title page changes only w hen a new edition is published. A software cod e may be printed before the date; thi s indicates the
versi on level of the software product at the time the manual was issued. Many product upda te s and fixes do not require manual changes and, conversely, manual corrections may be done without accompanying product changes. Therefore, do not expect a one to one correspondence between product updates and manual revis ions.
Edition 1 Edition 2 Edition 3
Edition 4
64740-90910 E1188, November 1988 64740-97002, August 1989 64700-97001, February 1990
64700-97005, September 1992
Page 5
Using this Manual
This manual will show you how to use the HP 64700-Series analyzer with the host computer Sof tkey Interfac e.
This manual will:
Briefly introduce the analyzer and its f eatures.
Show you how to use the ana lyzer i n its simplest, power-up condition. From there, it will progressively show you how and why y ou would use additional trace commands.
Show you how to use the trace di splay options.
Show you how to connect the external analyzer probe to target system signals a nd how to configure and use the external analyzer.
Show you how to set up the ana lyzer trigger to break the emulator into the monitor program.
Show you how to drive external Coordinated Measurement Bus (CMB) or BNC trigger signals with the analyzer trigger.
Show you how to use the Timing Analyzer Sof tkey Interface.
This manual will not:
Show you how to use every Softkey Interface command and option; the Softkey Interface is described in the Softkey Interface Reference.
Show you how to use coordinate measurements betw een multiple emul ators; specifi cs on b ackground, spe cifications and use are de scribed in the "C oordinated
Page 6
1Organization
Chapter 1 Introducing the Analyzer. This chapter lists the basic features of
Chapter 2 Getting Started. Thi s chapter shows you how to use the analyzer
Chapter 3 Displaying T races. This chapter describes options available when
Chapter 4 Making Software Performance Measurements. This chapter
Measurements" chapter of the HP64700-Series Emulators Softkey Interface Reference.
the analy zer. The foll owing chapters show y ou how to use these features.
f rom its simplest pow e r-up condition to specifying trigger conditions , storage qualifiers, prestore q ua lifiers, and count qualifiers.
dis pla ying the trace.
describes software performance measurements, d escribes the steps in making measurements with the Software Performance Measurement Tool (SPMT), and shows you example measurements made on the demo program.
Chapter 5 Using the External Analyzer. T his chapter shows you how to
connect the external analyzer probe to target system s ignals and how to config ure and use the externa l analyzer.
Chapter 6 Timing: Introduction. This chapter introduces the exte rna l timing
analyzer and describes its features.
Chapter 7 Tim ing: Getting Started. Thi s chapte r shows you how to start up
the timing analyzer S oftkey Interface and how to do a simple timing measurement.
Page 7
Chapter 8 Timing: Using the Analyzer. This c hapter reviews the functions of
the timing analyzer, gives specific information on the use of each of the functions, and g i ves examples.
Chapter 9 Timing: Commands. This chapter furnishes a reference for ea ch of
the timing analyzer S oftkey Interface commands, d escribes the command usi ng syntax diagrams , provides a detailed descri ption for eac h of the parameters, and follow s up with examples f or the use of the c ommand.
Appendix A External Analyzer Specif ications.
Appendix B Timing Output and Display.
Appendix C Timing Messages.
Appendix D Acc ur ate Timing Measureme nts.
Page 8
1Conventions Example commands throughout the manual use the foll owi ng
conventi ons:
bold Commands, options, and parts of command
syntax.
bold italic
Commands, options, and parts of command sy ntax which may be entered by pressing softkeys.
normal User specified parts of a command.
$ Represents the HP-UX prompt. Co mmands
which foll ow the " $" are entered at the HP-UX prompt.
<RETURN> The new line key.
Page 9
Contents
1 Introducing the Analyzer
Analyzer Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Simple Measurements . . . . . . . . . . . . . . . . . . . . . . . 1-1
Trace Storage, Pre store, a nd Count . . . . . . . . . . . . . . . 1-1
Sequencer and Windowing . . . . . . . . . . . . . . . . . . . . 1-2
Coordinated Measurements . . . . . . . . . . . . . . . . . . . 1-2
Performance Measurements . . . . . . . . . . . . . . . . . . . 1-2
External Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Timing Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
2 Getting Star ted
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
The Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Description of the Sample Program . . . . . . . . . . . . . . . 2-2
Before You Can Use the Analyzer . . . . . . . . . . . . . . . . . 2-6
Load the Program . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Run the Program . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
The Default Trace Command . . . . . . . . . . . . . . . . . . . . 2-6
Displaying the Trace . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Expressions in Trace Commands . . . . . . . . . . . . . . . . . . 2-8
Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Qualifying the Trigger Condition . . . . . . . . . . . . . . . . . 2-10
Trigger Position . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Trace List Description . . . . . . . . . . . . . . . . . . . . . . 2-11
Modifying Previous Trace Commands . . . . . . . . . . . . . . 2-14
Command Recall . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
Trace Modify C ommand . . . . . . . . . . . . . . . . . . . . . 2-14
Spe cifying Storage Qualifiers . . . . . . . . . . . . . . . . . . . 2-15
Pres toring States . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
Changing the Count Qualifier . . . . . . . . . . . . . . . . . . . 2-18
Turning Counting Off . . . . . . . . . . . . . . . . . . . . . . 2-19
Contents-1
Page 10
Triggering on the N th Oc currenc e of a State . . . . . . . . . . . 2-19
Triggering on Multiple States . . . . . . . . . . . . . . . . . . . 2-20
Using Address, Data, and Status Qualifiers . . . . . . . . . . . 2-21
Using the Sequencer . . . . . . . . . . . . . . . . . . . . . . . . 2-22
Specifying a Restart Term . . . . . . . . . . . . . . . . . . . . 2-24
Tracing "Windows" of Activity . . . . . . . . . . . . . . . . . . . 2-25
Storing and Loading Trace Commands . . . . . . . . . . . . . . 2-27
Trace Commands in the Ev ent Log Display . . . . . . . . . . . 2-28
Storing and Loading Trace s . . . . . . . . . . . . . . . . . . . . 2-28
Stopping the Trace . . . . . . . . . . . . . . . . . . . . . . . . . 2-29
Tracing on Halt . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
3 Displaying Traces
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Display Positioning . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Up/Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Left/Right . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Changing the Trace Depth . . . . . . . . . . . . . . . . . . . . . . 3-3
Displaying About a Line Number . . . . . . . . . . . . . . . . . . 3-4
Disassembling the Trace Information . . . . . . . . . . . . . . . . 3-5
Displaying in Absolute Format . . . . . . . . . . . . . . . . . . . 3-6
Displaying in Mnemonic Format . . . . . . . . . . . . . . . . . . 3-7
Including High-Level S ource Lines . . . . . . . . . . . . . . . . . 3-8
Additional Options w ith Sourc e On/Only . . . . . . . . . . . . 3-8
Inverse Video. . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Tabs Are. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Number of Source Line s. . . . . . . . . . . . . . . . . . . 3-9
Including Symbol Information . . . . . . . . . . . . . . . . . . . 3-10
Changing Column Widths . . . . . . . . . . . . . . . . . . . . . 3-11
Displaying Count Absolute/Relative . . . . . . . . . . . . . . . 3-12
Offsetting Address Information . . . . . . . . . . . . . . . . . . 3-13
Returning to the Default Trace Display . . . . . . . . . . . . . 3-14
Display ing External Analyzer Information . . . . . . . . . . . . 3-15
Trace Status Display . . . . . . . . . . . . . . . . . . . . . . . . 3-16
2-Contents
4 Making Software Performance Measurements
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Activity Measurements . . . . . . . . . . . . . . . . . . . . . . 4- 2
Memory Activity . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Page 11
Program Activity . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Duration Measurements . . . . . . . . . . . . . . . . . . . . . 4-2
Module Duration . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Module Usage . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Using the Software Performance Meas urement Tool . . . . . . . 4- 5
Setting Up the Trace Command . . . . . . . . . . . . . . . . . 4-5
Activity Measurements . . . . . . . . . . . . . . . . . . . . . 4- 5
Using Trace Commands Other than the Default. . . . . 4-6
Duration Measurements . . . . . . . . . . . . . . . . . . . . 4-6
Initializing the Performance Measurement . . . . . . . . . . . 4- 6
Default Initialization . . . . . . . . . . . . . . . . . . . . . . 4-7
Initialization with User Defined Ranges . . . . . . . . . . . 4-7
Address Range File Format. . . . . . . . . . . . . . . . . 4-7
Time Range File Format. . . . . . . . . . . . . . . . . . . 4-8
Selecting Duration Measurements . . . . . . . . . . . . . . 4-8
Initialization with Global Symbols . . . . . . . . . . . . . . 4-9
Initialization with Local Symbols . . . . . . . . . . . . . . . 4-9
Restoring the Current Mea surement . . . . . . . . . . . . . 4- 9
Running the P erformance Measurement . . . . . . . . . . . 4-10
Ending the Performance Measurement . . . . . . . . . . . . 4-10
Using the "perf 32" Report Generator . . . . . . . . . . . . . 4-11
Options to "perf32" . . . . . . . . . . . . . . . . . . . . . . 4-11
Interpreting Reports of Acti vity Measurements . . . . . 4-12
Memory Activity. . . . . . . . . . . . . . . . . . . . . . 4-12
Program Activity. . . . . . . . . . . . . . . . . . . . . . 4-12
Relative. . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Absolute. . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Mean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Standard Deviation. . . . . . . . . . . . . . . . . . . . . 4-13
Symbols Within Range. . . . . . . . . . . . . . . . . . . 4-13
Additional Symbols for Address. . . . . . . . . . . . . 4-13
Relative and A bsolute Counts. . . . . . . . . . . . . . 4-14
Error Tolerance and Confidence Level. . . . . . . . . 4-14
Interpreting Reports of Duration Measurements . . . . . 4-15
Number of Intervals. . . . . . . . . . . . . . . . . . . . 4-15
Max imum Time. . . . . . . . . . . . . . . . . . . . . . . 4-15
Minimum Time. . . . . . . . . . . . . . . . . . . . . . . 4-15
Average Time. . . . . . . . . . . . . . . . . . . . . . . . 4-15
Standard Deviation. . . . . . . . . . . . . . . . . . . . 4-16
Error Tolerance and Confidence Level. . . . . . . . . 4-16
Ex amples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17
Contents-3
Page 12
The SPMT Demo Program . . . . . . . . . . . . . . . . . . . 4-17
Example of Compiling and Executing the Demo Program 4-19
Copying the Demo Program. . . . . . . . . . . . . . . . 4-19
Compiling the Demo Program. . . . . . . . . . . . . . 4-19
Copying the Default Emulator Configuration File. . . 4-19
Entering the Emulation System. . . . . . . . . . . . . . 4-20
Configuring the Emulator. . . . . . . . . . . . . . . . . 4-20
Loading the Demo Program. . . . . . . . . . . . . . . . 4-20
Running the Demo Program. . . . . . . . . . . . . . . 4-20
Activity Measurement Example . . . . . . . . . . . . . . . . 4-21
Duration Measurement Ex ample s . . . . . . . . . . . . . . . 4-30
Prefetch and Recursion Considerations . . . . . . . . . . 4-30
Example Duration Measurement . . . . . . . . . . . . . . 4-32
5 Using the Ex ter nal Analyz er
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
Before You Can Use the External Analy zer . . . . . . . . . . . . 5-1
Assembling the Analyzer Probe . . . . . . . . . . . . . . . . . 5-2
Connecting the P robe to the Emulator . . . . . . . . . . . . . 5-3
Connecting P robe Wires to the Target System . . . . . . . . . 5-6
Configuring the External Analyzer . . . . . . . . . . . . . . . . . 5-7
Should Emulation Control the External Bits? . . . . . . . . . 5-8
Threshold Voltage? . . . . . . . . . . . . . . . . . . . . . . . . 5-8
External Analyzer Mode? . . . . . . . . . . . . . . . . . . . . . 5-8
Slave Clock Mode for External Bits? (State Mode Only) . . . 5-9
Edges of J (K,L,M) clock used for slave clock? . . . . . . 5-13
Defining External Labels . . . . . . . . . . . . . . . . . . . . 5-13
Configuring Interactive Measurements . . . . . . . . . . . . . . 5-14
Using the Analy zer Trigger to Drive the Ex ternal Analyzer 5-15
Saving the Configuration . . . . . . . . . . . . . . . . . . . . . . 5-16
4-Con ten t s
6 T im ing: Introduction
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Features of the Timing Analyzer . . . . . . . . . . . . . . . . . . 6-1
Measurement Modes . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Standard Mode . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Glitch Capture Mode . . . . . . . . . . . . . . . . . . . . . . 6-3
Trace Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
The Trace Specification . . . . . . . . . . . . . . . . . . . . . . 6-4
The Format Specification . . . . . . . . . . . . . . . . . . . . . 6-4
The Post-Proc ess Specification . . . . . . . . . . . . . . . . . . 6-4
Page 13
The Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . 6-5
The Trace List . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
7 T iming: Getting Started
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
Prerequisites for Using the Timing Analy z er Softkey Interface . 7-1
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Entering the Timing Analyzer Softkey Interface . . . . . . . . . . 7-2
Making a Simple Timing Measurement . . . . . . . . . . . . . . . 7-3
Entering Numerical Values . . . . . . . . . . . . . . . . . . . . . 7-5
8 T im ing: Using the Analyzer
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
Moving Around the Analyzer Interf ace . . . . . . . . . . . . . . . 8-2
Referencing Analyzer Signals . . . . . . . . . . . . . . . . . . . . 8-3
Specifying Threshold Voltages . . . . . . . . . . . . . . . . . . 8-3
Testing for Signal Activity . . . . . . . . . . . . . . . . . . . . . 8-4
Managing Labels . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Defining Labels . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Modifying Label Definitions . . . . . . . . . . . . . . . . . 8-5
Deleting Labels . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Renaming Labels . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Selecting Measurement Options . . . . . . . . . . . . . . . . . . . 8- 6
Selecting the Timing Analyzer Mode . . . . . . . . . . . . . . 8-6
Standard Mode . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Glitch Capture Mode . . . . . . . . . . . . . . . . . . . . . . 8-6
Selecting the Sample Period or Rate . . . . . . . . . . . . . . 8-7
Specifying the Trigger Condition . . . . . . . . . . . . . . . . . . 8-7
Trigger on Anything . . . . . . . . . . . . . . . . . . . . . . . . 8-7
Trigger on Pattern . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
Trigger on Pattern Duration . . . . . . . . . . . . . . . . . . . 8-8
Greater Than Duration . . . . . . . . . . . . . . . . . . . . 8-8
Less Than Duration . . . . . . . . . . . . . . . . . . . . . . 8-9
Trigger on Any Glitch . . . . . . . . . . . . . . . . . . . . . . . 8-9
Qualify ing Patterns . . . . . . . . . . . . . . . . . . . . . . . . 8-9
Trigger Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10
Trigger Positioning . . . . . . . . . . . . . . . . . . . . . . . 8-10
Modifying the Trigger Condition . . . . . . . . . . . . . . . . 8-10
Starting and Stopping a Trace . . . . . . . . . . . . . . . . . . . 8-10
Ex ecute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
Ex ecute Repetitively . . . . . . . . . . . . . . . . . . . . . . . 8-11
Contents-5
Page 14
Halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
Using the Timing Diagram . . . . . . . . . . . . . . . . . . . . . 8-12
Timing Diagram Organization . . . . . . . . . . . . . . . . . 8-12
Signal Labels. . . . . . . . . . . . . . . . . . . . . . . . 8-13
Waveform. . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
Sample Period. . . . . . . . . . . . . . . . . . . . . . . . 8-13
Mark Locations. . . . . . . . . . . . . . . . . . . . . . . 8-13
Statistical Summary. . . . . . . . . . . . . . . . . . . . . 8-13
Reference Points. . . . . . . . . . . . . . . . . . . . . . 8-13
Memory Reference. . . . . . . . . . . . . . . . . . . . . 8-14
Presenting Signals . . . . . . . . . . . . . . . . . . . . . . . . 8-14
Moving the Cursor . . . . . . . . . . . . . . . . . . . . . . . . 8-15
Showing Levels at the Cursor . . . . . . . . . . . . . . . . . . 8-16
Magnifying the Diagram . . . . . . . . . . . . . . . . . . . . . 8-16
Changing the Waveform Size . . . . . . . . . . . . . . . . . . 8-16
Scrolling the Diagram . . . . . . . . . . . . . . . . . . . . . . 8-17
Using the Trace List . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
Trace List Organization . . . . . . . . . . . . . . . . . . . . . 8-17
Sample Number. . . . . . . . . . . . . . . . . . . . . . . 8-18
Reference Points. . . . . . . . . . . . . . . . . . . . . . 8-18
Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Sample Period. . . . . . . . . . . . . . . . . . . . . . . . 8-19
Statistical Summary. . . . . . . . . . . . . . . . . . . . . 8-19
Cursor. . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Trace Data. . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Display ing Trace Data . . . . . . . . . . . . . . . . . . . . . . 8-19
Moving the Cursor . . . . . . . . . . . . . . . . . . . . . . . . 8-20
Scrolling the Trace List . . . . . . . . . . . . . . . . . . . . . 8-21
Analyzing Trace Memory . . . . . . . . . . . . . . . . . . . . . . 8-21
Locating Events in Trace Memory . . . . . . . . . . . . . . . 8-21
Marking Events . . . . . . . . . . . . . . . . . . . . . . . . . . 8-23
Processing for Data . . . . . . . . . . . . . . . . . . . . . . . 8-25
Determining Intervals . . . . . . . . . . . . . . . . . . . . . . 8-25
Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-26
Choosing Statistics Types . . . . . . . . . . . . . . . . . . 8-26
Interval Statistics . . . . . . . . . . . . . . . . . . . . . 8-26
Occurrence Statistics . . . . . . . . . . . . . . . . . . . 8-26
Ex c luding Samples . . . . . . . . . . . . . . . . . . . . . . 8-26
Logging Statistics . . . . . . . . . . . . . . . . . . . . . . . 8-27
Comparing Curre nt a nd Stored Measurements . . . . . . . . . 8-28
6-Con t en ts
Page 15
Storing Measurements . . . . . . . . . . . . . . . . . . . . . . 8-28
Selecting a Compare File . . . . . . . . . . . . . . . . . . . . 8-28
Pres enting Stored Signals . . . . . . . . . . . . . . . . . . . . 8-29
Copy Analyzer Data . . . . . . . . . . . . . . . . . . . . . . . . . 8-30
Copying Specifications . . . . . . . . . . . . . . . . . . . . . 8-30
Copying Trace Data . . . . . . . . . . . . . . . . . . . . . . . 8-31
Copying Measurement Data . . . . . . . . . . . . . . . . . . 8-32
Ending a Session . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-32
Releasing the System . . . . . . . . . . . . . . . . . . . . . . 8-32
Ending to Continue Later . . . . . . . . . . . . . . . . . . . . 8-33
Ending and Blocking other Access . . . . . . . . . . . . . . . 8-33
Selecting the Measurement System or Another Module . . 8-33
9 Timing : Commands
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Softkey Interface Features . . . . . . . . . . . . . . . . . . . . . . 9-1
Softkeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Command Completion . . . . . . . . . . . . . . . . . . . . . . 9-1
Command Word Selec tion . . . . . . . . . . . . . . . . . . . . 9-1
Command Line Recal l . . . . . . . . . . . . . . . . . . . . . . . 9 -2
Command Line Erase . . . . . . . . . . . . . . . . . . . . . . . 9-2
Multiple Commands on One Line . . . . . . . . . . . . . . . . 9-2
Change Directory . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Filters and Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Command Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Help Command . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Oval-shaped Symbols . . . . . . . . . . . . . . . . . . . . . . . 9-3
Rectangular-shaped Symbols . . . . . . . . . . . . . . . . . . . 9-3
Circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Summary of Commands . . . . . . . . . . . . . . . . . . . . . . . 9-4
Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . 9- 6
activity_test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8
configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
CURSOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
define . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-24
diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-25
Contents-7
Page 16
display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-26
end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-28
execute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-31
find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33
format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-38
halt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-39
halt_repetitive_execution . . . . . . . . . . . . . . . . . . . . . . 9-40
help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-44
indicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-46
list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-48
magnify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-49
mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-51
mode_is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-58
modify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-59
pod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-60
pod_command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-61
post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-63
present . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-64
process_for_data . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-68
QUALIFIER . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-72
rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-75
< ROLL> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-76
sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-78
statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-80
threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-83
trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-85
trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-86
wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-90
wav eform_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-92
8-Contents
A External Analyzer Specif ications
General Specifications . . . . . . . . . . . . . . . . . . . . . . A-1
State Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Timing Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . A-2
B Timing Output and Diagrams
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
Timing Diagram Outputs . . . . . . . . . . . . . . . . . . . . . . B-1
Graphics Timing Diagrams . . . . . . . . . . . . . . . . . . . . . B-2
TERM Shell Variable . . . . . . . . . . . . . . . . . . . . . . B-2
WMSCRN Shell Variable . . . . . . . . . . . . . . . . . . . . B-3
Page 17
WMBASEFONT Shell Variable . . . . . . . . . . . . . . . . B-3
Required Filesets . . . . . . . . . . . . . . . . . . . . . . . . . B-4
Using the Timing Analyzer Under the X Window System . . . B-4
DISPLAY Shell Variable . . . . . . . . . . . . . . . . . . . . B-4
WINDOWID Shell Variable . . . . . . . . . . . . . . . . . . B-5
LINES and COLUMNS Shell Variables . . . . . . . . . . . B-5
X Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-5
Remote Connections . . . . . . . . . . . . . . . . . . . . . . B-7
ASCII Timing Diag rams . . . . . . . . . . . . . . . . . . . . . . B-8
Default ASCII Diagram . . . . . . . . . . . . . . . . . . . . . B-8
Customizing the ASCII Diagram . . . . . . . . . . . . . . . . B-9
Waveform Sizes and ASCII Characters . . . . . . . . . . B-9
Row Locations for Mark Indicators . . . . . . . . . . . . B-10
Row Locations for Cursor Indicators . . . . . . . . . . . . B-10
Characters to Define the Cursor . . . . . . . . . . . . . . B-11
Assigning the TIMING_ASCII Shell Variable . . . . . . B-11
Printer Requirements . . . . . . . . . . . . . . . . . . . . . . . . B-12
Using Measurement Data in Hexadecimal . . . . . . . . . . . . B-13
Understanding the Measurement Data Output . . . . . . . B-13
Standard Mode Data Format . . . . . . . . . . . . . . . . . . B-13
Glitch Capture Mode Data Format . . . . . . . . . . . . . . B-14
Comparing Measurement Data to a Trace List . . . . . . . . B-15
C Timing M essages
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Status Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Informational Messages . . . . . . . . . . . . . . . . . . . . . . C-3
"Waiting for trigger" . . . . . . . . . . . . . . . . . . . . C-3
"Ex te rnal trace running" . . . . . . . . . . . . . . . . . C -3
"External trace complete" . . . . . . . . . . . . . . . . . C-4
"External trace halted" . . . . . . . . . . . . . . . . . . C-4
Error Message s . . . . . . . . . . . . . . . . . . . . . . . . . . . C- 4
D Accurate T im ing M easurem ents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1
Time Interval Resolution . . . . . . . . . . . . . . . . . . . . . . D-1
Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-2
Sample Period . . . . . . . . . . . . . . . . . . . . . . . . . D-2
Interchannel Skew . . . . . . . . . . . . . . . . . . . . . . D-2
Memory Depth . . . . . . . . . . . . . . . . . . . . . . . . D-2
Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-3
Contents-9
Page 18
Illustrations
Improving the Accuracy of Time Interva l Measurements . . . D-3
Improving the Accuracy of Mean Value Measurements . . . . D-4
Accuracy of S tandard Deviation Measurements . . . . . . . . . D-5
Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-5
Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-5
Statistical Errors Caused by Sampling Process . . . . . . . . . . D-6
Figure 2-1. Pseudo-Code Algorithm of Sample Program . . . . 2-3
Figure 2-2. Sample Program Listing . . . . . . . . . . . . . . . . 2-4
Figure 2-3. Sample Program Listing (Cont’d) . . . . . . . . . . . 2-5
Figure 3-1. Program Used for Example Display s . . . . . . . . . 3-2
Figure 4-1. Memory Activity and Program Activity . . . . . . . . 4-3
Figure 4-2. Demo Program Function Calls . . . . . . . . . . . 4-18
Figure 4-3. Example Activity Measurement . . . . . . . . . . . 4-23
Figure 4-4. Prefetch Correction . . . . . . . . . . . . . . . . . . 4-30
Figure 4-5. Example Duration Measurement . . . . . . . . . . 4-34
Figure 4-5. Example Duration Measurement (Cont’d) . . . . . 4-35
Figure 5-1. Assembling the Analyzer Probe . . . . . . . . . . . . 5-2
Figure 5-2. Attaching Grabbers to Probe Wires . . . . . . . . . . 5-3
Figure 5-3. Removing Cover to Emulator Connector . . . . . . 5-4
Figure 5-4. Connecting the P robe to the Emulator . . . . . . . . 5 -5
Figure 5-5. Connecting the P robe to the Targ e t System . . . . . 5 -6
Figure 5-6. Mixed Clock Demultiplexing . . . . . . . . . . . . 5-10
Figure 5-7. Slave Clocks . . . . . . . . . . . . . . . . . . . . . . 5-11
Figure 5-8. True Demultiplex ing . . . . . . . . . . . . . . . . . 5-12
Figure 5-9. Interactive Measurement Configuration . . . . . . 5-15
Figure 6-1. Standard Data Acquisition Mode . . . . . . . . . . . 6-3
Figure 6-2. Glitch Capture Data Acquisition Mode . . . . . . . 6-4
Figure 8-1. Timing Diagram Organization . . . . . . . . . . . . 8-12
Figure 8-2. Trace List Organization . . . . . . . . . . . . . . . 8-18
Figure 8-3. Comparing Stored and Current Traces . . . . . . . 8-29
10-Con ten t s
Page 19
Tables
Table 9-1. Summary of Commands . . . . . . . . . . . . . . . . . 9- 4
Table 9-2. Command Assignments . . . . . . . . . . . . . . . . . 9-5
Contents-11
Page 20
1Notes
12-Contents
Page 21
I ntroducing the Analyzer
This manual describes the HP 64700-Series analyzer. Each HP 64700-Series emulator contains an emulation analyzer. Your emulator may optionally contain an e xternal analyzer. (If your emulator contains an external analyzer, an "L" suffix appears on the serial number tag, for example, "64742AL SN ...".)
The emulation analyzer captures emula tor b us cycle information synchronously with the processor’s clock signal. A trace is a collection of these ca pture d states . The trigger state specifies when the trace measurement is taken. The e xternal analyzer captures activ ity on signals exte rnal to the emula tor, typica lly other target system signals.
The analyzer commands are the same in every emula tor; consequently, this manual is shipped with every HP 64700-Series emulator ordered with the Softkey Interface.
1
1Analyzer Features This chapter lists basic features of the HP 64700-Series analyzer.
The chapters which follow show you how to use these features.
Simple Measurements The default condi tion of the analyzer allows you to perform a
simple measurement by entering a simple " trac e" c ommand. You can add qualifiers to the trace command to specify when execution should be traced and which bus cycle states should b e stored.
Trace Storage,
Prestore, and Count
The analyzer can store up to 1024 states in trace memory. These state s can be normal storage states or prestore states (states which precede normal storage states ). A count q ua lifier may be as soci ated with normal storage states; you can specify that the
Introduction 1-1
Page 22
anal yzer count in either time or the occurrences of some state. When counts are specifie d, only 512 states can be stored.
Sequencer and
Windowing
Coordinated
Measurements
Perform ance
Measurements
The analyzer’s seq uenc er al lows you to trigger after a sequence of state s are captured. Up to 7 sequence terms (the last of w hich i s the trigger te rm), each with an option oc currence count, a re avai l abl e. A sequence restart term is also av ail abl e.
Windowing refers to the ability to capture activity between one state and another. Up to 4 sequence terms are available when windowing is i n e ffect.
When multiple HP 64700-Series emulators are connecte d vi a the Coordinated Measurement Bus (CMB), you can use the analyzer to trigger the analyzers of other emulators. You ca n also use the anal yzer to trigger i nstruments connecte d to the BNC port. Convers e ly, analy zer measurements may be started by other emulators and instruments.
The Software Performance Measurement Tool (SPMT), whic h is part of the Softkey Interface, allows you to make measurements on the performance of your programs. You can meas ure activity in address ranges , or you can measure the averag e time it takes during and betwee n exe cution of a program module.
External Analysis Your HP 64700-Series emulator may optionally contain an
external a naly zer. The external analyz er provid e s 16 external trace signals and two external clock inputs. You can use the external analyzer as an extension to the emulation analy zer, as an independent state analyzer, or as an i ndependent timing analyz er.
Timing Analyzer The timing analysis information is available through the Softk ey
1-2 Introduction
Interface timing analyz e r software residing on a HP-UX hos t. The software allows you to control the externa l timing analyzer, acquire timing measurements, analyze the trace measurements for specific occurrenc e s, display the informa tion in g ra phic or tabular form , and save the trace information for subsequent comparis ons.
Page 23
The list above is only a basic description of the HP 64700-Series anal yzer fe atures. T he chapters whi ch f ollow show you how to use these features.
Introduction 1-3
Page 24
1Notes
1-4 Introduction
Page 25
Getting Started
1Introduction This chapter shows you how to use the emulation analy zer f rom
within the Softke y I nterface. This c hapter desc rib es :
The sample program on which ex ample meas urements are made.
The de fault, pow er-up cond ition of the analyzer (including how to begin the trace measurement and display the trace).
Expressions in trace command quali fiers.
This chapter shows you how to:
2
Spe cify a sim ple trigger (and change the trigger position).
Spe cify a storage qualifier.
Use trace prestore.
Change the count qualifier.
Trigger on the Nth occurrence of some state.
Trigger on multiple states.
Use the sequencer.
Stop a tra ce measurement.
Getting Started 2-1
Page 26
1Prerequisites Before read ing thi s chapte r you should already know how the
emulator operates. You shoul d know how to us e the Softkey Interface, and how to control the e mulator from within the Softkey Interface. Refer to the appropriate Emulator Softkey Interface User ’s Guide manual to learn about the em ulator; then, return to this manual.
1The Sample
Program
Description of the
Sample Program
The sample program is used to illustrate analyzer examples. The sa mple prog ra m is written in ass embly la nguage so the disassembled trace listings will be more meaningful.
The examples in this chapter have been generated using a 68000 (HP 64742) emulator. The sample prog ram is written in 68000 as sembly language. (A simi lar program written in 80186 assembly language can be found i n the HP 64700-Series Emulators Terminal Interface Refere nce.)
It is not important that you know 68000 assembly language; however, you should unders ta nd wha t the various se ctions of the prog ram do and assoc iate these ta sks with the labels used in the prog ram.
You are encourag e d to rewrite the sam ple progra m in the assembly language appropriate for your emulator. Then, you can use your anal yzer to perform the examples shown in this chapter. Of course, the output of your commands will be different than those shown here.
A pseudo-code algorithm of the sample program is shown in fi gure 2-1.
2-2 Getting Started
Page 27
Initialize the stack pointer. AGAIN: Save the two previous random numbers. Call the RAND random number generator subroutine. Test the two least significant bits of the previous random number. If 00B then goto CALLER_0. If 01B then goto CALLER_1. If 10B then goto CALLER_2. If 11B then goto CALLER_3. CALLER_0: Call the WRITE_NUMBER subroutine. Goto AGAIN (repeat program). CALLER_1: Call the WRITE_NUMBER subroutine. Goto AGAIN (repeat program). CALLER_2: Call the WRITE_NUMBER subroutine. Goto AGAIN (repeat program). CALLER_3: Call the WRITE_NUMBER subroutine. Goto AGAIN (repeat program).
WRITE_NUMBER: Write the random number to a 256 byte data area, using the second previous random number as an offset into that area. RETURN from subroutine.
RAND: Pseudo-random number generator which returns a random number from 0-0FFH. RETURN from subroutine.
Figure 2-1. Pseudo-Code Algorithm of Sample Program
The sample program is not intended to re present a real routine. The program use s four different c allers of the WRITE_ NUMB ER subroutine to si mulate situations in real programs where routines are call e d from many di fferent places. An example later in this chapter shows you how to use the a na lyzer prestore fea ture to determine where a routine is c alled from.
An assembler listing of the sample program is shown in f igure 2-2. It is prov ided so that y ou can se e the addresses associated with the prog ram labels. The program area, which contains the instructions to be executed by the mi croproce ssor, is located at 400H when linking the program. The RES ULTS area, to which the random numbers are written, is located at 500H. The area which contains a variable used by the RAND subroutine and memory loca tions for the stack is located at 600H.
Getting Started 2-3
Page 28
Cmdline - as68k -Lh anly.s Line Address 1 XDEF START,AGAIN 2 XDEF RESULTS,RAND_SEED 3 SECT PROG,,C 4 00000000 2E7C 0000 01FC R START MOVE.L #STACK,A7 5 ********************************************* 6 * The next two instructions move the second 7 * previous random number into A1 (offset to 8 * RESULTS area, and the previous random 9 * number into D1. 10 ********************************************* 11 00000006 2241 AGAIN MOVE.L D1,A1 12 00000008 2200 MOVE.L D0,D1 13 ********************************************* 14 * RAND returns random number in D0. 15 ********************************************* 16 0000000A 6100 0044 BSR RAND 17 ********************************************* 18 * The following instructions determine which 19 * caller calls WRITE_NUMBER (depends on last 20 * two bits of the previous random number). 21 ********************************************* 22 0000000E 0801 0001 BTST #1,D1 23 00000012 6700 0006 BEQ ZERO_ONE 24 00000016 6000 000E BRA TWO_THREE 25 0000001A 0801 0000 ZERO_ONE BTST #0,D1 26 0000001E 6700 0012 BEQ CALLER_0 27 00000022 6000 0014 BRA CALLER_1 28 00000026 0801 0000 TWO_THREE BTST #0,D1 29 0000002A 6700 0012 BEQ CALLER_2 30 0000002E 6000 0014 BRA CALLER_3 31 ********************************************* 32 * The WRITE_NUMBER routine is called from 33 * four different places. The program is 34 * repeated after the subroutine return. 35 ********************************************* 36 00000032 6100 0016 CALLER_0 BSR WRITE_NUMBER 37 00000036 60CE BRA AGAIN 38 00000038 6100 0010 CALLER_1 BSR WRITE_NUMBER 39 0000003C 60C8 BRA AGAIN 40 0000003E 6100 000A CALLER_2 BSR WRITE_NUMBER 41 00000042 60C2 BRA AGAIN 42 00000044 6100 0004 CALLER_3 BSR WRITE_NUMBER 43 00000048 60BC BRA AGAIN 44 ********************************************* 45 * The WRITE_NUMBER routine writes the random 46 * number to the RESULTS area. The second 47 * previous number is the offset in this area. 48 ********************************************* 49 0000004A 1340 0000 R WRITE_NUMBER MOVE.B D0,RESULTS(A1) 50 0000004E 4E75 RTS 51 ********************************************* 52 * The RAND routine generates a pseudo-random 53 * number from 0-0FFH, and leaves the result 54 * in D0. 55 ********************************************* 56 00000050 2039 0000 0100 R RAND MOVE.L RAND_SEED,D0
2-4 Getting Started
Figure 2-2. Sample Program Listing
Page 29
57 00000056 C1FC 4E6D MULS.W #4E6DH,D0 58 0000005A 2040 MOVEA.L D0,A0 59 0000005C 41E8 0339 LEA 339H(A0),A0 60 00000060 2008 MOVE.L A0,D0 61 00000062 23C0 0000 0100 R MOVE.L D0,RAND_SEED 62 00000068 4240 CLR.W D0 63 0000006A 4840 SWAP D0 64 0000006C 0280 0000 00FF ANDI.L #000000FFH,D0 65 00000072 4E75 RTS 66 67 SECT DATA,,D 68 ********************************************* 69 * Random numbers written to this area. 70 ********************************************* 71 00000000 RESULTS DS.B 100H 72 ********************************************* 73 * Variable used in RAND subroutine and 74 * stack area. 75 ********************************************* 76 00000100 0000 0001 RAND_SEED DC.L 1 77 00000104 DS.L 3EH 78 000001FC STACK DS.W 2 79 END START
Figure 2-3. Sample Program Listing (Cont’d)
The sample program is assemble d and li nked with the following HP 64870 68000/10/20 Assembler/Linker/Librarian commands (w hich assume that /usr/hp64000/bin is defined in the PATH environment variable):
$ as68k -Lh anly.s > anly.lis <RETURN> $ ld68k -c anly.k -Lh > anly.map <RETURN>
The linker command file, anly.k, contains the information below .
name anly sect PROG=400h sect DATA=500h load anly.o end
Getting Started 2-5
Page 30
1Before You Can
Use the Analyzer
Before you can use the analyzer to perform measurements on the sa mple prog ra m, you must load and run the sample program. The following examples assume you are usi ng the default emulator configuration which maps locations 0 through 1F7FFH as emulation RAM and which specifies a reset stack pointer value of 1FFEH.
Load the Program If you have already assembl ed and linked the s ample program, you
can load the absolute file by entering the fol lowing c ommand:
load
anly <RETURN>
Run the Program To start the emulator exec uting the sample program, enter:
run from transfer_address
The status line will show that the emulator is "Running [the] user prog ram".
1The Default Trace
Command
The default trace command (shown below) will trigger on any state, store all captured state s, and count time . To trac e the states currently executi ng, e nter:
trace
A message will flash on the status line to show you that the "Emulation trace [has] started", and another message will show you when the "Trace [is] complete".
<RETURN>
Displaying the Trace To displa y the trace, enter:
display trace
<RETURN>
<RETURN>
2-6 Getting Started
Page 31
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative after 000424 0014 ORI.B #**,[A4] -----------­+001 000438 6100 BSR.W 000044A 600 nS +002 00043A 0010 0010 supr prog 400 nS +003 0006F8 0000 0000 supr data wr word 600 nS +004 0006FA 043C 043C supr data wr word 400 nS +005 00044A 1340 MOVE.B D0,00500[A1] 400 nS +006 00044C 0500 0500 supr prog 400 nS +007 00044E 4E75 RTS 400 nS +008 0005E0 B5B5 B5 supr data wr byte 400 nS +009 000450 2039 MOVE.L 0000600,D0 400 nS +010 0006F8 0000 0000 supr data rd word 400 nS +011 0006FA 043C 043C supr data rd word 400 nS +012 00043C 60C8 BRA.B 0000406 400 nS +013 00043E 6100 6100 unused prefetch 400 nS +014 000406 2241 MOVEA.L D1,A1 600 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace
run trace step display modify break end ---ETC--
The first column on the trace list contains the line number. The trigger i s always on line 0.
The sec ond column contains the address information associa ted with the trace states. Add resses in this column may be locations of instruction opcodes on fetch cycl es, or the y ma y b e source s or destinations of operand cycles.
The third column contains the data information assoc iated with the trace states.
The fourth column shows mnem onic information about the emulation bus cycle. The disassemb led instruction mnemonic is shown for opcode fetch cycles. T he data and mnemonic status ("0010 supr prog", for example) are shown for operand c ycles .
The fifth column show s the count information (time is counted by default). The trace list header indicates that each count is "relative" to the prev ious s tate.
If your emulator contains a n e xterna l analyzer, a sixth column shows the external data captured by the e xterna l analyzer. On 80-column display terminals, the external data will be off screen; use < CTRL> -F and < CTRL> -G to move the sc reen left and right.
Getting Started 2-7
Page 32
Sometimes, the trace will show opcode fetches for instruct ions whic h a re not ex ecuted becaus e of a transfer of execution to other addresse s (see line 13 in the previous trace list). This can happen with microprocessors like the 68000 and the 80186 because they have pipelined architectures or instruction queues which allow them to prefetch the next few instructions before the current instruction is finished executing.
You c a n use the <NEXT> and < PREV> keys to scrol l through the trace list a page at a time. The <uparrow> and < dow narrow > keys will scroll throug h the tra ce list a line at a time. You can also display the trace list starting with a specific line number (for example, display trace 100 < RETURN> ). Ref e r to the "Displaying Traces" chapter for more information the trace list display.
Note
1Expressions in
Trace Comma nds
When a trigger condition is found but not enough state s are captured to fill trace memory, the status line will show that the trace is still running. You can display all but the last captured state in thi s si tuation; you must halt the trace to dis play the last captured state.
When modify ing the analysis specification (as shown throughout the remainder of this chapter), you can enter expressions which consist of values, symbols, and operators.
2-8 Getting Started
Page 33
Values Value s are numbe rs in hexadecima l, de cimal, octal, or binary.
These number bases are specifi e d b y the following characters:
B b Binary (example: 10010110b).
Q q O o Octal (ex ample: 377o or 377q).
D d (default) Decimal (ex ample: 2048d or 2048).
H h Hexadec i mal (example : 0a7fh).
You mus t precede any he xadecimal num ber that begins with an A, B, C, D, E, or F with a zero.
Don’t care digits may be included in binary, octa l, or hexade cimal numbers and they are repre sented by the letters X or x. A zero must precede any numeric al value that begins with an "X".
Symbols A symbol database i s built when the absolute file is loaded into the
emulator. Both global and l ocal symbols can be used when entering expressions. Global symbols are entered as they appear in the source file or in the global symbols display. When spec ifying a local symbol, you must inc lude the name of the source file (anly.s ) as show n b e l ow.
anly.s:START
Operators Analysis s pecification expressions may contain operators. All
operations are carried out on 32-bit, two’s complement integers. (Values which are not 32 bits will be sign extended when expression evalua tion occurs.)
Getting Started 2-9
Page 34
The available operators are listed below in the order of evaluation precedence. Parentheses are also allowed in express ions to change the order of evaluation.
-, ~ Unary two’s complement, unary one’s
complement. The unary two’s complement operator i s not allowed on constants conta ining don’t care bits.
*, /, % Integer multiply, div i de, and modulo. These
operators are not allowed on constants conta ining don’t care bits.
+ , - Addition, subtraction. T hese operators are
not allowe d on consta nts containing don’t care bits.
& Bitwise AND.
| Bitwise inclusive OR.
Values, symbols, and operators may be used together in analy sis spec ific ation expressi ons. For example, if the local sy mbol exists, the following is a valid expression:
file.c:symb+0b67dh&0fff00h
1Qualifying the
Trigger Condition
Trigger Position The " after" option in the command above supplie s trigger posi tion
2-1 0 Getting Started
Suppose you w ant to look at the execution of the sample program after the address of AGAIN label (406H) occurs. To trigger on the address of label AGAIN, enter:
trace after
AGAIN <RETURN>
information. It says that sta te s capture d after the trigger should be sa ved; in other words , the trigger is pos itioned at the top of the trac e. You c an also specify that the trigge r be positioned in the middle of the trace (about) or at the end of the trace (before).
Page 35
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative after 000406 2241 MOVEA.L D1,A1 600 nS +001 000408 2200 MOVE.L D0,D1 400 nS +002 00040A 6100 BSR.W 0000450 400 nS +003 00040C 0044 0044 supr prog 400 nS +004 0006F8 0000 0000 supr data wr word 600 nS +005 0006FA 040E 040E supr data wr word 400 nS +006 000450 2039 MOVE.L 0000600,D0 400 nS +007 000452 0000 0000 supr prog 400 nS +008 000454 0600 0600 supr prog 400 nS +009 000456 C1FC MULS.W #04E6D,D0 400 nS +010 000600 064D 064D supr data rd word 400 nS +011 000602 8FD0 8FD0 supr data rd word 400 nS +012 000458 4E6D 4E6D supr prog 400 nS +013 00045A 2040 MOVEA.L D0,A0 400 nS +014 00045C 41E8 LEA.L 00339[A0],A0 400 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN
run trace step display modify break end ---ETC--
Trace List D escription In the preceding trace list, line 0 (labeled "after") shows the
beginning of the program l oop a nd line 2 shows the call of the RAND subroutine. The disassemb led mnemonics on lines 6, 9 , 13, and 14 show instructions which are executed in the RAND subroutine.
Press the <NEXT> key to see more lines of the trace.
Getting Started 2-11
Page 36
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +015 00045E 0339 0339 supr prog 5.80 uS +016 000460 2008 MOVE.L A0,D0 400 nS +017 000462 23C0 MOVE.L D0,0000600 400 nS +018 000464 0000 0000 supr prog 400 nS +019 000466 0600 0600 supr prog 400 nS +020 000468 4240 CLR.W D0 400 nS +021 000600 DDA1 DDA1 supr data wr word 400 nS +022 000602 9EC9 9EC9 supr data wr word 400 nS +023 00046A 4840 SWAP.W D0 400 nS +024 00046C 0280 ANDI.L #0000000FF,D0 400 nS +025 00046E 0000 0000 supr prog 400 nS +026 000470 00FF 00FF supr prog 400 nS +027 000472 4E75 RTS 400 nS +028 000474 0000 0000 unused prefetch 400 nS +029 0006F8 0000 0000 supr data rd word 800 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN
run trace step display modify break end ---ETC--
In the trace list above you see the last few instruc ti ons executed b y the RAND subrouti ne (the RTS is the last instruction). To see more lines of the trace, press <NEXT> once again.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +030 0006FA 040E 040E supr data rd word 400 nS +031 00040E 0801 BTST.L #01,D1 400 nS +032 000410 0001 0001 supr prog 400 nS +033 000412 6700 BEQ.W 000041A 400 nS +034 000414 0006 0006 supr prog 400 nS +035 00041A 0801 BTST.L #00,D1 800 nS +036 00041C 0000 0000 supr prog 400 nS +037 00041E 6700 BEQ.W 0000432 400 nS +038 000420 0012 0012 supr prog 400 nS +039 000422 6000 BRA.W 0000438 1.0 uS +040 000424 0014 0014 supr prog 400 nS +041 000438 6100 BSR.W 000044A 600 nS +042 00043A 0010 0010 supr prog 400 nS +043 0006F8 0000 0000 supr data wr word 600 nS +044 0006FA 043C 043C supr data wr word 400 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN
run trace step display modify break end ---ETC--
2-1 2 Getting Started
Page 37
Line 31 shows the first instruction executed after return from the RAND subroutine. The instructions shown in the previous tra ce list decide which caller will call the WRITE_NUMBER subroutine. L ine 41 shows the disas sembl ed mnemonic of the instruction which ca lls the WRITE_NUMBER subroutine. The address information shows that the caller is C ALLER_1. To view the instruction cycles of the WRITE_NUMBER subroutine, press <NEXT> again.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +045 00044A 1340 MOVE.B D0,00500[A1] 400 nS +046 00044C 0500 0500 supr prog 400 nS +047 00044E 4E75 RTS 400 nS +048 00054E A1A1 A1 supr data wr byte 400 nS +049 000450 2039 MOVE.L 0000600,D0 400 nS +050 0006F8 0000 0000 supr data rd word 400 nS +051 0006FA 043C 043C supr data rd word 400 nS +052 00043C 60C8 BRA.B 0000406 400 nS +053 00043E 6100 6100 unused prefetch 400 nS +054 000406 2241 MOVEA.L D1,A1 600 nS +055 000408 2200 MOVE.L D0,D1 400 nS +056 00040A 6100 BSR.W 0000450 400 nS +057 00040C 0044 0044 supr prog 400 nS +058 0006F8 0000 0000 supr data wr word 600 nS +059 0006FA 040E 040E supr data wr word 400 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN
run trace step display modify break end ---ETC--
Line 45 shows the MOVE.B instruction assoc iated with the WRITE_NUMBER subroutine.
Line 47 in the trace list above shows the RTS instruction as soci ated with the WRITE_NUMBER subroutine. Li ne 48 shows the random number 0A1H is written to address 54EH.
Line 54 shows the AGAIN address associated with the ne xt loop of the program.
Getting Started 2-13
Page 38
1Modifying
Previous Trace Commands
Command Recall If the c ommand you wish to modify has b een rec ently entered
Many of the examples presented in this chapter build on previous examples. If you are entering the trace c ommands shown, you will sometimes find it easier to modify a previous trace command than to enter the new command. If the command you wish to modify was the last command entered, it is still on the command line and you may edit it using the command line editing features (for example, using the left arrow and right arrow keys, using type-over, insert, del e te, etc.). If the command you wish to modif y was not the last command entered, you will have to recall the command. There are two ways to recal l trace commands: command recall and the "trace modi fy_command" command.
(w ithin the last 20 commands), you can use the command recall feature. Press < CTRL> -R to recall commands. If you pass up the command of interest, you can use < CTRL> -B to move forward through the list.
Trace Modify
Command
2-1 4 Getting Started
The "trace modify _command" command recalls the last trace command. The advantage of this command over command recall is that you do not have to move forward a nd back ward over other commands to find the last trace command; also, the last trace command is always availabl e , no matter how many commands have been entered since.
Page 39
1Specifying
Storage Qualifiers
By defa ult, all captured states are stored; how ever, you can qualify whic h states get stored. For example, to store only the states which write random numbers to the RESULTS area, enter:
Note
trace after only range
You c a n only select one range in the emulation analy sis
AGAIN
RESULTS
thru
RESULTS+0ffh <RETURN>
spe cification. If you store states in a range, for e xample, you will not be allowed to select a ra nge in a ny of the other ana lyzer spec i fications.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative after 000406 2241 MOVEA.L D1,A1 2.6 uS +001 0005F3 4949 49 supr data wr byte 26.6 uS +002 0005FD 9999 99 supr data wr byte 29.2 uS +003 000549 4242 42 supr data wr byte 29.2 uS +004 000599 3A3A 3A supr data wr byte 29.2 uS +005 000542 0505 05 supr data wr byte 29.2 uS +006 00053A 5757 57 supr data wr byte 29.2 uS +007 000505 B6B6 B6 supr data wr byte 30.4 uS +008 000557 A0A0 A0 supr data wr byte 29.2 uS +009 0005B6 2B2B 2B supr data wr byte 28.0 uS +010 0005A0 BDBD BD supr data wr byte 30.4 uS +011 00052B E1E1 E1 supr data wr byte 29.2 uS +012 0005BD 1919 19 supr data wr byte 29.2 uS +013 0005E1 D9D9 D9 supr data wr byte 29.2 uS +014 000519 7D7D 7D supr data wr byte 29.2 uS
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN only range RESULTS thru RESULTS+0ffh
run trace step display modify break end ---ETC--
Notice that the trigger state (line 0, labeled "after") is included in the trace list; trigger states are always stored.
This trace shows that the last tw o hex digits of the address in the RESULTS area are the same as the random number which gets written two states earlier (see the data in the "mnemonic" column
Getting Started 2-15
Page 40
of the tra ce list). T his is expected beca use the sample program writes the current random num ber using the se cond previous random number as an offset into the RESULTS area.
1Prestoring States Suppose you find a defect i n a subroutine , but you determine that
the problem is a ctually due to something set up by the calling routine. If the subroutine is called from a variety of places in your prog ram, you need to find out which callers cause the problem. Pres tore can be used to find the callers of the subroutine.
Pres tore allows you to save up to two states which precede a normal store state. Prestore is turned off by default. How e ver, you can include a pres tore qualifier in the command line to qualify the state s which a re prestored.
As an example, let’s use a pres tore qualifier to show which caller of WRITE_NUMBER corresponds to ea ch value written to the RESULTS area. Beca use the BSR as sembly langua ge instruction is used to call a subroutine , you can q ua lify prestore sta te s as states whose data equals the BSR opcode (6100H). For example:
trace after only range prestore data
AGAIN
RESULTS
thru
6100h <RETURN>
RESULTS+0ffh
2-1 6 Getting Started
Page 41
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative after 000406 2241 MOVEA.L D1,A1 2.6 uS pstore 00040A 6100 BSR.W******** pstore 000438 6100 BSR.W******** +003 000530 3737 37 supr data wr byte 26.6 uS pstore 00040A 6100 BSR.W******** pstore 000444 6100 BSR.W******** +006 000545 7070 70 supr data wr byte 30.4 uS pstore 00040A 6100 BSR.W******** pstore 000432 6100 BSR.W******** +009 000537 8E8E 8E supr data wr byte 28.0 uS pstore 00040A 6100 BSR.W******** pstore 00043E 6100 BSR.W******** +012 000570 3434 34 supr data wr byte 29.2 uS pstore 00040A 6100 BSR.W******** pstore 000432 6100 BSR.W********
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after AGAIN only range RESULTS thru RESULTS+0ffh prestore data 6100h
run trace step display modify break end ---ETC--
The prestore state immediately prece ding each write state shows the address of the calle r.
The analyzer uses the same res ource to sa ve prestore states as it does to save count tags. Consequently, no count appears for prestore states. Tim e counts are relative to the previous normal storage state.
State s which satisfy the pres tore qualifier and the storage qualifier at the same time a re stored as normal s tates.
Getting Started 2-17
Page 42
1Changing the
Count Q ua l ifier
Suppose now that you are interested in onl y one address i n the RESULTS area, say 5C2H. Y ou wish to s ee how many loops of the prog ram occur between eac h write of a random number to thi s address. You can enter a trace command that triggers on address 5C 2H (since it’s the only addres s of interest), stores only writes to address 5C2H, a nd counts the address of the A GAIN label (406H). For example:
trace after only
5c2h
counting state
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative after 0005C2 0606 06 supr data wr byte -----------­+001 0005C2 5353 53 supr data wr byte 51 +002 0005C2 3333 33 supr data wr byte 1343 +003 0005C2 E2E2 E2 supr data wr byte 291 +004 0005C2 D3D3 D3 supr data wr byte 351 +005 0005C2 3B3B 3B supr data wr byte 793 +006 0005C2 2E2E 2E supr data wr byte 61 +007 0005C2 1818 18 supr data wr byte 432 +008 0005C2 1A1A 1A supr data wr byte 40 +009 0005C2 B3B3 B3 supr data wr byte 1245 +010 0005C2 5C5C 5C supr data wr byte 87 +011 0005C2 BCBC BC supr data wr byte 660 +012 0005C2 3F3F 3F supr data wr byte 425 +013 0005C2 BABA BA supr data wr byte 345 +014 0005C2 8686 86 supr data wr byte 729
STATUS: M68000--Running user program Emulation trace complete______...R....
trace after 5c2h only 5c2h counting state AGAIN
5c2h
AGAIN <RETURN>
run trace step display modify break end ---ETC--
The trace listing above shows that the number of times the prog ram executes between writes to 5C2H varies .
2-1 8 Getting Started
Page 43
Turning Counting Off Turni ng the c ount off a llows the ana lyzer to store 1024 states
instead of 512 states. For example:
trace after only
5c2h
counting off
(The default trace depth is 256, which means that only 256 states are uploaded and are available to be displayed. You can increase the trace depth so that more states can be view ed; however, it takes longer to upload more states. Refe r to the "Chang ing the Trace Depth" section in the "Displ ay ing Traces" chapter.)
5c2h
<RETURN>
1Triggering on the
Nth Occurrence of
In the trace command, you can spec ify a trigg er on the Nth occurrenc e of a state. To specif y an occurrence count, enter:
a State
trace about only
5c2h
counting state
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative
-004 0005C2 4141 41 supr data wr byte ------------
-003 0005C2 4B4B 4B supr data wr byte 447
-002 0005C2 E0E0 E0 supr data wr byte 81
-001 0005C2 8F8F 8F supr data wr byte 9 about 0005C2 EFEF EF supr data wr byte 150 +001 0005C2 9797 97 supr data wr byte 601 +002 0005C2 1E1E 1E supr data wr byte 71 +003 0005C2 2F2F 2F supr data wr byte 534 +004 0005C2 0E0E 0E supr data wr byte 511 +005 0005C2 0505 05 supr data wr byte 35 +006 0005C2 F7F7 F7 supr data wr byte 101 +007 0005C2 5E5E 5E supr data wr byte 81
STATUS: M68000--Running user program Emulation trace complete______...R....
trace about 5c2h occurs 5 only 5c2h counting state AGAIN
5c2h
occurs
AGAIN <RETURN>
5
run trace step display modify break end ---ETC--
Getting Started 2-19
Page 44
Notice that the trigger position has been moved to the center of the trace so that states which occur bef ore the trigger are saved.
Usually, when you enter a "trac e ab out" command, the trigger state (line 0) is labeled "about". However, if there are three or fewer states bef ore the trig ger, the trigger state is labeled "af ter". Likewise, if there are 3 or fewer states after the trigger, the trigger state is labeled "before".
1Triggering on
Multiple States
The analy sis specification allows y ou to trigger on multiple states. That is, when one state, or a second state, or a third state, etc., occur the spe cified number of times, the analyzer triggers. For example, suppose you wish to change the pre vious analysis spe cification to trig ger on the fif th occurrence of address 5C2H or 5C3H. Enter:
trace about only
5c2h
counting state
5c2h or 5c3h
AGAIN <RETURN>
occurs
5
Press the < downarrow> key a few times to vie w the states that are stored before the trigger.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative
-002 0005C2 5656 56 supr data wr byte ------------
-001 0005C2 6A6A 6A supr data wr byte 136 after 0005C3 9393 93 supr data wr byte 35 +001 0005C2 2626 26 supr data wr byte 177 +002 0005C2 D3D3 D3 supr data wr byte 213 +003 0005C2 0707 07 supr data wr byte 300 +004 0005C2 9797 97 supr data wr byte 125 +005 0005C2 E3E3 E3 supr data wr byte 452 +006 0005C2 4747 47 supr data wr byte 79 +007 0005C2 1010 10 supr data wr byte 225 +008 0005C2 6E6E 6E supr data wr byte 280 +009 0005C2 7474 74 supr data wr byte 617 +010 0005C2 C0C0 C0 supr data wr byte 194 +011 0005C2 0202 02 supr data wr byte 990
STATUS: M68000--Running user program Emulation trace complete______...R....
trace about 5c2h or 5c3h occurs 5 only 5c2h counting state AGAIN
run trace step display modify break end ---ETC--
2-2 0 Getting Started
Page 45
Notice, in the preced ing display, that only two accesses of address 5C 2H occur before the trigger. B ecause the occurrence count is still five, two accesses of 5 C3H must have also occurre d before the trigger. The trace command above causes the analyzer to trigger on the fifth occurrence of either addre ss 5C2H or 5C3H.
1Using Address,
Data, a nd Stat us Qualifiers
So far, the examples have not used address , data, and status qualifiers in combination. When an address qualifier is specified, additional data and sta tus specifica tions serve to further qualify a state.
For example , specify ing a trigger on v ariable RAND_SEED (address 600H in the sample prog ram) w ill cause the analy zer to trigger on the first access of 600H, regardless of the value being read or written to this a ddress.
However, suppose you wish to trigger on the re ad of a specific value from 600H, say 0XX5AH (where "X"s are "don’t cares"). To trigger on the occurre nce of this state, you ca n incl ude data and status quali fiers along wi th the ad d re ss qualif i e r.
Suppose also that you wa nt to go back to storing addre sses in the range 500H through 5 FFH, b ut that you only w ant to store the writes of bytes whose first hex digit is "5". T o do this, enter:
trace about
RAND_SEED
data
0xx5ah
status read only range
0xx5xh <RETURN>
RESULTS
thru
RESULTS+0ffh
data
Note
Status qualifiers will differ from one emulator to another. For more i nformation on the status qualifiers refer to your Emulator Softkey Interface User’s Guide.
Getting Started 2-21
Page 46
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative
-007 00054E 5858 58 supr data wr byte 31
-006 0005F8 5C5C 5C supr data wr byte 6
-005 000565 5E5E 5E supr data wr byte 20
-004 000576 5D5D 5D supr data wr byte 16
-003 0005F2 5454 54 supr data wr byte 12
-002 000588 5151 51 supr data wr byte 7
-001 0005A6 5A5A 5A supr data wr byte 17 about 000600 F45A F45A supr data rd word 1 +001 0005A7 5B5B 5B supr data wr byte 3 +002 000502 5757 57 supr data wr byte 11 +003 000564 5454 54 supr data wr byte 16 +004 000520 5555 55 supr data wr byte 10 +005 000516 5555 55 supr data wr byte 12 +006 00059E 5A5A 5A supr data wr byte 9 +007 000584 5A5A 5A supr data wr byte 23
STATUS: M68000--Running user program Emulation trace complete______...R....
trace about RAND_SEED data 0xx5ah status read only range RESULTS thru RESUL TS+0ffh data 0xx5xh
run trace step display modify break end ---ETC--
1Using the
Se que n cer
2-2 2 Getting Started
The examples shown previously in this chapter are all of trace spec ific ations in which the analy zer is triggered on a single state. However, if you use the analyzer’s se q uenc er, you c an specify traces that trigger on a series, or sequenc e, of states.
The analy zer’ s sequencer has several level s (also calle d se quence terms). Each state in the series of states to be found before triggering, as well as the trigger state, i s associated with a sequenc e term.
The sequencer works like this : the analyzer searches for the state associa ted with the first seq uenc e term. When that state is captured, the analyzer starts searching for the state associated with the second term, and s o on. The la st seq uence term used is associa ted with the trigger state. When the trigger state is captured the analy zer is triggered. Up to seven sequence terms and an optional occurrence count for each term are avai lable.
Page 47
Here is an example trace c ommand that uses the sequencer:
trace find_sequence
STATE_2
then
occurs
STATE_5
then
5
then
STATE_6
STATE_1
STATE_3
trigger after
occurs
then
2
then
STATE_4
TRIGGER_STATE <RETURN>
In the "S pecifying Storage Quali fiers" section earlier in this chapter, the example trace s pecification triggered on an address and stored only states in which values were w ritten to the RESULTS area. Now you’d lik e to trigger after a series of states while continuing to store only the states tha t write to the RESULTS area.
For example , suppose you’d li ke to trigger the flow of execution from TWO_THREE to CALLER_3 after CALLER_0 has occurred 8 times. To do this, you would e nte r the following commands. (The "cws" command saves you from having to inc lude "anly.s: " when spec ifying local symbols in the trace command.)
cws
anly.s: <RETURN>
trace find_sequence then
TWO_THREE
then
CALLER_3
trigger about only range
WRITE_NUMBER
RESULTS
CALLER_0
thru
RESULTS+0ffh <RETURN>
occurs
8
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative
-007 000571 D9D9 D9 supr data wr byte 1
-006 000523 A0A0 A0 supr data wr byte 1 sq adv 000432 6100 BSR.W******** 1
-004 0005D9 5E5E 5E supr data wr byte 0 sq adv 000426 0801 BTST.L #**,D1 1
-002 0005A0 E3E3 E3 supr data wr byte 0 sq adv 000444 6100 BSR.W******** 0 about 00044A 1340 MOVE.B D0,****[A1] 1 +001 00055E F2F2 F2 supr data wr byte 0 +002 0005E3 9898 98 supr data wr byte 1 +003 0005F2 0E0E 0E supr data wr byte 1 +004 000598 5A5A 5A supr data wr byte 1 +005 00050E 9292 92 supr data wr byte 1 +006 00055A 8383 83 supr data wr byte 1 +007 000592 2929 29 supr data wr byte 1
STATUS: M68000--Running user program Emulation trace complete______...R....
trace find_sequence CALLER_0 then TWO_THREE then CALLER_3 trigger about WRITE _NUMBER only range RESULTS thru RESULTS+0ffh
run trace step display modify break end ---ETC--
Getting Started 2-23
Page 48
Notice the states that contain "sq adv" in the line number column. These are the sta te s associ ated with (or captured for) each se quence term . Just as the trigger state is always store d in trace memory, the sta te s capture d in the se quence are always store d if the trace buffer is deep enough.
Because the trigger is the last sequenc e term, the remaining states stored after the trigger state are writes to the RESULTS area.
Specifying a Restart
Term
When using the analyzer’s sequencer, an additional s e q uenc e restart term is also allowed. This res tart is a "global restart"; that is, it applies to all the sequence terms.
The restart term is a state which, when captured before the anal yzer has found the trigger state, causes the sequencing to start f rom the beginning a gain. You can use the res tart term to make certain some s tate does not occ ur in the sequence that triggers the analyzer.
For example, you may have notic ed in the previous trace that a write to the RESULTS area occurred between the TWO_THREE and CA LLER_3 states in the seque nce and that the state count associa ted with WRITE_NUMBER state show s that AGAIN occurred be fore the trigge r. What was actually captured in the previ ous trac e was the flow of execution where TWO_THREE occ urs, then CALLER_2, then WRITE_NUMBER, then a prefetch of CALLER_3 on the return from WRITE_NUMBER, and then the capture of WRITE_NUMBER occurred the next time through the program. By specify ing a re start on CALLER_2, you can fix the prev ious trace command so that only the flow of execution from TWO_THREE to CALLER_3 is captured.
trace find_sequence then
TWO_THREE
then
CALLER_3
restart trigger about only range
CALLER_2
WRITE_NUMBER
RESULTS
CALLER_0
thru
RESULTS+0ffh <RETURN>
occurs
8
2-2 4 Getting Started
Page 49
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative sq adv 00043E 6100 BSR.W******** 0
-006 000568 DFDF DF supr data wr byte 0
-005 000596 6C6C 6C supr data wr byte 1 sq adv 000432 6100 BSR.W******** 1
-003 0005DF CBCB CB supr data wr byte 0 sq adv 000426 0801 BTST.L #**,D1 1 sq adv 000444 6100 BSR.W******** 0 about 00044A 1340 MOVE.B D0,****[A1] 0 +001 00056C 2121 21 supr data wr byte 0 +002 0005CB 0E0E 0E supr data wr byte 1 +003 000521 2A2A 2A supr data wr byte 1 +004 00050E C3C3 C3 supr data wr byte 1 +005 00052A 5A5A 5A supr data wr byte 1 +006 0005C3 2929 29 supr data wr byte 1 +007 00055A ADAD AD supr data wr byte 1
STATUS: M68000--Running user program Emulation trace complete______...R....
trace find_sequence CALLER_0 then TWO_THREE then CALLER_3 restart CALLER_2 tri gger about WRITE_NUMBER only range RESULTS thru RESULTS+0ffh
run trace step display modify break end ---ETC--
Notice in the resulting trace (you may have to press < PREV > in order to see the state s captured prior to the trigger) that "sq ad v" is also shown next to states which cause a sequencer restart.
The sequencing capabilities from within the Softkey Interface are not as powerful or fle xible as they are from wi thin the Terminal Interface. If you do not find the sequencing flexibility you need f rom within S oftkey Interface , ref er to the Terminal Interface: Analy z er Us er’s Guide.
1Tracing "Windows"
of Activity
Windowing refers to the analyzer feature that allows you to turn on, or e nable, the capturi ng of states a fter some state occurs then to turn off, or d isable, the capturing of states when another state occurs. In effect, windowing all ows you capture segments, or windows, of code execution.
Windowing is diffe re nt than storing states in a rang e (the "only range" option in the trace command syntax ) because it allows you to ca pture e xecuti on of all states in a window of code whereas storing s tates in a range won’t ca pture the execution of subroutine
Getting Started 2-25
Page 50
that are called in that range or reads and writes to locations outside that range.
When y ou use the windowi ng feature of the analy zer, the trigger state must be in the window or else the trigger will never be found.
If you wish to com bine the windowing and sequenc ing functions of the analy zer, there are some restrictions:
Up to four s equence te rm s are available when windowing is in effect.
Global restart is not available when w indowing is in effect.
Occurrence counts are not avai lable.
Suppose that you are only intereste d in the exec ution that occurs within the RAND subroutine of the sample program. You could spe cify the address of the subroutine call as the window enable state and the address of the subroutine’s last instruction as the window disable state (and you could trigger on any state in that window by not spe cify ing a trigger). For example:
trace enable
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status state count Base: hex hex mnemonic relative +015 000464 0000 0000 supr prog 0 +016 000466 0600 0600 supr prog 0 +017 000468 4240 CLR.W D0 0 +018 000600 091B 091B supr data wr word 0 +019 000602 576B 576B supr data wr word 0 +020 00046A 4840 SWAP.W D0 0 +021 00046C 0280 ANDI.L #0000000FF,D0 0 +022 00046E 0000 0000 supr prog 0 +023 000470 00FF 00FF supr prog 0 sq adv 000472 4E75 RTS 0 sq adv 00040A 6100 BSR.W 0000450 1 +026 00040C 0044 0044 supr prog 0 +027 0006F8 0000 0000 supr data wr word 0 +028 0006FA 040E 040E supr data wr word 0 +029 000450 2039 MOVE.L 0000600,D0 0
STATUS: M68000--Running user program Emulation trace complete______...R....
trace enable 40ah disable anly.s:RAND+022h
40ah
disable
472h <RETURN>
run trace step display modify break end ---ETC--
2-2 6 Getting Started
Page 51
Notice in the resulting trace (you may have to press <NEXT>) that the enable and disable states have the "sq adv" string in the line number column. This is because the windowing feature uses the analyzer’s seq uencer.
The windowing capabilities from within the Softkey Interface are not as powerful or fle xible as they are from wi thin the Terminal Interface. For ex ample , in the Terminal Interface, you can se t up a windowing trace specific ation where the trigger does not have to be in the w indow. If you do not find the windowing flexibility you need from within Softke y Interfa ce, refer to the Terminal Inte rface: Analy z er Us er’s Guide.
1Storing and
Loading Trace Commands
You can save a trace command to a " trac e specif i cation" file and reloa d it at a late r time. T o store the curre nt trace c ommand, enter:
store trace_spec
The trace command is saved in a file named " tspecfile.TS" in the current directory. The extension ".TS" is appe nded to trace spe cification files if no extension is s pecified in the "store trace_spec" command. Enter another trace command to overwrite the existing trace command:
trace
To bring back the trace command sa ved in "tspecfile.TS" and perform a trace measurement using i t, enter the commands:
<RETURN>
load trace_spec trace again
Trace c ommands that have just been loaded w ill alway s work, even if symbols hav e b een changed; however, once you modify the trace command, it may no longer work.
tspecfile <RETURN>
tspecfile <RETURN>
<RETURN>
Getting Started 2-27
Page 52
1Trace Comma nds
in the Event Log Display
The event log display shows the previous trace commands. To view the event log d isplay, enter:
display event_log
Event Log Time Type Message 11:58:52 TRACE Emulation trace started 11:58:52 TRACE Emulation trace complete 12:00:25 TRACE trace find_sequence CALLER_0 then TWO_THREE then CALLER_3 rest art CALLER_2 trigger about WRITE_NUMBER only range RESULTS thr u RESULTS+0ffh 12:00:26 TRACE Emulation trace started 12:00:26 TRACE Emulation trace complete 12:01:27 TRACE trace enable 40ah disable 472h 12:01:28 TRACE Emulation trace started 12:01:28 TRACE Emulation trace complete 12:02:19 TRACE trace 12:02:20 TRACE Emulation trace started 12:02:20 TRACE Emulation trace complete 12:02:40 TRACE trace enable 40ah disable 472h 12:02:48 TRACE Emulation trace started 12:02:49 TRACE Emulation trace complete
STATUS: M68000--Running user program Emulation trace complete______...R....
display event_log
run trace step display modify break end ---ETC--
<RETURN>
1Storing and
Loading Traces
2-2 8 Getting Started
You can save a trace to a trace file and reload it at a later time. To store the current trac e , enter the command:
store trace
trcfile <RETURN>
The trace is saved i n a file named "trcfil e .TR" in the c urrent directory. The exte nsion ".TR" is a ppended to trac e files i f it i s not spe cified in the "store trace" command. Enter another trace command to overwrite the existing trac e:
trace
<RETURN>
Page 53
To bring back the trace of the previous se ction, enter the command:
load trace display trace
trcfile <RETURN>
<RETURN>
The trace information s tored in "trcfile .TR" is restored, a nd y ou can vi ew the tra ce as you would any other trace.
The restored trac e depth is the depth specified when the trac e was stored and ca nnot be incre ased. You may want to incre ase the trac e depth before storing trace s.
When a trace is loaded, the trace command is not restored . A "trace again" or "trace modify" command will use the last trace command entered, not the command which resulted in the loaded trace. Al so, the trace status shown by the "display status" command does not reflect the loaded trace.
1Stopping the Trace You can, and most likely will, specify traces whose trigger or
storage states are never found. When this happe ns, the "Trace complete" message is never shown, and the trace continues to run ("Trace running "). When these situations occur, you can choose to halt the trace meas urement w ith the following command:
stop_trace
<RETURN>
The "s top_trace" command is also useful to deactivate signal s whic h a re driven when the trigger i s found (refer to the "Coordi nated Meas ur ements" chapter in the Softkey Interface Reference m anual).
Getting Started 2-29
Page 54
1Tracing on Halt The "trace on_halt" command allows you to prevent triggering. I n
other words, the trace runs until you enter the "stop_trace" command (described in the next section). The " trace on_ha lt" command is the same as trac ing "before" a state that never occurs.
The "trace on_halt" command is us e ful, for example, when you wish to trace the states leading up to a break into the monitor (provided that you are using the background monitor a nd tracing only f ore ground operation). S uppose your program breaks on an access to guarded memory . To trace the states that lead up to the break, enter the "trace on_halt" command, and run the prog ra m. When the break occurs, the emulator is running in the background monitor, and the analy zer is no longer capturi ng state s. To displ ay the sta te s leading up to the break, e nte r the "stop_tra ce" co mmand (and the "display trace" command if traces are not currently being displayed).
When the "on_halt" option is us e d in a trace command, the trigger condition (and position) options, a s well as the "repetitively " and "break _on_trigge r" options, cannot b e incl uded in the command.
1Conclusion This concludes the "Getting Started " chapter. You have learned
about the basic trace commands and how to specify trigger conditions , storage, pre store, and count qualifiers, occurrence qualifiers, and address, data, and status qualifiers.
2-3 0 Getting Started
Page 55
Disp la ying Tra ce s
1Introduction This chapter describ es the options available when dis pla ying trace
lists. The trace list can contain high-level source fi le information. The trace used to illustrate the various display options throughout
this chapter was generated in the following manner. (T he commands shown below assume that /usr/hp64000/b in is specified in the PATH environment variab l e .)
Firs t, the prog ra m shown in f igure 3-1 was compiled and linked with the following HP 64902 C Cross Compiler command:
$ cc68000 -hvONr hp64742 -o cprg cprg.c <RETURN>
Then, the default emulator configuration for the HP 64742 environment was copied to the current dire ctory w ith the fol low ing command:
$ cp /usr/hp64000/env/hp64742/config.EA config.EA <RETURN>
3
Next, the emulation system (Sof tkey Interfac e) was entered:
$ emul700 <emul_name> <RETURN>
The < emul_name> in the previ ous command is the logical emulator name given in the HP 64700 emulator device table (/usr/hp64000/etc/64700tab).
After the emulation system was entered, the default confi guration w as loaded:
load configuration
config <RETURN>
Displaying Traces 3-1
Page 56
unsigned short dest[0x7f]; unsigned short *dest_ptr;
main () { /*****************************************/ /* This is a comment block */ /* to demonstrate the "number */ /* of source lines" trace */ /* display option. */ /*****************************************/
char *message; for (;;)
{ message = "This message is to be written indefinitely. "; dest_ptr = dest; while (*message != ’\0’) { *dest_ptr = *message; dest_ptr++; message++; } } }
Figure 3-1. Program Used for Example Displays
Then, the absolute file was loaded:
load
cprg <RETURN>
The foll owing trace command was entered, and the program was run.
trace after run from transfer_address
main <RETURN>
<RETURN>
Disp la y P osi tion ing The trace display command displays 256 states, not all of which can
appear on the screen at the same time. However, you can reposition the display on the screen with the keys described below.
Up/Down
The <uparrow> and < dow narrow > (or roll up and roll down) keys move the display up or down on the screen one line at a time.
3-2 Displaying Traces
Page 57
The page up and page down keys allow you to move the display up or down a pag e at a time.
Left/Right
The < CTRL> -F and < CTRL> -G keys allow you to move the dis pla y left or right, respectively. These keys are used if the emulator contains an external analyzer and you have an 8 0 column di splay (The d e fault trace di splay includes the external b its information in this case, but this inform a tion cannot be displayed on an 80 col umn di splay.)
The < CTRL> -F and < CTRL> -G keys are also used when the width of the address or mnemonic/ ab solute columns is increased so that not all the trace display data can be displayed across the screen.
1Changing the
Trace Dep t h
The "display trace depth" command allows y ou to specify the number of states that are displayed. By reduc ing the trace depth, you can shorten the time it takes for the Softkey Interface to upload the trace information. You c an increase the trace depth to view more states of the current trace.
The maximum number of trace states is 1024 when counting is turned off, 512 when counting is on. When you initia lly enter the Softkey Interface, the trace depth is 256. The minimum trace depth i s 9.
If you wish to reduce the number of states that are displayed, the "display trace depth" command must be entered bef ore the trace is di splayed. You cannot use this command to reduce the number of state s displayed in the current trace.
Displaying Traces 3-3
Page 58
1Displaying About
a Line Number
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +193 06017C 008E 008E supr data rd word 520 nS +194 000B00 5493 5493 supr prog 480 nS +195 06008E 0061 0061 supr data wr word 520 nS +196 000B02 528A 528A supr prog 480 nS +197 06017A 0006 0006 supr data rd word 520 nS +198 06017C 008E 008E supr data rd word 480 nS +199 000B04 4A12 4A12 supr prog 520 nS +200 06017C 0090 0090 supr data wr word 480 nS +201 06017A 0006 0006 supr data wr word 520 nS +202 000B06 66F0 66F0 supr prog 480 nS +203 000B16 6765 67 supr data rd byte 1.0 uS +204 000B08 60E0 60E0 supr prog 520 nS +205 000AF8 1012 1012 supr prog 760 nS +206 000AFA 4880 4880 supr prog 480 nS +207 000B16 6765 67 supr data rd byte 520 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace 200
run trace step display modify break end ---ETC--
The "< LINE # > " trace display option allow s y ou to specify the line number to be centered in the display.
3-4 Displaying Traces
Page 59
1Disassembling the
Trace Informat ion
The "disassemble_from_line_number" trace display option causes the inverse assembler to attempt to beg in disassembling the trace information from the spe cified line number. This option is required for inve rse assembl ers that c annot uniquely identify opcode fetch states on the processor bus. This option is not present for emulators whose inve rse assembl er can de te rmine opcode fetch states on the processor bus.
If the line number specified is not an opc ode fetch state, the disassembled information will be incorrect.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +200 06017C 0090 0090 supr data wr word 480 nS +201 06017A 0006 0006 supr data wr word 520 nS +202 000B06 66F0 BNE.B 0000AF8 480 nS +203 000B16 6765 67 supr data rd byte 1.0 uS +204 000B08 60E0 BRA.B 0000AEA 520 nS +205 000AF8 1012 MOVE.B (A2),D0 720 nS +206 000AFA 4880 EXT.W D0 520 nS +207 000B16 6765 67 supr data rd byte 480 nS +208 000AFC 2053 MOVEA.L (A3),A0 520 nS +209 000AFE 3080 MOVE.W D0,(A0) 480 nS +210 06017A 0006 0006 supr data rd word 520 nS +211 06017C 0090 0090 supr data rd word 480 nS +212 000B00 5493 ADDQ.L #2,(A3) 520 nS +213 060090 0067 0067 supr data wr word 480 nS +214 000B02 528A ADDQ.L #1,A2 520 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace disassemble_from_line_number 200
run trace step display modify break end ---ETC--
Displaying Traces 3-5
Page 60
1Displaying in
A bs olute Fo rmat
The "absolute" trace display option al low s you to display status information in absolute format (b inary, hex, or mnemonic). The "absolute status mnemonic " dis play is the same as d efault mnemonic display , ex cept that opcodes are not disassembled.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Absolute Status time count Base: hex hex binary relative +200 06017C 0090 11101100 480 nS +201 06017A 0006 11101100 520 nS +202 000B06 66F0 10110110 480 nS +203 000B16 6765 10101111 1.0 uS +204 000B08 60E0 10110110 520 nS +205 000AF8 1012 10110110 720 nS +206 000AFA 4880 10110110 520 nS +207 000B16 6765 10101111 480 nS +208 000AFC 2053 10110110 520 nS +209 000AFE 3080 10110110 480 nS +210 06017A 0006 11101110 520 nS +211 06017C 0090 11101110 480 nS +212 000B00 5493 10110110 520 nS +213 060090 0067 11101100 480 nS +214 000B02 528A 10110110 520 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace absolute status binary
run trace step display modify break end ---ETC--
3-6 Displaying Traces
Page 61
1Displaying in
Mnemonic Format
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +011 000AEA 247C MOVEA.L #000000B0C,A2 480 nS +012 000AEC 0000 0000 supr prog 520 nS +013 000AEE 0B0C 0B0C supr prog 480 nS +014 000AF0 26BC MOVE.L #00006007C,(A3) 520 nS +015 000AF2 0006 0006 supr prog 480 nS +016 000AF4 007C 007C supr prog 520 nS +017 000AF6 600C BRA.B 0000B04 480 nS +018 06017A 0006 0006 supr data wr word 520 nS +019 06017C 007C 007C supr data wr word 480 nS +020 000AF8 1012 MOVE.B (A2),D0 520 nS +021 000B04 4A12 TST.B (A2) 720 nS +022 000B06 66F0 BNE.B 0000AF8 520 nS +023 000B0C 5468 54 supr data rd byte 480 nS +024 000B08 60E0 BRA.B 0000AEA 520 nS +025 000AF8 1012 MOVE.B (A2),D0 760 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace disassemble_from_line_number 11
run trace step display modify break end ---ETC--
The "mnem onic" trace display option al low s you to dis play the trac e inform a tion in mnemonic format (that is, opcodes and status). The default trace display is in mnemonic f ormat.
Displaying Traces 3-7
Page 62
1Including
High-Level Source Lines
To include high-level source lines in the trace display, you must use the " set" command. The "set" command allows you to include symbolic information in trace, memory, regi ster, and s oftware breakpoint displays. The "set" command affects all d isplays for the current window .
The "s et source on/off/only" command allows you to incl ude source file information in the trace list or memory mnemonic d isplay. The "source only" option specifies that only the source f ile information w ill be displayed.
When source l ines are included, comments that contain file and line inf ormation appear before the source l ines.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status w/ Source Lines time count Base: hex hex mnemonic relative ##########cprg.c - line 6 thru 17 ################################# char *message;
for (;;) { message = "This message is to be written indefinitely. "; +011 000AEA 247C MOVEA.L #000000B0C,A2 480 nS +012 000AEC 0000 0000 supr prog 520 nS +013 000AEE 0B0C 0B0C supr prog 480 nS ##########cprg.c - line 18 ############################################ dest_ptr = dest; +014 000AF0 26BC MOVE.L #00006007C,(A3) 520 nS +015 000AF2 0006 0006 supr prog 480 nS +016 000AF4 007C 007C supr prog 520 nS ##########cprg.c - line 19 ############################################
STATUS: M68000--Running user program Emulation trace complete______...R....
set source on
pod_cmd set perfinit perfrun perfend ---ETC--
Additional Options
with Source On/Only
Also, when source lines are turned on, three additional options are available in the set command: inverse video, tabs are, and number of source lines.
Inverse Video. This option allows you to dis play source lines in inverse video.
3-8 Displaying Traces
Page 63
Tabs Are. This option allows you to specify the number of spaces between tab stops so that the appropriate number of spaces can b e inserted for source lines. The d efault value is e ight. Values from two to 15 can be entered.
Number of Source Lines. Typically, there are line s in the source f ile that are not associated with a ctual i nstructi ons (declarations, comments, etc.). This option allows you to specify the number of these source lines to be displayed for every source line that is as soci ated with an actual instruction. Only source lines up to the the previous source line that corresponds to actual code will be di splayed. The default value is five. Values from one to 50 can be entered.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status w/ Source Lines time count Base: hex hex mnemonic relative ##########cprg.c - line 6 thru 17 ################################# /*****************************************/ /* This is a comment block */ /* to demonstrate the "number */ /* of source lines" trace */ /* display option. */ /*****************************************/
char *message; for (;;)
{ message = "This message is to be written indefinitely. "; +011 000AEA 247C MOVEA.L #000000B0C,A2 480 nS +012 000AEC 0000 0000 supr prog 520 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
set source on number_of_source_lines 12
pod_cmd set perfinit perfrun perfend ---ETC--
Displaying Traces 3-9
Page 64
1Includ ing Symbol
Information
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: symbols hex mnemonic w/symbols relative +011 |cprg.c:forLoop1 247C MOVEA.L #000000B0C,A2 520 nS +012 cprg:main+00000C 0000 0000 supr prog 480 nS +013 cprg:main+00000E 0B0C 0B0C supr prog 520 nS +014 cprg:main+000010 26BC MOVE.L #00006007C,(A3) 480 nS +015 cprg:main+000012 0006 0006 supr prog 520 nS +016 cprg:main+000014 007C 007C supr prog 480 nS +017 cprg:main+000016 600C BRA.B cprg.c:continue2 520 nS +018 DATA|dest_ptr 0006 0006 supr data wr word 480 nS +019 D|cprg.c:+000100 007C 007C supr data wr word 520 nS +020 cprg.:whileLoop1 1012 MOVE.B (A2),D0 480 nS +021 cprg.c:continue2 4A12 TST.B (A2) 760 nS +022 cprg:main+000026 66F0 BNE.B cprg.:whileLoop1 480 nS +023 C|cprg.c:String1 5468 54 supr data rd byte 520 nS +024 cprg.c:continue1 60E0 BRA.B |cprg.c:forLoop1 480 nS +025 cprg.:whileLoop1 1012 MOVE.B (A2),D0 760 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
set source off symbols on
pod_cmd set perfinit perfrun perfend ---ETC--
The "set symbols on/off" command allows you to specify that address information be di splayed in terms of program symbols.
3-1 0 Displaying Traces
Page 65
1Changing Column
Widths
The "set width" command allows you to change the width of the address a nd mnemonic (or absolute) col umns in the trace list. Values f rom one to 80 can be entere d.
When address i nformation is bei ng displayed in terms of symb ols (in other words, s ymbols on), you may wish to increa se the width of the address column to display more of the symbol information.
When trace i nformation is displayed in mnemonic format, you can additionally specify the width of symbols in the "Opcode or Status" column.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Stat Base: symbols hex mnemonic w/symb +011 PROG|/users/guest/dir68k/cprg.c:forLoop1 247C MOVEA.L #000000B0C,A2 +012 PROG|use/guest/dir68k/cprg.c:main+00000C 0000 0000 supr prog +013 PROG|use/guest/dir68k/cprg.c:main+00000E 0B0C 0B0C supr prog +014 PROG|use/guest/dir68k/cprg.c:main+000010 26BC MOVE.L #00006007C,(A3 +015 PROG|use/guest/dir68k/cprg.c:main+000012 0006 0006 supr prog +016 PROG|use/guest/dir68k/cprg.c:main+000014 007C 007C supr prog +017 PROG|use/guest/dir68k/cprg.c:main+000016 600C BRA.B cprg.c:continu +018 DATA|dest_ptr 0006 0006 supr data wr w +019 DATA|/users/guest/dir68k/cprg.c:+000100 007C 007C supr data wr w +020 PROG|user/guest/dir68k/cprg.c:whileLoop1 1012 MOVE.B (A2),D0 +021 PROG|users/guest/dir68k/cprg.c:continue2 4A12 TST.B (A2) +022 PROG|use/guest/dir68k/cprg.c:main+000026 66F0 BNE.B cprg.:whileLoo +023 COMM|/users/guest/dir68k/cprg.c:String1 5468 54 supr data rd b +024 PROG|users/guest/dir68k/cprg.c:continue1 60E0 BRA.B |cprg.c:forLoo +025 PROG|user/guest/dir68k/cprg.c:whileLoop1 1012 MOVE.B (A2),D0
STATUS: M68000--Running user program Emulation trace complete______...R....
set width label 40
pod_cmd set perfinit perfrun perfend ---ETC--
Displaying Traces 3-11
Page 66
1Displaying Count
Absolute/Relative
Count information m ay be displayed two ways: relative (whic h is the default), or absolute. When re lative is selected, count information is di splayed re lative to the previous state. W hen absolute is sel ected, count information is displayed rela tive to the trigger condition.
The "count absol ute /relative " trace d ispla y option is not ava ilable when counting is turned off in the tra ce command.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count xbits Base: hex hex mnemonic absolute hex +011 000AEA 247C MOVEA.L #000000B0C,A2 + 5.48 uS 000 +012 000AEC 0000 0000 supr prog + 6.00 uS 000 +013 000AEE 0B0C 0B0C supr prog + 6.48 uS 000 +014 000AF0 26BC MOVE.L #00006007C,(A3) + 7.00 uS 000 +015 000AF2 0006 0006 supr prog + 7.48 uS 000 +016 000AF4 007C 007C supr prog + 8.00 uS 000 +017 000AF6 600C BRA.B 0000B04 + 8.48 uS 000 +018 06017A 0006 0006 supr data wr word + 9.00 uS 000 +019 06017C 007C 007C supr data wr word + 9.48 uS 000 +020 000AF8 1012 MOVE.B (A2),D0 + 10.0 uS 000 +021 000B04 4A12 TST.B (A2) + 10.7 uS 000 +022 000B06 66F0 BNE.B 0000AF8 + 11.2 uS 000 +023 000B0C 5468 54 supr data rd byte + 11.7 uS 000 +024 000B08 60E0 BRA.B 0000AEA + 12.2 uS 000 +025 000AF8 1012 MOVE.B (A2),D0 + 13.0 uS 000
STATUS: M68000--Running user program Emulation trace complete______...R....
set symbols off width label 8; display trace count absolute
pod_cmd set perfinit perfrun perfend ---ETC--
3-1 2 Displaying Traces
Page 67
1Offsetting
Address Information
The "offset_by" trace displa y option allow s you to cause the addres s information in the trace display to be offset by the amount spe cified. The of fset val ue is subtracted from the instruction’s physical address to y i el d the address that is displayed.
By specifying an offs et, you can still display symbols and source lines (providing they’re turned on) after a program g ets relocated.
You can also specify an offset to cause the listed addresses to match the addresses in compiler or assembler listings.
Trace List Offset=A00 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count xbits Base: hex hex mnemonic absolute hex +011 0000EA 247C MOVEA.L #000000B0C,A2 + 5.48 uS 000 +012 0000EC 0000 0000 supr prog + 6.00 uS 000 +013 0000EE 0B0C 0B0C supr prog + 6.48 uS 000 +014 0000F0 26BC MOVE.L #00006007C,(A3) + 7.00 uS 000 +015 0000F2 0006 0006 supr prog + 7.48 uS 000 +016 0000F4 007C 007C supr prog + 8.00 uS 000 +017 0000F6 600C BRA.B 0000104 + 8.48 uS 000 +018 05F77A 0006 0006 supr data wr word + 9.00 uS 000 +019 05F77C 007C 007C supr data wr word + 9.48 uS 000 +020 0000F8 1012 MOVE.B (A2),D0 + 10.0 uS 000 +021 000104 4A12 TST.B (A2) + 10.7 uS 000 +022 000106 66F0 BNE.B 00000F8 + 11.2 uS 000 +023 00010C 5468 54 supr data rd byte + 11.7 uS 000 +024 000108 60E0 BRA.B 00000EA + 12.2 uS 000 +025 0000F8 1012 MOVE.B (A2),D0 + 13.0 uS 000
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace offset_by 0a00h
run trace step display modify break end ---ETC--
Displaying Traces 3-13
Page 68
1Returning to the
Default Trace
The "set default" command allows you to return to the d efault display.
Display
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Address Data Opcode or Status time count Base: hex hex mnemonic relative +011 000AEA 247C MOVEA.L #000000B0C,A2 480 nS +012 000AEC 0000 0000 supr prog 520 nS +013 000AEE 0B0C 0B0C supr prog 480 nS +014 000AF0 26BC MOVE.L #00006007C,(A3) 520 nS +015 000AF2 0006 0006 supr prog 480 nS +016 000AF4 007C 007C supr prog 520 nS +017 000AF6 600C BRA.B 0000B04 480 nS +018 06017A 0006 0006 supr data wr word 520 nS +019 06017C 007C 007C supr data wr word 480 nS +020 000AF8 1012 MOVE.B (A2),D0 520 nS +021 000B04 4A12 TST.B (A2) 720 nS +022 000B06 66F0 BNE.B 0000AF8 520 nS +023 000B0C 5468 54 supr data rd byte 480 nS +024 000B08 60E0 BRA.B 0000AEA 520 nS +025 000AF8 1012 MOVE.B (A2),D0 760 nS
STATUS: M68000--Running user program Emulation trace complete______...R....
set default
pod_cmd set perfinit perfrun perfend ---ETC--
3-1 4 Displaying Traces
Page 69
1Displaying
External Analyzer Information
The "external" tra ce di splay option allows you to include d ata from the ex ternal analyzer in the trace list. External bits are displayed by default if your emula tor contains an external analyzer. If you do not wish to have the external bits information in the dis play, you can turn them off.
The bits as sociated with the external analyzer labels may be di splayed in binary or hexade cimal forma t.
The following display shows three external labels (< CTRL> -F was entered to scroll the screen lef t). Lab els must be defined in the external analyzer configuration (and prior to trace c ommand entry) before they appear as softkey selections when displaying the trace. Refer to the "Defini ng External Labels" section in the "Using the External Analyzer" chapter.
Trace List Offset=0 More data off screen (ctrl-F, ctrl-G) Label: Opcode or Status time count xbits hi_byte low_byte Base: mnemonic relative hex binary binary +011 #000000B0C,A2 480 nS 0000 00000000 00000000 +012 supr prog 520 nS 0000 00000000 00000000 +013 supr prog 480 nS 0000 00000000 00000000 +014 #00006007C,(A3) 520 nS 0000 00000000 00000000 +015 supr prog 480 nS 0000 00000000 00000000 +016 supr prog 520 nS 0000 00000000 00000000 +017 0000B04 480 nS 0000 00000000 00000000 +018 supr data wr word 520 nS 0000 00000000 00000000 +019 supr data wr word 480 nS 0000 00000000 00000000 +020 (A2),D0 520 nS 0000 00000000 00000000 +021 (A2) 720 nS 0000 00000000 00000000 +022 0000AF8 520 nS 0000 00000000 00000000 +023 supr data rd byte 480 nS 0000 00000000 00000000 +024 0000AEA 520 nS 0000 00000000 00000000 +025 (A2),D0 760 nS 0000 00000000 00000000
STATUS: M68000--Running user program Emulation trace complete______...R....
display trace external xbits hex then hi_byte binary then low_byte bi nary
run trace step display modify break end ---ETC--
Displaying Traces 3-15
Page 70
1Trace Stat us
Display
In addition to the trace display options mentioned in this chapter, you can display analyzer status with the command below.
display status
<RETURN>
The trace status inf ormation dis pla yed with this command is the same as d isplayed wi th the pod command "ts". Refer to the Terminal Interface: Analyzer User’s Guide for a complete description of this status inf ormation.
Status Emulator Status M68000--Running user program Trace Status Emulation trace complete
Arm ignored Trigger in memory Arm to trigger ? States 512 (512) -1..510 Sequence term 2 Occurrence left 1
STATUS: M68000--Running user program Emulation trace complete______...R....
display status
run trace step display modify break end ---ETC--
3-1 6 Displaying Traces
Page 71
M aking Software Pe r formance Measure ments
1Overview This chapter:
Introduces you to the Software Performance Meas urement Tool (SPMT) and desc ri b es the types of measurements you can make with it.
Describes the proce ss of usi ng the SPM T.
Shows you how to make SPMT measurements on the supplied demo program.
4
1Introduction The Software Performance Meas urement Tool (SPMT) is a feature
of the Sof tkey Interfac e that allows you to make software performance measurements on your programs.
The SPMT post-proces ses information from the a nalyzer trace list. When y ou end a performance measurement, the SPMT dumps the post-processed information to a binary file, which is the n re ad using the perf32 report generator utility .
Two types of software performance measurements can be made with the SPMT: activity measurements, and duration measurements.
Performance Measurements 4-1
Page 72
Activity
Measurements
Activity measurements are measurements of the number of acces ses (re ads or writes) within an address ra nge. The SPMT shows you the percentage of analyzer trace states that are in the spec ified addres s range, as well as the percentage of time taken by those states. Two ty pes of activity are measured: memory activity, and program activity.
Memory Activity
Memory activity is all activity that occurs within the address ra nge.
Program Activity
Program activity is the activity caused by instruction execution in the add ress ra nge. P rogram activity includes opcode fetches and the c ycle s that result from the e xecution of those instruc tions (reads and writes to memory, stack pus hes , etc.).
For example , suppose an addre ss range being measured for acti vity conta ins an opcode that c a uses a stack push, which results in multiple write operations to the stack area (outside the ra nge). The memory activity measurement will count only the stack push opcode cyc le. However, the program ac tivity measurement will count the stack push opcode cyc le and the write operations to the stack.
By comparing the program ac tivity and the memory activi ty in an address ra nge, you can get an ide a of how much a ctivity in other areas is caused by the code being measured. An activity measurement report of the code (prog), data, and stack sections of a program is shown in figure 4-1.
Duration
Measurements
4-2 Performance Mea surements
Duration measurements provide a b est-case/worst-case characterization of code execution time. These measurements record executi on times that fall within a set of speci fied time ranges. The analyzer trace command is set up to store only the entry and exit states of the module to be measured (for ex ample , a C function or Pascal procedure). The SPMT provides two types of duration measurements: module d uration, and module usage.
Page 73
Label prog
Address Range ADEH thru 1261H
Memory Activity State Percent Rel = 57.77 Abs = 57.77 Mean = 295.80 Sdv = 26.77 Time Percent Rel = 60.97 Abs = 60.97
Program Activity State Percent Rel = 99.82 Abs = 99.82 Mean = 511.10 Sdv = 0.88 Time Percent Rel = 99.84 Abs = 99.84
data Address Range 6007AH thru 603A5H
Memory Activity State Percent Rel = 30.51 Abs = 30.51 Mean = 156.20 Sdv = 31.87 Time Percent Rel = 28.09 Abs = 28.09
Program Activity State Percent Rel = 0.18 Abs = 0.18 Mean = 0.90 Sdv = 0.88 Time Percent Rel = 0.16 Abs = 0.16
stack Address Range 40000H thru 43FFFH
Memory Activity State Percent Rel = 11.72 Abs = 11.72 Mean = 60.00 Sdv = 29.24 Time Percent Rel = 10.94 Abs = 10.94
Program Activity State Percent Rel = 0.00 Abs = 0.00 Mean = 0.00 Sdv = 0.00 Time Percent Rel = 0.00 Abs = 0.00
Graph of Memory Activity relative state percents >= 1 prog 57.77% ***************************** data 30.51% **************** stack 11.72% ******
Figure 4-1. Memory Activity and Program Activity
Performance Measurements 4-3
Page 74
Graph of Memory Activity relative time percents >= 1 prog 60.97% ******************************* data 28.09% ************** stack 10.94% ******
Graph of Program Activity relative state percents >= 1 prog 99.82% **************************************************
Graph of Program Activity relative time percents >= 1 prog 99.84% **************************************************
Summary Information for 10 traces
Memory Activity State count Relative count 5120 Mean sample 170.67 Mean Standard Dv 29.30 95% Confidence 12.28% Error tolerance Time count Relative Time - Us 2221.20
Program Activity State count Relative count 5120 Mean sample 170.67 Mean Standard Dv 0.58 95% Confidence 0.24% Error tolerance Time count Relative Time - Us 2221.20 Absolute Totals Absolute count - state 5120
Figure 4 -1. Memory and Program Activity (Cont’d)
Module Duration
Module duration measurements record how much time it takes to execute a particula r code segme nt (for example , a f unction in the source f ile).
4-4 Performance Mea surements
Page 75
Module Usage
Module usage shows how much of the execution time is spent outside of the module (from exit to entry ). This measurement g ives an indication of how ofte n the module is being use d.
1Using the
Software Performance Measurement Tool
Se tt ing Up the Tr ace
Command
Activity and duration measurements are made with the SPMT in a f ive -step process, as follow s:
1. Set up the trace command.
2. I nitia lize the performance measurement.
3. Run the performance measurement.
4. End the performance measurement.
5. Generate the performance measurement report.
These five steps are described in the following parag raphs.
Before you ini tialize and run performance measurements, the current trace command (in other words, the last trace command entered) must be properly set up.
In general, you want to give the SPMT as many trace states as possible to post-process, so you should inc re ase the trace depth to the maximum number, as shown in the foll owing command.
display trace depth
Also it is important that "time " be c ounted by the analyzer; otherwise, the S PMT measurements will not be correct.
512 <RETURN>
Activity Meas urements
If you w ish to measure activ i ty as a perc entag e of all activity, the current trace command s hould be the de fault (in other words, "trace counting time < RETURN> "). The def a ult trace command
Performance Measurements 4-5
Page 76
triggers on any state, and all captured states are stored. Also, since state s are stored "after" the trigger state, the maximum number of captured states appears in each trace list.
Using Trace Commands Other than the Default. You can qualify trac e commands any way you like to obtain speci fic information. Howev er, when you qualify the states that get stored in the trace memory, your SPMT results w ill be biased by your qualific ations; the percentages shown will be of only those states stored in the trac e list.
Duration Measurements
For duration measurements, the trace command must be set up to store only the entry and exit points of the m odule of interest. Since the trigger state is always stored, you should trigger on the entry or exit poi nts. For example:
trace after
symbol_entry or symbol_exit <RETURN>
Or:
trace after
end
only
end
counting time
symbol_entry or symbol_exit
counting time
module_name start or module_name
module_name start or module_name
<RETURN>
only
Where " sy mb ol_entry" and "symbol_exit" are s ymbols from the user prog ram. Or, where "module_name" is the name of a C function or Pas cal procedure (and is listed as a procedure symbol in the global sy mbol display).
I niti a liz ing th e
Performance
Measurement
4-6 Performance Mea surements
After you set up the trace command, you must tell the SPMT the address ranges on which you wi sh to make activity measurements or the time ranges to be used in the duration measurement. This is done by initializing the performance measurement. You can initiali ze the performance measurement in the following way s:
Default initialization (activity measurement using global symbols if the symbols database is loaded).
Page 77
Initialize with use r-defined files (activity or duration measurement).
Initialize with gl obal sy mb ol s (activ ity measurement).
Initialize with local symb ol s (activ ity measurement).
Restore a previous performance measurement (if the emulation system has been exited and reentered).
Default Initialization
Entering the "performance_measurement_initial ize" command with no options s pecifies an activ ity measurement. If a valid symbolic database has been loaded, the addresses of all global procedures and static symbols will be used; otherwise, a default set of ra nges tha t cover the entire processor address range will be used.
Initialization with User Defined Ranges
You c a n specifi cally give the SPMT address or time ranges to use by placing the information in a fi le and entering the fi le name in the " performance_measurement_initialize" command. The formats for the address range file (activity measurements) and time range fi le (duration measurements) are described below.
Address Range File Format. Address range files may contain prog ram symbols (proce dure name or static), user defined address ranges, and comments. An example address range file is shown below.
# Any line which starts with a # is a comment. # All user’s labels must be preceded by a "|".
|users_label 10H 1000H program_symbol
# A program symbol can be a procedure name or a static. In the case of a pro­# cedure name the range of that procedure will be used.
|users_label2 program_symbol1 -> program_symbol2 # "->" means thru. The above will define a range which starts with symbol1
# and goes thru symbol2. If both symbols are procedures then the range will # be defined as the start of symbol1 thru the end of symbol2.
dir1/dir2/source_file.s:local_symbol
Performance Measurements 4-7
Page 78
# The above defines a range based on the address of local_symbol.
Time Range File Format. Tim e range files may contain comments and time ranges in units of microsec onds (us ), milliseconds (ms), or seconds (s). An ex ample time range file is shown below .
# Any line which starts with a # is a comment. 1 us 20 us
10.1 ms 100.6 ms
3.55 s 6.77 s # us microseconds
# ms milliseconds # s seconds # # The above are the only abbreviations allowed. The space between the number # and the units abbreviation is required.
Selecting Duration Measurements
Activity measurements are sel e cted when the "performance_measurement_initial ize" command is entered with no options, with just a file name, or w ith the global or local symbol options. You must enter one of the following commands to sel e ct a duration measurement.
performance_measurement_initialize duration
<RETURN>
performance_measurement_initialize <FILE> duration
<RETURN>
When no user defined tim e range file is specified, the following set of default time ranges are used.
1 us 10 us
10.1 us 100 us
100.1 us 500 us
500.1 us 1 ms
1.001 ms 5 ms
5.001 ms 10 ms
10.1 ms 20 ms
20.1 ms 40 ms
40.1 ms 80 ms
80.1 ms 160 ms
160.1 ms 320 ms
320.1 ms 640 ms
640.1 ms 1.2 s
4-8 Performance Mea surements
Page 79
Initialization with Global Symbols
When the "performance_meas urement_initial ize" command is entered with no options or with the "global_symbols" option, the global s ymbols in the symbols database b ecome the address ranges for which activity is meas ured. If the symbols database is not loaded, a default set of ranges that cover the enti re processor address range will be used.
The global symbols databa se conta ins procedure symbols , whic h are associated with the address range from the beginni ng of the procedure to the end, and static s ymbols , whic h a re ass ociated with the address of the static variable.
Initialization with Local Symbols
When the "performance_meas urement_initial ize" command is entered with the "local_symbols_in" option and a source file name, the symbols associa te d with that source file bec ome the address ranges for which activity is measured. If the symbols d atabase is not load ed, an error m essa ge will occur telling you that the source fi l ename s ymbol was not f ound.
You can also use the "local_symbols_in" option with procedure symbols; this allows you to measure activity rela ted to the symbols defined in a si ngle function or procedure.
Below are example c ommands showing performance measurement ini tialization with local symbols.
performance_measurement_initialize local_symbols_in
spmt_demo.C: <RETURN>
performance_measurement_initialize local_symbols_in
spmt_demo.C:math_library
<RETURN>
performance_measurement_initialize local_symbols_in
math_library <RETURN>
Restoring the Current M easurement
The "performance_ m easurement_initiali ze restore" command allows you to restore old perform a nce meas urement data from the perf.out file in the current directory.
Performance Measurements 4-9
Page 80
If you have not e xited and reentered emul ation, you can add traces to a performance measurement simply by entering another "performance_measurement_run" command. How ever, if you exit and reenter the emulation sy stem, you must enter the "performance_measurement_initial ize restore" command bef ore you can add traces to a performance measurement. When you restore a performance meas urement, make sure your current trace
comma nd is identical to the comma nd used with the restored measurement.
The "restore" option checks the emulator software version and w ill only work if the perf.out files you are restori ng were made with the sa me software version as is presently running in the emulator. If you ran tests usi ng a former software ve rsion and saved perf.out f iles, then updated your software to a ne w version number, you w ill not be ab le to restore old perf.out measurement files .
Running the
Performance
Measurement
Ending the
Performance
Measurement
The "performance_ m easurement_run" command processes analyzer trace data. When you end the performance measurement, this processed d ata i s dumped to the binary "perf.out" file in the current directory. The perf32 report generator utility is used to read the binary information i n the "perf.out" file.
If the "performance_measurement_run" command i s entered without a c ount, the current trace data is processed. If a c ount is spe cified, the current trace co mmand is executed consec utively the number of times specified. The data that results from each trace command is processed and combined with the existing processed data. The STATUS line will say "Processing trace < NO.> " during the run so you w ill know how your measurement is progressing. The onl y wa y to stop this series of tra ces is by using < CTRL> -C (sig INT).
The more tra ces you include in your sample, the more accura te will be your results. At le ast four consecutive trac e s are required to obtai n statis tical interpretation of activity measurement results.
The "performance_ m easurement_end" command takes the data generated by the "perf ormance_measurement_run" command and places it in a file named perf.out in the current directory. If a file named "perf.out" already exi sts in the current directory, it w ill be overwritten. The refore, if you wish to save a performance
4-10 Performance Measurements
Page 81
measurement, you must rename the perf.out file before performing another measurement.
The "performance_ m easurement_end" command does not aff ect the c urrent performance measurement data which exists within the emulation system. In other words, you can ad d more trace s later to the existing performance measurement by entering another "performance_measurement_run" command.
Once you have entered the " performance_measurement_end" command, you can use the perf32 report ge nerator to look at the data saved in the perf.out file.
Note
Using the "perf32"
Report Generator
The "perf.out" file is a binary file. Do not try to read it with the HP-UX more or cat commands. The perf32 report genera tor utility (described in the following section) must be used to read the conte nts of the "perf.out" file.
The perf32 report ge nerator utility must be used to read the information in the " perf. out" file and other files dumped by the SPMT (in other words, renamed "perf.out" files). The perf32 utility is run from the HP-UX shell. You can f ork a shel l while in the Softkey Interface and run perf32, or you can exit the Softkey Interface and run perf32.
Options to "perf32"
A default report, contai ning all performance measurement information, is generated when the perf32 command is used without any options . The options available with perf32 allow you to limit the information i n the generated report. These options a re described below.
-h Produce outputs limited to histograms.
-s Produce a summary limited to the statistical
data.
Performance Measurements 4-11
Page 82
-p Produce a summary limited to the program
activity.
-m Produce a summary limited to the memory
activity.
-f< fi le> Produce a report based on the information
conta ined in <file> instea d of the information contained in perf.out.
For example, the following commands save the current performance measurement information in a fi le called "perf1.out", and produce a hi stogram showing only the program activity occupied by the functions and variables .
mv perf.out perf1.out <RETURN> perf32 -hpf perf1.out <RETURN>
Options -h, -s, -p, and -m affe ct the contents of reports generated for ac tivity measurements. These options have no effect on the conte nts of reports generated for duration (time interv al) measurements.
Interpreting Reports of Activity Measurements
Activity measurements are measurements of the number of acces ses (re ads or writes) within an address ra nge. The reports generated for ac ti vity measurements show you the percentage of analyzer trace states that are in the specified address range, as well as the percentage of time taken by those states. The performance measurement must include four traces before sta ti stic s (mean and standard deviation) appear in the activity report. T he inform ation you will see in activity measurement reports is des cribe d b e l ow.
4-12 Performance Measurements
Memory Activity. All acti vity found within the address range.
Program Activity. All activ ity caus ed by instruction execution in
the add ress ra nge. P rogram activity includes opcode fetches and the c ycle s that result from the e xecution of those instruc tions (reads and writes to memory, stack pus hes , etc.).
Page 83
Relative. With res pect to ac tivity in all ranges defined in the performance measurement.
Absolute. Wi th re spect to all activity, not just acti vity in those ranges d efined in the performance measurement.
Mean. Average number of s tates in the range per trace. The following equation is use d to c al culate the mean:
Standard Deviation.
Devia tion from the mean of state count.
The following equation is used to ca lculate standard deviation:
Where:
N Number of traces in the measurement.
mean Av erage number of s tates in the range per
trace.
S
sumq
Sum of sq uares of states in the range per trace.
Symbols Within Range. Names of other symbols that identify addresse s or rang e s of a ddresses within the range of this s ymbol.
Additional Symbols for Address. Names of other symbols that also i d entify this ad d res s.
Performance Measurements 4-13
Page 84
Note
Som e compilers em it more than one s ymbol for certain addresses . For example, a compiler may emit "math_library" and "_math_library" for the first address in a routine named math_library. The analyzer will s how the first symbol it finds to represent a range of addresses, or a single ad dress point, and it will show the other symbols under either "Symbols within range" or "Addi tional symbols for address", as applicable. In the "math_library" example, it may show either "math_library" or "_math_library" to represent the range, depending on which symbol it finds first. The other symbol will be shown below "Symbols within range" in the report. These conditions appea r particularl y in def ault measurements that include all gl obal and local symbols.
Relative and Absolute Counts. Relati ve count is the total number of states associ ated with the addre ss ranges in the performance measurement. Relativ e time is the total amount of time associ ated with the address ranges in the performance measurement. The absolute c ounts are the numbe r of state s or amount of time associated with all the state s in al l the trace s.
Error Tolerance and Confidence Leve l. An approximate e rror may exist in displayed information. Error tolerance for a level of conf idence is calculated usi ng the mean of the standard dev iations and the mean of the means. Error tolerance g ive s an indication of the stability of the information. For example, if the error is 5% f or a confidence l evel of 95%, then you ca n be 95% confid ent that the information has an error of 5% or less.
The Student’s "T" distribution is used in these calculations bec a use it improves the ac curac y for s mall samples. As the size of the sa mple increase s, the Student’s "T" dis tribution approaches the normal d istrib ution.
4-14 Performance Measurements
Page 85
The following equation is used to ca lculate error tolerance:
Where:
O
m
Mean of the standard deviations.
t Table entry in Student’s "T" table for a given
confidence le vel.
N Number of traces in the measurement.
P
m
Mean of the means (i.e., mean sample).
Interpreting Reports of Duration Meas urements
Duration measurements provide a b est-case/worst-case characterization of code execution time. These measurements record executi on times that fall within a set of speci fied time ranges. The information you will see in duration measurement reports is described below.
Numbe r of Intervals. Number of "from address" and "to address" pairs (afte r prefetch correction).
M aximum Time. The greatest amount of time between the "from address" to the "to address".
Minimum Time . The shortest amount of time between the "from address" to the "to address".
Ave rage Time. Average time between the " from address" and the "to address". The following e quation is used to calculate the average time:
Performance Measurements 4-15
Page 86
Standard De viation. Deviation from the mean of time. The
f ollowing equation is use d to calculate standard devi ation:
Where:
N Number of intervals.
mean Av erage time.
S
sumq
Sum of sq uares of time in the intervals.
Error Tolerance and Confidence Leve l. An approximate e rror may exist in displayed information. Error tolerance for a level of conf idence is calculated usi ng the mean of the standard dev iations and the mean of the means. Error tolerance g ive s an indication of the stability of the information. For example, if the error is 5% f or a confidence l evel of 95%, then you ca n be 95% confid ent that the information has an error of 5% or less.
The Student’s "T" distribution is used in these calculations bec a use it improves the ac curac y for s mall samples. As the size of the sa mple increase s, the Student’s "T" dis tribution approaches the normal d istrib ution.
The following equation is used to ca lculate error tolerance:
Where:
O
m
Mean of the standard deviations in each time range.
t Table entry in Student’s " T" table for a gi ven
confidence le vel.
4-16 Performance Measurements
Page 87
N Number of i ntervals.
P
m
1Examples This section:
Describes the SPMT demo prog ram.
Performs an example activity measurement on the demo prog ram and describes the results.
Performs an example duration measurement on the demo prog ram and describes the results.
The SPMT Demo
Program
The SPMT demo program is a C program that has b een supplied with your Softkey Interface. This program i s used in example s in this chapter to illustrate the SPMT. A diagram of the function calls in the demo progra m is shown in fi gure 4-2.
Refer to your compiler doc um entation for information on compiling the demo program and to your Emulator Softkey Interface User’ s Guid e for information on configuring the em ulator and loading and exec uting programs.
Mean of the means (i.e., mean of the average times in each time ra nge).
Generally , you perform the foll owing steps be fore using the SPMT to make software performance measurements.
Compile the dem o program.
Enter the emulation system and conf igure the emulator (map memory, restrict to real -time).
Load a nd run the demo program.
Performance Measurements 4-17
Page 88
Main Program 1st Level 2nd Level 3rd Level 4th Level Module Function Calls Function Calls Function Calls Function calls
main request_command
initialze
input_line
clear_buffer parse_command
get_next_token move_byte
lookup_token
scan_string
scan_number
apply_controller
syntax_check
semantic_check
report_errors
stack_library
apply_productions report_result math_library
calculate_answer format_result endcommand outputline
Figure 4-2. Demo Program Function Calls
4-18 Performance Measurements
Page 89
Example of Compiling and Executing the Demo Program
If you wish to step through the examples in this chapter, y ou m ust have the appropria te C compiler for your particular emula tor. You do not have to ste p through the examples to lea rn how the SPM T work s; rea ding through the examples should be sufficient.
Note
The following procedure for compiling the SPMT demo program (with the HP 64902 C Cross Compiler), modifying the emulator configuration, and loading and running the sample program i s for the HP 64742 68000 Emulator.
Most likely, there will be differences when compiling, c onfiguring, and loading for other HP 64700 Series emulators.
Copying the Demo Program. The d emo program can be copied with the following command.
$ cp /usr/hp64000/demo/emul/hp64742/spmt_demo.c spmt_demo.c <RETURN>
Compiling the Demo Program. The absolute file used to g enerate the SPMT examples shown later i n this c hapter wa s generated with the following HP 64902 68000 C Cross Compiler command:
$ cc68000 -hvOGNr hp64742 -o spmt_demo spmt_demo.c <RETURN>
Copying the Default Emulator Configuration File. Since the HP 64902 68000 C Cross Compiler provides d e fault configuration files for the HP 64742 68000 Emulator, copy the default emulator configuration file to the current dire ctory bef ore you enter the emulation system.
$ cp /usr/hp64000/env/hp64742/config.EA config.EA <RETURN>
Performance Measurements 4-19
Page 90
To configure the emulator to restrict to real-time runs, edi t the default configuration file :
$ chmod 644 config.EA <RETURN> $ vi config.EA <RETURN>
Add a line which reads "Restrict to real -time runs? yes" just before the memory map definiti on, save your c hanges, and e xit out of the edi tor.
Entering the Emulation System. If you have ins talled your emulator and Softkey Interface software as directed i n the HP 64700-Series Emulators Softkey Interface Installation Notice, you ca n enter the emulation system.
If /usr/hp64000/ b in i s specified i n your PATH environment variable, you can enter the Softkey Interface with the following command:
$ emul700 <emul_name> <RETURN>
The < emul_name> in the command above is the logi cal emulator name given in the HP 64700 emulator device table (/usr/hp64000/etc/64700tab).
Configuring the Emulator. Once you have entered the emulation system, you can load the default emulator configuration (copied and modified earlier) w ith the following command:
Loading the Demo Program. Enter the foll owing command to load the demo program:
Running the Demo Program. Fina lly, to run the d e mo program, enter the foll owing command:
4-20 Performance Measurements
load configuration
load spmt_demo
config <RETURN>
<RETURN>
run from transfer_address
<RETURN>
Page 91
Activity Measurement
Example
The following example s assume that the SPMT demo program has been loaded into the emulator and is executing .
display trace depth trace counting time performance_measurement_initialize
addr_ranges <RETURN>
The "addr_ranges" f ile contains the names of all the functions in the demo program:
apply_controlle apply_productio calculate_answe clear_buffer endcommand format_result get_next_token initialze input_line lookup_token math_library move_byte outputline parse_command report_errors report_result request_command scan_number scan_string semantic_check stack_library syntax_check
Since these labels are program sy m bols, you do not have to specify the address range associated w ith each label; the SPMT will search the symbol database f or the addresse s of each label .
512 <RETURN> <RETURN>
An easy w ay to create the "addr_ranges" file is to use the "copy global_symbols" command to copy the global symbols to a file named "addr_ranges"; then, fork a shell to HP-UX (by entering "! < RETURN> " on the Softkey Interface command line) and edit the file so that it contains the procedure names shown in figure 4-2. Enter a < CTRL> -D at the HP-UX prompt to return to the Softkey Interface.
To run the performanc e measurement, enter the following command:
performance_measurement_run
20 <RETURN>
Performance Measurements 4-21
Page 92
The command above causes 20 traces to occ ur. The SPMT processe s the trace informa tion after e a ch trace, and the num ber of the trace being processed is s hown on the status line.
Enter the following command to cause the processed trac e information to be dumped to the "perf.out" fil e .
performance_measurement_end
<RETURN>
Now, to generate a report from the "perf .out" fi le, type the following on the command line to fork a shell and run the perf32 utility:
!perf32 | more
Information similar to the listing in figure 4-3 is scrolled onto your display.
4-22 Performance Measurements
Page 93
Label math_library
Address Range C54H thru CA6H
Memory Activity State Percent Rel = 41.31 Abs = 23.72 Mean = 121.45 Sdv = 105.82 Time Percent Rel = 41.28 Abs = 25.00
Program Activity State Percent Rel = 46.60 Abs = 46.49 Mean = 238.05 Sdv = 206.72 Time Percent Rel = 46.12 Abs = 46.00
apply_productio Address Range E5CH thru ED4H
Memory Activity State Percent Rel = 13.20 Abs = 7.58 Mean = 38.80 Sdv = 38.34 Time Percent Rel = 14.03 Abs = 8.50
Program Activity State Percent Rel = 11.16 Abs = 11.13 Mean = 57.00 Sdv = 59.68 Time Percent Rel = 11.89 Abs = 11.86
scan_string Address Range B5CH thru B98H
Memory Activity State Percent Rel = 10.54 Abs = 6.05 Mean = 31.00 Sdv = 72.87 Time Percent Rel = 10.22 Abs = 6.19
Program Activity State Percent Rel = 9.83 Abs = 9.80 Mean = 50.20 Sdv = 117.57 Time Percent Rel = 9.67 Abs = 9.65
move_byte Address Range B1EH thru B5AH
Memory Activity State Percent Rel = 9.13 Abs = 5.24 Mean = 26.85 Sdv = 62.77 Time Percent Rel = 8.87 Abs = 5.37
Program Activity State Percent Rel = 8.49 Abs = 8.47 Mean = 43.35 Sdv = 101.60 Time Percent Rel = 8.37 Abs = 8.35
Figure 4 - 3. Example Activity Measurement
Performance Measurements 4-23
Page 94
stack_library Address Range C16H thru C52H
Memory Activity State Percent Rel = 8.45 Abs = 4.85 Mean = 24.85 Sdv = 42.28 Time Percent Rel = 8.08 Abs = 4.89
Program Activity State Percent Rel = 8.13 Abs = 8.12 Mean = 41.55 Sdv = 70.29 Time Percent Rel = 7.91 Abs = 7.89
initialze Address Range F24H thru F88H
Memory Activity State Percent Rel = 3.40 Abs = 1.95 Mean = 10.00 Sdv = 44.72 Time Percent Rel = 3.40 Abs = 2.06
Program Activity State Percent Rel = 3.21 Abs = 3.20 Mean = 16.40 Sdv = 73.34 Time Percent Rel = 3.22 Abs = 3.22
syntax_check Address Range DA8H thru DF4H
Memory Activity State Percent Rel = 3.37 Abs = 1.93 Mean = 9.90 Sdv = 44.04 Time Percent Rel = 3.36 Abs = 2.03
Program Activity State Percent Rel = 3.17 Abs = 3.16 Mean = 16.20 Sdv = 71.75 Time Percent Rel = 3.18 Abs = 3.17
report_errors Address Range BD8H thru C14H
Memory Activity State Percent Rel = 2.45 Abs = 1.41 Mean = 7.20 Sdv = 23.49 Time Percent Rel = 2.35 Abs = 1.42
Program Activity State Percent Rel = 2.35 Abs = 2.34 Mean = 12.00 Sdv = 39.15 Time Percent Rel = 2.30 Abs = 2.29
Figure 4 - 3. Example Activity Measurement (Cont’d)
4-24 Performance Measurements
Page 95
lookup_token Address Range D42H thru DA6H
Memory Activity State Percent Rel = 2.07 Abs = 1.19 Mean = 6.10 Sdv = 14.29 Time Percent Rel = 2.20 Abs = 1.33
Program Activity State Percent Rel = 1.55 Abs = 1.54 Mean = 7.90 Sdv = 19.78 Time Percent Rel = 1.66 Abs = 1.66
semantic_check Address Range DF6H thru E5AH
Memory Activity State Percent Rel = 1.99 Abs = 1.14 Mean = 5.85 Sdv = 25.70 Time Percent Rel = 2.04 Abs = 1.23
Program Activity State Percent Rel = 1.76 Abs = 1.76 Mean = 9.00 Sdv = 38.63 Time Percent Rel = 1.81 Abs = 1.80
apply_controlle Address Range FF0H thru 1072H
Memory Activity State Percent Rel = 1.80 Abs = 1.04 Mean = 5.30 Sdv = 7.73 Time Percent Rel = 1.95 Abs = 1.18
Program Activity State Percent Rel = 1.16 Abs = 1.15 Mean = 5.90 Sdv = 8.52 Time Percent Rel = 1.32 Abs = 1.32
request_command Address Range 10E6H thru 1132H
Memory Activity State Percent Rel = 0.61 Abs = 0.35 Mean = 1.80 Sdv = 8.05 Time Percent Rel = 0.61 Abs = 0.37
Program Activity State Percent Rel = 0.59 Abs = 0.59 Mean = 3.00 Sdv = 13.42 Time Percent Rel = 0.59 Abs = 0.59
Figure 4 - 3. Example Activity Measurement (Cont’d)
Performance Measurements 4-25
Page 96
outputline Address Range CA8H thru CF2H
Memory Activity State Percent Rel = 0.37 Abs = 0.21 Mean = 1.10 Sdv = 0.97 Time Percent Rel = 0.33 Abs = 0.20
Program Activity State Percent Rel = 0.71 Abs = 0.71 Mean = 3.65 Sdv = 3.23 Time Percent Rel = 0.66 Abs = 0.66
format_result Address Range ED6H thru F22H
Memory Activity State Percent Rel = 0.37 Abs = 0.21 Mean = 1.10 Sdv = 3.77 Time Percent Rel = 0.37 Abs = 0.22
Program Activity State Percent Rel = 0.42 Abs = 0.42 Mean = 2.15 Sdv = 6.02 Time Percent Rel = 0.41 Abs = 0.41
calculate_answe Address Range 1074H thru 10E4H
Memory Activity State Percent Rel = 0.31 Abs = 0.18 Mean = 0.90 Sdv = 4.02 Time Percent Rel = 0.31 Abs = 0.19
Program Activity State Percent Rel = 0.27 Abs = 0.27 Mean = 1.40 Sdv = 6.26 Time Percent Rel = 0.28 Abs = 0.28
report_result Address Range 119AH thru 11ECH
Memory Activity State Percent Rel = 0.31 Abs = 0.18 Mean = 0.90 Sdv = 4.02 Time Percent Rel = 0.32 Abs = 0.19
Program Activity State Percent Rel = 0.27 Abs = 0.27 Mean = 1.40 Sdv = 6.26 Time Percent Rel = 0.29 Abs = 0.28
Figure 4 - 3. Example Activity Measurement (Cont’d)
4-26 Performance Measurements
Page 97
get_next_token Address Range F8AH thru FEEH
Memory Activity State Percent Rel = 0.15 Abs = 0.09 Mean = 0.45 Sdv = 2.01 Time Percent Rel = 0.17 Abs = 0.10
Program Activity State Percent Rel = 0.09 Abs = 0.09 Mean = 0.45 Sdv = 2.01 Time Percent Rel = 0.10 Abs = 0.10
endcommand Address Range 11EEH thru 11F6H
Memory Activity State Percent Rel = 0.10 Abs = 0.06 Mean = 0.30 Sdv = 1.34 Time Percent Rel = 0.09 Abs = 0.05
Program Activity State Percent Rel = 0.14 Abs = 0.14 Mean = 0.70 Sdv = 3.13 Time Percent Rel = 0.13 Abs = 0.13
scan_number Address Range B9AH thru BD6H
Memory Activity State Percent Rel = 0.03 Abs = 0.02 Mean = 0.10 Sdv = 0.31 Time Percent Rel = 0.03 Abs = 0.02
Program Activity State Percent Rel = 0.07 Abs = 0.07 Mean = 0.35 Sdv = 0.93 Time Percent Rel = 0.06 Abs = 0.06
clear_buffer Address Range CF4H thru D40H
Memory Activity State Percent Rel = 0.02 Abs = 0.01 Mean = 0.05 Sdv = 0.22 Time Percent Rel = 0.01 Abs = 0.01
Program Activity State Percent Rel = 0.03 Abs = 0.03 Mean = 0.15 Sdv = 0.67 Time Percent Rel = 0.03 Abs = 0.03
Figure 4 - 3. Example Activity Measurement (Cont’d)
Performance Measurements 4-27
Page 98
input_line Address Range ADEH thru B1CH
Memory Activity State Percent Rel = 0.00 Abs = 0.00 Mean = 0.00 Sdv = 0.00 Time Percent Rel = 0.00 Abs = 0.00
Program Activity State Percent Rel = 0.00 Abs = 0.00 Mean = 0.00 Sdv = 0.00 Time Percent Rel = 0.00 Abs = 0.00
parse_command Address Range 1134H thru 1198H
Memory Activity State Percent Rel = 0.00 Abs = 0.00 Mean = 0.00 Sdv = 0.00 Time Percent Rel = 0.00 Abs = 0.00
Program Activity State Percent Rel = 0.00 Abs = 0.00 Mean = 0.00 Sdv = 0.00 Time Percent Rel = 0.00 Abs = 0.00
Graph of Memory Activity relative state percents >= 1 math_library 41.31% ********************* apply_productio 13.20% ******* scan_string 10.54% ****** move_byte 9.13% ***** stack_library 8.45% **** initialze 3.40% ** syntax_check 3.37% ** report_errors 2.45% * lookup_token 2.07% * semantic_check 1.99% * apply_controlle 1.80% *
Graph of Memory Activity relative time percents >= 1 math_library 41.28% ********************* apply_productio 14.03% ******* scan_string 10.22% ***** move_byte 8.87% ***** stack_library 8.08% **** initialze 3.40% ** syntax_check 3.36% ** report_errors 2.35% * lookup_token 2.20% * semantic_check 2.04% * apply_controlle 1.95% *
Figure 4 - 3. Example Activity Measurement (Cont’d)
4-28 Performance Measurements
Page 99
Graph of Program Activity relative state percents >= 1 math_library 46.60% ************************ apply_productio 11.16% ****** scan_string 9.83% ***** move_byte 8.49% **** stack_library 8.13% **** initialze 3.21% ** syntax_check 3.17% ** report_errors 2.35% * lookup_token 1.55% * semantic_check 1.76% * apply_controlle õ.16% *
Graph of Program Activity relative time percents >= 1 math_library 46.12% *********************** apply_productio 11.89% ****** scan_string 9.67% ***** move_byte 8.37% **** stack_library 7.91% **** initialze 3.22% ** syntax_check 3.18% ** report_errors 2.30% * lookup_token 1.66% * semantic_check 1.81% * apply_controlle 1.32% *
Summary Information for 20 traces
Memory Activity State count Relative count 5880 Mean sample 13.36 Mean Standard Dv 23.03 95% Confidence 80.71% Error tolerance Time count Relative Time - Us 2682.00
Program Activity State count Relative count 10216 Mean sample 23.22 Mean Standard Dv 38.59 95% Confidence 77.82% Error tolerance Time count Relative Time - Us 4417.52 Absolute Totals Absolute count - state 10240 Absolute count - time - Us 4428.68
Figure 4-3. Example Activity Measurements (Cont’d)
Performance Measurements 4-29
Page 100
The measurements for each la b el are printed in descending order accordi ng to the amount of activity. You can see that the " math_library" function has the most activity. Also, you can see that no activ ity is recorded for several of the functions. The histogram portion of the report compares the activity in the f unctions that account for at least 1% of the activity for all labels defined in the measurement.
Duration
Measurement
Exa m ples
Before you perform duration measurements, you should be aware of the pre fetc h and recursion considerations associated with these measurements.
Prefetch and Recursion Consider ations
When using the SPMT to perform duration measurements, there should be only two a ddresses stored in the trace memory: the entry address, and the exit addres s. Prefetc hes or recursion can place se veral entry addresses before the first exit address, and/or several exit ad dress es before the f irst entry add re ss. Duration measurements are made betw een the last entry address in a series of entry addresses, and the last exit address in a series of exi t addresses (see figure 4-4). All of the entry and exit addresses which precede these last addresses are assum e d to be unused prefetches, and are ignored during tim e measurements.
START - unused prefetch START - unused prefetch START - unused prefetch START - START actually taken ­ END - unused prefetch END - unused prefetch Measure duration END - unused prefetch END - END actually taken ­ START - unused prefetch START - unused prefetch Measure duration START - unused prefetch START - START actually taken ­ END - unused prefetch END - unused prefetch
4-30 Performance Measurements
Figure 4-4. Prefetc h Correction
Loading...