24
Dresden, 07.04.2016 Implementierung eines TPIU- Streamdekoders in VHDL Albert Schulz 1

Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Dresden, 07.04.2016

Implementierung eines TPIU-Streamdekoders in VHDLAlbert Schulz

1

Page 2: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

Gliederung

1. Motivation 2. Zielarchitektur 3. CoreSight 4. Trace Port Interface Unit (TPIU) 5. TPIU-Stream (Continuous Mode) 6. Implementierung 7. Ergebnisse/Ausblick 8. Quellen

2

Page 3: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

1. Motivation

• Tracing erlaubt Mitschneiden des Programmablaufs • führt zu großen Datenmengen, insbesondere bei

Tracing von Speicherzugriffen und deren Inhalten • Zynq-Platform ermöglicht Verarbeitung on-chip mit

hoher Bandbreite, um Datenmenge frühzeitig zu filtern/reduzieren

3

Page 4: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

• ZedBoard mit Zynq-7000 All Programmable SoC • Zynq-7000 beinhaltet:

• ARM Cortex-A9 MPCore Zweikernprozessor mit CoreSight

• programmierbare Logik

2. Zielarchitektur

4

Page 5: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

2. Zielarchitektur

Copyright © 2014 Avnet, Inc. AVNET and the AV logo are registered trademarks of Avnet, Inc. All other brands are the property of their respective owners. LIT # PB-AES-Z7EV-7Z020-G-V3

To purchase this kit, visit www.zedboard.org

Block Diagram

QSPI Flash

SD Card

Gb Ethernet

USB OTG

USB UART

Pmod Compatible

LED

Switches

Pmod (4) Compatible

FMC (LPC)

Audio CODEC

HDMI Out

VGA

128x32 OLED

Clock

XADC

LEDs

Switches

PROG SW

DONE LED

JTAG

512 MB DDR3

Reset

Clock

Mul

tip

lexe

d I/

O (

MIO

)D

edic

ated

Use

r Co

nfi

gure

d L

ogic

Zynq XC7Z020-1CLG484

Prog.

Logic

Processor

Subsystem

Ordering

Part Number Hardware Description Resale

AES-Z7EV-7Z020-G ZedBoard Commercial Edition (Available Exclusively from Avnet) $475 USD

ZEDBOARD ZedBoard Academic Edition (Available Exclusively from Digilent) $319 USD

Asia151 Lorong Chuan,#06-03 New Tech ParkSingapore [email protected] +65-6580-6000

North America2211 South 47th Street Phoenix, Arizona 85034 United States of America [email protected] 1-800-585-1602

Contact Information JapanYebisu Garden Place Tower, 29F4-20-3 Ebisu, Shibuya-ku, Tokyo 150-6029 [email protected]+81-(0)3-5792-8210

EuropeGruber Str. 60c 85586 Poing Germany [email protected]+49-8121-77702

Avnet, Inc.: Avnet Product Brief ZedBoard, http://zedboard.org/sites/default/ files/product_briefs/PB-AES-Z7EV-7Z020_G-v12.pdf, Abruf: 26.01.2016

5

Page 6: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

• Technologie von ARM für Trace- und Debuggingzwecke

• Analyse Prozessor und programmierbarer Logik • Komponenten werden in vier Klassen eingeteilt:

• Trace-Quellen • Trace-Senken • Trace-Verbindungen • Zugang und Kontrolle

• Quellen kann eindeutige ID zugeordnet werden

3. CoreSight

6

Page 7: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

3. CoreSight

Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 722UG585 (v1.10) February 23, 2015

Chapter 28: System Test and Debug

• Standard programmer's models for standard tools support

• Automatic discovery of topology

• Open interfaces for third party soft cores

• Low pin count options

28.1.2 Notices7z010 CLG225 Device

This device supports 32 MIO pins as shown in the MIO table in section 2.5.4 MIO-at-a-Glance Table. The width of the TPIU in the 7x010 CLG225 device is restricted to 1, 2 or 4-bits via the MIO pins. All 32 data signals are available on the EMIO interface. All of the 7z010 CLG225 device restrictions are listed in section 1.1.3 Notices.

28.2 Functional DescriptionThe block diagram for the CoreSight system is shown in Figure 28-1.

X-Ref Target - Figure 28-1

Figure 28-1: CoreSight System Block Diagram

PTM Triggers (x2)

ITMTrigger

Trace/PacketOutput (TPIU)

Embedded CrossTrigger (ECT)

Detector

Packetizer

Program TraceMacrocell

(PTM)

Detector

Packetizer

Fabric TraceMonitor (FTM)

Trigger Register Write PacketRegisters

Instrumentation Trace Macrocell (ITM)

Funnel

UG585_c28_01_022612

MIO/EMIO

Read PacketRegisters

Embedded TraceBuffer (ETB)

CPU 0CPU 1

Replicator

FTMTrigger

PL Fabric

CPUs

Xilinx, Inc.: Zynq-7000 All Programmable SoC Technical Reference Manual, http:// www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf, Ab- ruf: 26.01.2016

7

Page 8: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

