64x+ advanced emulation techniques and...

Post on 31-Jul-2020

16 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

64x+ Advanced Emulation Techniques

and Technologies

SDO Applications

December, 2007

2

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

3

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

4

XDS560 Trace

• What is XDS560 Trace?

– XDS560 Trace is an Emulation Technology that allows real-time,

non-intrusive logging of CPU Address Bus and Data Bus Activity in

a DSP Application

• Which 64x+ Targets is Trace Available on?

– “Full-GEM” Devices

• C6455

• C6488

• DM647

• DM648

5

XDS560 Trace Architecture

Additional JTAG Emulation Pins

DATA ADDRESS BUSSES

DATA BUSSES

PROGRAM BUS

DSP

XDS560T POD

CPU

XDS560T POD RECORDING

UNIT

• Current Buffer Size: 224K

• Future: 64 MB To/from host PC

Trace & AET Jobs

Comparators

Compressor

Cycle counter

6

Required Hardware and Software

• 60 Pin emulation header

• Target must support Trace (Full-Gem)

• Blackhawk USB 560

• XDS560T Trace Pod/Cable

• CCS 3.30 or higher

7

0x00897C68 102458

102462102463Cycle Count 102456102457102458102459102460102461

Trace Log

PC Cycles

0x00897C64 102457

0x00897C6C 102459

0x00897C70 102460

0x00897C74 102461

0x00897C78 102462

0x00897C7C 102463

0x00897C60 102456

Trace Example (PC & Timing)

8

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

9

Advanced Event Triggering (AET)

• What is it?

– A hardware block on 64x+ “Full Gem” Devices use for detecting

application behavior and generating events.

• Why Discuss AET in conjunction with Trace?

– AET is always bundled with Trace. It is the logic that allows us to

smartly turn on trace to capture data that is interesting, and turn off

trace in locations where it is not interesting.

• Eliminates parsing through data that is irrelevant

• More importantly, conserves Trace Buffer for more interesting

information.

10

AET Hardware Overview

11

AET Job Examples

• Trace PC whenever the PC is between location A and B (PC Trace in Range)

• Trace all writes to memory location 0x12345678 (Data Trace)

• Halt whenever the application executes the instruction at location 0x801000, but only after it has executed the instruction at 0x804060 (Hardware Breakpoint qualified by a Sequencer State)

• Halt when the value 0x00001234 is written to location 0x80500000 (Halt on Data Write qualified by value)

12

Triggers

• What type of events (triggers) can be generated?

– CPU Halt (with Debugger Connected)

– Interrupt

– Start/Increment Counter

– Stop/Reload Counter

– Start Trace

– Stop Trace

– Store Trace Sample

– Toggle Emu 0/1 Pin

13

How much hardware is it?

• 6 Dual Range Comparators (4 PA/DA + 2 PA Only)

• 14 Trigger Builders* (General Use)

– 6 1-Wide Trigger Builders (Halt, Interrupt, Inc. Counter)

– 6 3-Wide Trigger Builders (State Machine State Change, Stop

Trace)

– 2 7-Wide Trigger Builders (Start Trace/ Capture Trace)

• 1 4 State State Machine (Can be split into 2 2-State)

• 2 32-Bit Multiple Mode Counters

* A Trigger Builder is just a lookup table which defines a

truth table for the combination of inputs. It is hardwired

to one of 4 events that it can generate.

14

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

15

AET Target Library

• Target Side Library allowing the user to program and

reprogram AET hardware from within their application.

• Documentation and examples Included

16

AET Target Library

DISCLAIMER

AET Target Library cannot be used simultaneously with the CCS Event Analysis

Plug-in. There is no means for resource sharing

between the two. The AET hardware is owned by either the debugger or the application.

17

AET Target Library Pros/Cons

• Pros

– Allows the user to dynamically

reprogram AET resources,

resulting in more advanced

scenarios

• TSK Stack Monitor

• Tracing of specific functions

based on context

– Full Symbolic support