• Schnittstelle für Trace-Daten verschiedener Quellen

4. Trace Port Interface Unit (TPIU)Trace Port Interface Unit

8-2 Copyright © 2004-2009 ARM. All rights reserved. ARM DDI 0314HNon-Confidential Unrestricted Access

8.1 About the Trace Port Interface UnitThe TPIU acts as a bridge between the on-chip trace data, with separate IDs, to a data stream, encapsulating IDs where required, that is then captured by a Trace Port Analyzer (TPA). Figure 8-1 shows the main blocks of the TPIU and the clock domains.

Figure 8-1 TPIU block diagram

The behavior of the blocks is as follows:

Formatter Inserts source ID signals into the data packet stream so that trace data can be re-associated with its trace source. See TPIU formatter and FIFO on page 8-36.

Asynchronous FIFO

Enables trace data to be driven out at a speed that is not dependent on the on-chip bus clock.

Register bank

Contains the management, control and status registers for triggers, flushing behavior and external control.

Trace out The trace out block serializes formatted data before it goes off-chip.

PCLK domain

TRACECLKIN

APBi/f Register bank

FormatterTrace out

(serializer)

Pattern generatorAPB

TRACECTL

TRACECLKIN domain

EXTCTL Bus

TRACEDATA[MPS:0]TRACECLK

Flush Control

ATB slave port

ATBi/f

Trigger Control

AsynchronousFIFO

ATCLK domain

ARM Limited: CoreSightTM

Components Technical Reference Manual http: //infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_ components_trm.pdf, Abruf: 27.01.2016

8

Page 9: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

• Trigger signalisieren Eintreten eines bestimmten Ereignisses, ausgelöst z.B.: • durch Cross Trigger Interface (CTI) ausgelöst • Ende eines Flushs

• unbrauchbar bei mehreren Trace-Quellen aufgrund Zeitverzögerungen zwischen Eintreten des Ereignisses und Ausgabe der zugehörigen Daten • Trigger meist innerhalb der Daten kodiert

4. Trace Port Interface Unit (TPIU)

9

Page 10: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

4. Trace Port Interface Unit (TPIU)

Modus BeschreibungBypass • bei einer Trace-Quelle nutzbar

• Keine Formatierung der Eingangsdaten • Signalisierung von Triggern und validen

Daten über TRACECTL-Pin

Normal • Kodierung von IDs und Daten in Trace-Stream

• Signalisierung von Triggern und validen Daten über TRACECTL-Pin

Continuous • Kodierung von IDs und Daten in Trace-Stream

• Kodierung von Triggern und validen Daten ebenfalls im Trace-Stream

10

Page 11: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

• TPIU Protokoll spezifiziert 16-Byte-Frames • Kodierung von IDs der Trace-Quellen und zugehörige

Daten

5. TPIU-Stream (Continuous Mode)

11

Page 12: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

5. TPIU-Stream (Continuous Mode)

D4 Trace Formatter D4.2 Frame descriptions

ARM IHI 0029D Copyright © 2004, 2005, 2012, 2013 ARM. All rights reserved. D4-129ID092613 Non-Confidential

D4.2 Frame descriptions

The formatter protocol outputs data in 16-byte frames. Each frame consists of:• Seven bytes of data.• Eight mixed-use bytes, each of which contains:

— One bit to indicate the use of the remaining seven bits.— Seven bits that can be data or a change of trace source ID.

• One byte of auxiliary bits, where each bit corresponds to one of the eight mixed-use bytes:— If the corresponding byte was data, this bit indicates the remaining bit of that data.— If the corresponding byte was an ID change, this bit indicates when that ID change takes effect.

Figure D4-1 shows the structure of a formatter frame.

Figure D4-1 Formatter frame structure

Each time the ID changes, at least one byte of data must be output for that ID. Table D4-1 shows the meaning of each bit in a formatter frame. It is output least significant bit first, starting with bit 0.

31 24 23 17 15 8 7 1 0

ID or Data (J)

ID or Data (B)Data

ID or Data (C)DataID or Data (D)Data

ID or Data (E)DataID or Data (G)Data

ID or Data (H)Data

ID or Data (A)Data FF

FF

FF

J FFABCDEGH

16

Bytes 3-0

Bytes 7-4

Bytes 11-8

Bytes 15-12

Table D4-1 Meaning of bits in a formatter frame

Byte number Bits Description

0 0 ID or Data control for bits[7:1], see bits in Figure D4-1 marked F.

7:1 Depends on bit 0:0 = Data[7:1].1 = New ID.

1 7:0 Data[7:0].

2 7:0 ID or Data, see byte 0.

3 7:0 Data[7:0].

4 7:0 ID or Data, see byte 0.

5 7:0 Data[7:0].

6 7:0 ID or Data, see byte 0.

7 7:0 Data[7:0].

8 7:0 ID or Data, see byte 0.

9 7:0 Data[7:0].

• Frame besteht aus: • 7 Byte Daten • 8 Byte Daten oder IDs • 1 Byte mit 8 Informationsbits ARM

Limited: CoreSightTM

Components Technical Reference Manual http://infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_ components_trm.pdf, Abruf: 27.01.2016

12

Page 13: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

5. TPIU-Stream (Continuous Mode)

• Synchronisationspakete (0x7FFFFFFF) • periodisch zwischen Frames ausgegeben • an 4-Byte Grenze ausgerichtet

• Idle-Pakete (0x7FFF) • signalisieren, dass keine Trace-Daten zur

Verfügung stehen • treten auch innerhalb von Frames auf • an 2-Byte Grenze ausgerichtet

13

Page 14: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

5. TPIU-Stream (Continuous Mode)

• Wahl der Trace-Quellen-ID frei, bis auf folgende Ausnahmen

ID Beschreibung

0x00 kennzeichnet ungültige Quelle (zur Vervollständigung von Frames)

0x7F Steht in Konflikt mit Sync- und Idle-Paketen

0x7D Kennzeichnet Trigger im Trace-Stream

0x7E, 0x70-0x7C Reserviert

14

Page 15: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

6. Implementierung

• IP-Core aus vier synchron gekoppelten Automaten (mit gleichem Takt)

15

Page 16: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

6. Implementierung

• Frame-Puffer: • speichert 16-Byte-Frames aus 4-Byte Stream • Synchronisierung über Sync-Pakete • Verwerfen von Sync- und Idle-Paketen • Ausgabe der (nicht dekodierten) 16-Byte-Frames • Gültige Daten werden über Valid-Bit signalisiert

16

Page 17: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

6. Implementierung

• Verarbeitungseinheit: • Dekodiert Frames und stellt Zusammenhang von

Daten und IDs her • letzte ID des vorhergehenden Frames wird

gespeichert • Ausgabe von Daten und dazu zugehörigen IDs

(jeweils über 16-Byte Interface) • Ungültigen Daten wird ID 0x00 zugeordnet • Gültige Ausgabe über Valid-Bit signalisiert

17

Page 18: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

6. Implementierung

• Filter: • Filterung der Trace-Daten auf eine festgelegte ID • Gültige Daten und IDs am Eingang werden

gespeichert • gefilterte Ausgabe des 16-Byte Frames in 4-Byte

Teilen • Ausgabe über 4x Byte-Interfaces • Gültigkeit jedes Bytes über Valid-Bit angegeben

18

Page 19: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

6. Implementierung

• Ausgabeautomat: • puffert vier eingehende, gültige Daten-Bytes • Ausgabe von 4-Byte Datenpaketen pro Takt • Gültigkeit über Valid-Bit und 4-Bit byte_en

Leitung signalisiert • Zusätzlich Flush-Signal um Ausgabe der

gepufferten Bytes zu erzwingen

19

Page 20: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

7. Ergebnisse/Ausblick

• Software um CoreSight zu aktivieren/konfigurieren • Erzeugung von Trace-Daten mittels While-Schleife • Analyse der Trace-Daten an TPIU bzw. eigenem IP-

Core über ChipScope

20

Page 21: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

7. Ergebnisse/Ausblick

• Vergleich der Trace-Daten Ausgabe in Bypass-Modus und dekodierte Daten im Continuous-Modus liefert gleiche (und ähnliche) Daten

Daten (Bypass-Modus)

Daten (dekodiert, Continuous-Modus)

21

Page 22: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

7. Ergebnisse/Ausblick

• Funktionsweise des Dekoders nachgewiesen • Filterung nach ID als Beispiel für einfache

Verringerung der Datenmenge • Grundlage für weitere Verarbeitung/Filterung der

eigentlichen Trace-Daten gelegt

22

Page 23: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722

Implementierung eines TPIU-Streamdekoders in VHDL07.04.2016

8. Quellen

[1] ARM LIMITED: ARM CoreSightTM Architecture Specification v2.0, http://infocenter. arm.com/help/topic/com.arm.doc.ihi0029d/IHI0029D_coresight_architecture_ spec_v2_0.pdf, Abruf: 26.01.2016 [2] Xilinx, Inc.: Zynq-7000 All Programmable SoC Technical Reference Manual, http:// www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf, Ab- ruf: 26.01.2016 [3] Alex Bereza: Coresight-Zugang auf dem ZedBoard, 26.08.2015 [4] Uwe Hermann, Jpa: arm_tpiu http://sigrok.org/wiki/Protocol_decoder:Arm_tpiu, Abruf: 26.01.2016 [5] Avnet, Inc.: Avnet Product Brief ZedBoardTM http://zedboard.org/sites/default/ files/product_briefs/PB-AES-Z7EV-7Z020_G-v12.pdf, Abruf: 26.01.2016 [6] ARM Limited: CoreSightTM Components Technical Reference Manual http: //infocenter.arm.com/help/topic/com.arm.doc.ddi0314h/DDI0314H_coresight_ components_trm.pdf, Abruf: 27.01.2016

23

Page 24: Implementierung eines TPIU- Streamdekoders in VHDL€¦ · 07.04.2016 Implementierung eines TPIU-Streamdekoders in VHDL 3. CoreSight Zynq-7000 AP SoC Technical Reference Manual 722