• UBM Plug-in will fix this

– Can actually use AET resources

somewhat like an extra peripheral

– Can configure in initialization

routine

– Supports some scenarios that the

AET Plug-in does not

• Cons

– Requires Code Modification

– Consumes Application Cycles

– Consumes Application Footprint

18

AET Target Library – Code Example

Halt on Write to Range

AET_jobParams params; /* Data Watchpoint Parameter Structure */

AET_jobIndex jobNumber; /* Job Number returned by AETLIB */

/* Initialize Parameter Structure */

params = AET_JOBPARAMS;

/* Set Parameters to Halt on Access to first 0x15 elements of memArray[] */

params.dataStartAddress = (Uint32) &memArray1[0];

params.dataEndAddress = (Uint32) &memArray1[0x15];

params.triggerType = AET_TRIG_HALT_CPU;

params.readWrite = AET_WATCH_WRITE;

params.refSize = AET_REF_SIZE_WORD;

/* Initialize AET */

AET_init();

/* Claim the AET resource */

if (AET_claim()!=AET_SOK)

return;

/* Setup the AET job with selected parameters */

if (AET_setupJob(AET_JOB_TRIG_ON_DATA_RANGE, &params)!=AET_SOK)

return;

/* Remember the index of this job in the job table */

jobNumber = params.jobIndex;;

/* Enable AET */

if (AET_enable()!=AET_SOK)

return;

19

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

20

Application Analysis with XDS560 Trace

21

Advantages over Traditional Methods

• Profiling on Actual Hardware

– No Modifications necessary for peripherals that aren’t simulated

– Memory/Cache effects inherently captured

– Extremely Fast, results in minutes

22

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

23

Interrupt Profiling Overview

• Capture Program Address

and Timestamp whenever the

PC is within the Interrupt

Vector Table

• Generate a cycle accurate

picture of when each

interrupt starts executing

Graphically display interrupt cycle

accurate interrupt servicing

frequency

24

Trigger Configuration (Using UBM)*

*This Feature Added to UBM in CCS SR10

User needs only to specify the

symbol that signifies the start of

the interrupt vector table

25

Data Captured

Raw Trace Data Processed Data

26

Results

27

Results - 2

28

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

29

Statistical Profiling Overview

Fxn1

Fxn2

Fxn3

Fxn4

Fxn5

Fxn6

4 4 2 5 3 3 2 2 2 3 3 6 6 4 4

• The Program Address is sampled at regular intervals

• Statistical Analysis is performed on the captured samples

• As in any statistical analysis, the determinations made on

the statistical sample can be related to the general

population

30

Statistical Profiling - 2

• AET contains all of the hardware needed to capture

trace samples at a specified interval

• Interval should be carefully chose so as not to coincide

with a periodic function

• Application instrumentation can switch AET off in

locations that are not of interest

31

Trigger Configuration (Using UBM)*

*This Feature Added to UBM in CCS SR9

User needs only to specify the

desired number of cycles

between samples

32

Statistical Profiling - Results

• Comma Separated Value

Format

• Sorted from most intensive

functions to least

33

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

34

Thread Aware Profiling

GOAL

Generate a cycle accurate

execution graph of a

Thread/Task based

application

Time (cycles)

35

Solution

• Instrument the task/thread switch function to write the

task/thread ID to a well known location (global variable)

– Operating systems typically provide hooks to insert functions in

this location

• Trace all of the writes to that location, and get a

timestamp with each.

36

Trigger Configuration (Using UBM)*

*This Feature Added to UBM in CCS SR10

User needs only to specify the address of the thread

value write. This can be a numerical value, or a symbolic

variable name preceded by the address of operator.

Example: &TRACE_thrExecLog

37

Results

38

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

39

Thread Aware Dynamic Call Graph

GOAL

Display a Thread Based

representation of actual

function execution in an

application

200

200

132

68

65

40

Capturing the Data

• Thread/Task

– Hook function writes address of task

• Function

– Entry/Exit points instrumented with Mark 0/ Mark 1 instructions*

• Mark 0 inlined at each function entry point

• Mark 1 inlined at each function exit point

– Trace captures each of these locations with timestamp

* CGT 6.0.1 enables function hooks

41

Trigger Configuration (Using UBM)*

*This Feature Added to UBM in CCS SR10

User needs only to specify the address of the thread

value write. This can be a numerical value, or a symbolic

variable name preceded by the address of operator.

Example: &TRACE_thrExecLog

Mark 0 is

assumed for

entry, Mark 1 for

exit.

42

Presentation

• Graphical Displays become

impractical as the number of

functions increase

• At right is a sample call graph

displayed by the Guess

graphing package

43

GPROF Like Format

• Modeled after Unix GPROF

• Each Thread separated into it’s own subsection

• Each function section contains only immediate callers and callees

44

A Closer Look Primary Line -

describes the function

which the entry is

about and gives the

overall statistics for this

function

Lines for a Functions

CallersLines for a Functions

Callees

45

Thread: 0x828194

_DEC_tcp2DeintUnpunctsoft3

_DEC_tcp2QuantizeSoft

_DEC_tcp2PreProc

_varianceEstim

_COM_spoolTsk

_COM_spoolPost

_DEC_tcp2EdmaIsr

_DEC_tcp2DeintUnpunctsoft3

Callers

Callees

_DEC_tcp2DeintUnpunctsoft3

Callers

_DEC_tcp2PreProc

Calls = 388/388

Exclusive Cycles = 14491050

Future Display – Tree View

46

Agenda

• XDS560 Trace Overview

• Advanced Event Triggering Overview

• AET Target Lib

• Application Analysis with Trace

– Interrupt Profiling

– Statistical Profiling

– Thread Aware Profiling

– Thread Aware Dynamic Callgraph

• What’s Next ?

47

What’s Coming Soon?

• Event Trace

– See where specific events (such as Cache Misses, Stalls, Etc)

occur within execution of your code

• Extended Buffer Memory

– Software update that allows the Trace Pod to use 64MB of

memory, rather than the current 224KB.

• Script access to Binary Trace Data

– Will allow faster processing of data to work with Extended Buffer

Memory

Questions ???

Backup Slides

50

AET Example0x800080400x000080800x00010010

0x08F0347F0x00001234

Program Address

T2 Read Data

T1 Read Data

T2 Data Address

T1 Data Address

T2 Write Data

T1 Write Data

Address Bus

MultiplexerDual Range

Comparator0x10000

Address

Bus Multiplexer

Dual Range Comparator0x10020

Address Bus

MultiplexerDual Range Comparator0x10000

Address Bus

MultiplexerDual Range

Comparator0x10020

Comparator

Data Bus Multiplexer

0x00001234

Comparator0x00001234

Data Bus Multiplexer

Data

Qualifier Enable

Data

Qualifier Enable

Data Qualifier

Enable

Data Qualifier

Enable

<=

>=

<=

=

=

Start PC+Data Write + TimingTrace on write to memory location 0x10000-0x10020 with a value of 0x00001234

Start Timing Trace

Start RTDX TransmitStart DTDMA

Start PC TraceStore Timing

Stop RTDX TransmitStop DTDMA

Start Read Address TraceStore Read AddressStart RTDX Receive

Stop RTDX ReceiveStore Write Address

Start Write Address Trace

Start Read Data Trace

Store Read Data

Start Write Data TraceStore Write Data

Start PCTAG TraceStore PCTAG

A

B

C

D

A

B

C

D

A

B

C

D

A

B

C

D

A

B

C

D

A

B

C

D

A

B

C

D

Multiplexer

Counter 0 ZeroCounter 1 ZeroTrace Trigger

Multiplexer

State 0State 1State 2State 3

OUTPUT CONTROL = 0

7-Wide Trigger

Builder

Auxiliary Events

0

A&B

A&B

0

0

A&B

0

>=

Trigger Builder Selective ORS

top related