Reference System: Debugging PowerPC 440 Processor Systems Author: James Lucero

Similar documents
Reference System: Designing an EDK Custom Peripheral with a LocalLink Interface Author: James Lucero

Reference Design: LogiCORE OPB USB 2.0 Device Author: Geraldine Andrews, Vidhumouli Hunsigida

Dual Processor Reference Design Suite Author: Vasanth Asokan

Reference System: MCH OPB EMC with OPB Central DMA Author: Sundararajan Ananthakrishnan

Reference System: MCH OPB SDRAM with OPB Central DMA Author: James Lucero

XA Automotive ECU Development Kit

Virtex-4 PowerPC Example Design. UG434 (v1.2) January 17, 2008

Reference System: PLB DDR2 with OPB Central DMA Author: James Lucero

High-Performance DDR3 SDRAM Interface in Virtex-5 Devices Author: Adrian Cosoroaba

Integrating an EDK Custom Peripheral with a LocalLink Interface into Linux Author: Brian Hill

ML507 Embedded Development Platform

Virtex-5 FXT PowerPC PowerPC 440 and MicroBlaze 440

Point-to-Point Connectivity Using Integrated Endpoint Block for PCI Express Designs Authors: Sunita Jain and Guru Prasanna

Interfacing LVPECL 3.3V Drivers with Xilinx 2.5V Differential Receivers Author: Mark Wood

Benchmarking the Performance of the Virtex-4 10/100/1000 TEMAC System Author: Kris Chaplin

Bus Master DMA Reference Design for the Xilinx Endpoint Block Plus Core for PCI Express Author: Jake Wiltgen

Getting Started Guide with AXM-A30

Hardware In The Loop (HIL) Simulation for the Zynq-7000 All Programmable SoC Author: Umang Parekh

Reference System: XPS LL Tri-Mode Ethernet MAC Embedded Systems for MicroBlaze and PowerPC Processors Author: Ed Hallett

MultiBoot with Virtex-5 FPGAs and Platform Flash XL Authors: Jameel Hussein and Rish Patel

ML605 Built-In Self Test Flash Application

SP605 Built-In Self Test Flash Application

Creating an OPB IPIF-based IP and Using it in EDK Author: Mounir Maaref

System Debug. This material exempt per Department of Commerce license exception TSU Xilinx, Inc. All Rights Reserved

ML605 Built-In Self Test Flash Application

Summary. Overview. Application Note: Virtex-5/-4/-II Pro, Spartan-3A/-3E/-3 FPGAs. XAPP1002 (v1.0) October 22, 2007

Interrupt Creation and Debug on ML403

Reference System: Determining the Optimal DCM Phase Shift for the DDR Feedback Clock for Spartan-3E Author: Ed Hallett

SP605 Standalone Applications

Reference System: PLBv46 Endpoint Bridge for PCI Express in a ML507 Embedded Development Platform Author: Lester Sanders

BFM Simulation in Platform Studio

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

ISE Simulator (ISim) In-Depth Tutorial. UG682 (v 13.1) March 1, 2011

ML631 U1 DDR3 MIG Design Creation

ChipScope Inserter flow. To see the Chipscope added from XPS flow, please skip to page 21. For ChipScope within Planahead, please skip to page 23.

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point Fast Fourier Transform Simulation

ISim In-Depth Tutorial. UG682 (v13.4) January 18, 2012

EDK 7.1 PowerPC Tutorial in Virtex-4

ML631 U2 DDR3 MIG Design Creation

ChipScope Pro Software and Cores User Guide

Configuring Xilinx FPGAs with SPI Serial Flash Author: Stephanie Tapp

ISE Tutorial: Using Xilinx ChipScope Pro ILA Core with Project Navigator to Debug FPGA Applications

Getting Started Guide

Embedded System Tools Reference Manual

ML410 BSB DDR2 Design Creation Using 8.2i SP1 EDK Base System Builder (BSB) April

KC705 Si5324 Design October 2012

Microblaze for Linux Howto

EDK Base System Builder (BSB) support for XUPV2P Board. Xilinx University Program

Vivado Design Suite User Guide

Adding the ILA Core to an Existing Design Lab

QDR II SRAM Interface for Virtex-4 Devices Author: Derek Curd

Data Side OCM Bus v1.0 (v2.00b)

SP601 Built-In Self Test Flash Application

Spartan-6 LX9 MicroBoard Embedded Tutorial. Tutorial 5 Embedded Chipscope Debugging

1-1 SDK with Zynq EPP

Spartan-6 LX9 MicroBoard Embedded Tutorial. Tutorial 1 Creating an AXI-based Embedded System

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

ISE Tutorial. Using Xilinx ChipScope Pro ILA Core with Project Navigator to Debug FPGA Applications. UG750 (v14.4) December 18, 2012

Using Xilinx ChipScope Pro ILA Core with Project Navigator to Debug FPGA Applications. UG750 (v12.3) November 5, 2010

EDK Concepts, Tools, and Techniques

Vivado Design Suite Tutorial:

Vivado Design Suite Tutorial. Designing IP Subsystems Using IP Integrator

Virtex-5 FPGA Embedded Tri-Mode Ethernet MAC User Guide. UG194 (v1.10) February 14, 2011

ML410 VxWorks Workbench BSP and System Image Creation for the BSB Design Using EDK 8.2i SP2. April

PetaLinux SDK User Guide. Eclipse Plugin Guide

Quick Front-to-Back Overview Tutorial

System Ace Tutorial 03/11/2008

Building Crosspoint Switches with CoolRunner-II CPLDs

ISim Hardware Co-Simulation Tutorial: Processing Live Ethernet Traffic through Virtex-5 Embedded Ethernet MAC

ML410 VxWorks BSP and System Image Creation for the BSB DDR2 Design Using EDK 8.2i SP1. April

Vivado Design Suite User Guide

Debugging Nios II Systems with the SignalTap II Logic Analyzer

Module 2: Adding IP to a Hardware Design

MultiBERT IP Toolkit for Serial Backplane Signal Integrity Validation Author: Delfin Rodillas

Getting Started with the MicroBlaze Development Kit - Spartan-3E 1600E Edition. UG258 (v1.3) November 30, 2007

Virtex-5 Embedded Tri-Mode Ethernet MAC

EDK Concepts, Tools, and Techniques

Instantiation. Verification. Simulation. Synthesis

ML605 PCIe x8 Gen1 Design Creation

ChipScope Demo Instructions

Xilinx Vivado/SDK Tutorial

Lab6 HW/SW System Debug

Utility Bus Split (v1.00a)

ML410 VxWorks BSP and System Image Creation for the BSB Design Using EDK 8.2i SP1. April

EDK Concepts, Tools, and Techniques

AC701 Built-In Self Test Flash Application April 2015

Vivado Design Suite User Guide. Designing IP Subsystems Using IP Integrator

LogiCORE IP Mailbox (v1.00a)

University of Toronto ECE532 Digital Hardware Module m07: Using ModelSim to Simulate Your Designs

Building an Embedded Processor System on Xilinx NEXYS3 FPGA and Profiling an Application: A Tutorial

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

Disassemble the machine code present in any memory region. Single step through each assembly language instruction in the Nios II application.

Zynq-7000 Platform Software Development Using the ARM DS-5 Toolchain Author: Simon George and Prushothaman Palanichamy

Synthesizable CIO DDR RLDRAM II Controller for Virtex-II Pro FPGAs Author: Rodrigo Angel

Creating the AVS6LX9MBHP211 MicroBlaze Hardware Platform for the Spartan-6 LX9 MicroBoard Version

LogiCORE IP ChipScope Pro Integrated Controller (ICON) (v1.05a)

SP601 Standalone Applications

Vivado Design Suite Tutorial. Designing IP Subsystems Using IP Integrator

Running Code Out of the PPC405 Caches

KC705 PCIe Design Creation with Vivado August 2012

Transcription:

Application Note: Debugging PowerPC 440 Systems XAPP1060 (v1.1) September 26, 2008 eference System: Debugging PowerPC 440 Processor Systems Author: James Lucero Abstract This application note outlines the techniques for debugging PowerPC 440 processor systems in hardware and simulation. Included Systems Introduction Hardware and Software equirements Simulation equirements eference System Specifics Included with this application note is one reference system, V5_PPC440_debug, built for the Xilinx ML507 ev A board: https://secure.xilinx.com/webreg/clickthrough.do?cid=112731. After building a system, a user wants to ensure the system is functional. A system consists of different combined components, such as processor, bus, and peripherals. To ensure that components are working correctly, the user can simulate the system or test the system in hardware for desired behavior. For simulation, a simulation environment is necessary. With hardware, certain debug programs and cables are necessary. This application note describes how to debug/monitor system behavior through simulation and hardware. A system simulation environment is set up and hardware debug tools are described. A software application provides stimulus to the system which the behavior is demonstrated in simulation and in hardware. The hardware and software requirements are: Xilinx ML507 ev A board Xilinx Platform USB Cable or Parallel IV Cable S232 Cable Xilinx Platform Studio 10.1.02 Xilinx Integrated Software Environment (ISE ) 10.1.02 Simulation environment is verified with: ed Hat Enterprise Linux 3.0 or Windows XP ModelTech SE 6.3c with VHDL and Verilog co-simulation capability Xilinx Platform Studio 10.1.02 Xilinx Integrated Software Environment (ISE) 10.1.02 This system uses the PowerPC 440 processor block with a processor frequency of 400 MHz and the Memory Interface Block (MIB) frequency of 266 MHz. The processor block crossbar is set to 266 MHz. In addition, the frequency for the MPLB and SPLB0 is set to 133 MHz. For more information about valid clocking ratios and the PLL clocks controlling the processor block, see Virtex -5 Embedded Block for PowerPC 440 Processor Designs. 2008 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks are the property of their respective owners. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 1

eference System Specifics The reference system includes a basic system with PPC440MC DD2, XPS BAM, XPS UAT16550, XPS GPIO, and XPS INTC. The PPC440MC DD2 is connected to the MIB on the processor block with a frequency of 266 MHz. The description of the XPS MASTE EXAMPLE core and its addition to the system is outlined later in this application note. The slave connection of the XPS MASTE EXAMPLE core is connected to the MPLB. In addition, the XPS BAM, XPS INTC, and XPS UAT16550 cores are connected as slaves to the MPLB. The master connection on the XPS MASTE EXAMPLE core is connected to the SPLB0 port on the processor block. The PowerPC 440 processor is set up for MPLB transactions to occur between the address ranges of 0x40000000 and 0xFFFFFFFF. All slave peripheral addresses in this system are in this range. Adding ChipScope cores to the system for debugging is discussed in this application note. Separate PLB v4.6 IBA cores are added to monitor PLB v4.6 bus signals on SPLB0 and MPLB. In addition, an ILA core is added to monitor signals on the Memory Controller Interface (MCI). Block Diagram X-ef Target - Figure 1 PPC440 MC ILA SPLB IBA SPLB_IBA_TIG_OUT PPC440MC PPC440_MC PPC440MC DD2 XPS Master Example SPLB0 plb_v46_1 SPLB1 MPLB IBA MPLB plb_v46_0 XPS BAM XPS INTC XPS GPIO XPS UAT 16550 X1060_01_062608 Figure 1: eference System Block Diagram Address Map Table 1: eference System Address Map Instance Peripheral Base Address High Address ppc440mc_ddr2_0 ppc440_mc_ddr2 0x00000000 0x0FFFFFFF xps_uart16550_0 xps_uart16550 0x40400000 0x4040FFFF ddr2_init xps_gpio 0x40040000 0x40004FFF xps_intc_0 xps_intc 0x41200000 0x4120FFFF xps_master_example_0 xps_master_example 0xA0000000 0xA000FFFF eference System Specifics This section describes setting addresses for the crossbar, describing and connecting the XPS MASTE EXAMPLE core, adding the XPS GPIO for the PPC440MC DD2 ready to accept signal, and adding ChipScope cores to the system. These steps are already completed inside the reference system. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 2

eference System Specifics Setting Addresses for the Crossbar Setting the PowerPC 440 processor address ranges correctly for masters connected to SPLB0/SPLB1 is important in the system. In the Bus Interfaces tab, right click on ppc440_0 and select Configure IP.... The user is responsible in setting the correct address ranges for SPLB0 and SPLB1. The user has the option of allowing SPLB0/SPLB1 to execute master transactions to either the MPLB or MIB or both interfaces. In this reference system, only SPLB0 is configured for masters to execute on both the MPLB and MIB, but the same configuration could apply to SPLB1. The master in this example should be able to execute transactions to both slave peripherals on the MPLB and the PPC440MC DD2. Select the Allow SPLB0 to Access MPLB Addr check box. If the check box is not selected, the master cannot execute transactions to slave peripherals on the MPLB. The user configures the address ranges for the MC and MPLB. In this example the memory controller is between 0x00000000 and 0x0FFFFFFF. For SPLB0, the MemCon ange Base Addr and High Addr is set to 0x00000000 and 0x0FFFFFFF respectively. The address range of the slave peripherals in this reference system are between 0x40000000 and 0xFFFFFFFF. To accommodate this address range, the Number of MPLB Addr anges is set to 2, and MPLB ange 0 Base Addr and High Addr are set to 0x40000000 and 0x7FFFFFFF and MPLB ange 1 Base Addr and High Addr are set to 0x80000000 and 0xFFFFFFFF,respectively. These settings are shown in Figure 2. X-ef Target - Figure 2 Figure 2: PPC440 Processor Address Tab X1060_02_062608 XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 3

eference System Specifics PLB v4.6 Master and Slave Core The XPS MASTE EXAMPLE core provided in this application note is similar to a master and slave core created by Create IP Wizard. However, the slave registers have different locations and this core is only built and verified with a 32-bit master and slave native dwidth. Both this core and the Create IP Wizard core use a FIFO that stores the read data after a read and pops data off the FIFO during a write for the write data. This core allows for single and burst writes and reads. The XPS MASTE EXAMPLE slave interface of the core is connected to the MPLB and the master interface is connected to SPLB0 PLB v4.6 instances. The slave registers are shown in Table 2. Table 2: XPS MASTE EXAMPLE egisters egister Name (offset from C_BASEADD) Access Size in Bits Description Control egister 0x0 ead/write 8 Bit0 - ead Bit1 - Write Bit2 - Single Bit3 - Burst Status egister 0x1 ead 8 Bit0 - Done Bit1 - Busy IP2Bus Address egister 0x8 ead/write 32 IP2Bus Address. Burst Length egister 0xC ead/write 16 Burst length in bytes for burst only. Byte Enable egister 0xE ead/write 8 IP2Bus Byte Enables for singles only. Go egister 0xF Write 8 Writing 0x0A starts transfer. The XPS MASTE EXAMPLE core s master interface is connected to plb_v46_1 and the slave interface is connected to plb_v46_0 as shown in Figure 3. The address for the slave registers are set between 0xA0000000 and 0xA000FFFF which are set in the All tab when right clicking on the xps_master_example instance and selecting Configure IP.... X-ef Target - Figure 3 X1060_03_062608 Figure 3: XPS MASTE EXAMPLE Bus Interfaces XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 4

eference System Specifics Adding the XPS GPIO Core The XPS GPIO core is beneficial for simulation purposes. For example, a software application is run from BAM and the software application executes transactions to main memory. Problems can occur if the main memory is not ready to accept transactions. The XPS GPIO and a function that polls the GPIO registers before executing transactions to memory in the software application prevents this scenario. An example is given in the hello_memory software application in case the code is run out of BAM and master transactions are occurring to DD2. More information is provided in the Software Application section. In the IP Catalog tab, expand the General Purpose IO tab. ight click on XPS General Purpose IO and select Add IP. In the System Assembly view, right click on xps_gpio_0 and select Configure IP.... In the User/Common tab, set GPIO Data Channel Width to 1. In the User/Channel 1 tab, select Channel 1 is Input Only to TUE and Channel 1 is Bidirectional to FALSE. In the System/Addresses tab, set the Base Address to 0x40040000 and High Address to 0x4004FFFF and click OK. In the System Assembly View/Port tab, expand the ppc440_0, ppc440_mc_ddr2_0, and the xps_gpio_0 tree nodes. In the ppc440_mc_ddr2_0 tree node, for the mc_miaddrreadytoaccept port, select ppc440_mc_ddr2_0_mc_miaddrreadytoaccept. In the xps_gpio_0 tree node, for the GPIO_in port, select ppc440_mc_ddr2_0_mc_miaddrreadytoaccept. In the ppc440_0 tree node, for the MCMIADDEADYTOACCEPT port, select ppc440_mc_ddr2_0_mc_miaddrreadytoaccept. Adding ChipScope Cores to System The first PLB v4.6 IBA is connected to plb_v46_0 where all the slaves in the system are connected. The IBA is set up for a 1-bit trigger in port and is used to monitor bus signals including the read and write data buses. The second PLB v4.6 IBA is connected to plb_v46_1 where master interfaces are connected. The IBA is set up for a trigger out port and is set up to monitor bus signals including the read and write data buses. The trigger out port on the SPLB IBA allows the MPLB IBA and the MCI ILA to trigger on the trigger in port. This allows the user to see the correlation between a master and slave transaction (to MPLB or to the MIB). More details will be described later in this application note. The ChipScope ILA is used for the top level ports in the MHS. In this application note, the MCI signals are monitored by ILA0. More details will be described later inside this application note. Adding ChipScope PLB v4.6 IBAs and ChipScope ILAs To The System To start adding ChipScope cores to the system, click on Debug Debug Configuration.... The Debug Configuration window allows the user to easily add PLB v4.6 IBA and ILAs cores to the system by clicking on Add ChipScope Peripheral.... XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 5

eference System Specifics The Debug Configuration window is shown in Figure 4. X-ef Target - Figure 4 X1060_04_062608 Figure 4: Debug Configuration Window For the first PLB v4.6 IBA for MPLB, click on Add ChipScope Peripheral.... In the Add New ChipScope Peripheral window, select To monitor PLB v4.6 bus signals (adding PLB IBA), then click OK, as shown in Figure 5. X-ef Target - Figure 5 Figure 5: Add New ChipScope Peripheral Window X1060_05_062608 XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 6

eference System Specifics In the Monitor Bus Signals section, in the Please select the bus that you want to monitor section, select plb_v46_0. In the Please select the signals on the bus that you want to monitor section, select Bus Control Signals, Bus Address Signals, Bus ead Data Signals, and Bus Write Data Signals as shown in Figure 6. X-ef Target - Figure 6 X1060_06_062608 Figure 6: Chipscope_IBA_0 Basic Tab XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 7

eference System Specifics Select the Advanced Tab. In the User/Trigger In PLB eset and PLB Error Status section, select the Enable input trigger port, set the Trigger input port width to 1 as shown in Figure 7, then click OK. X-ef Target - Figure 7 X1060_07_062608 Figure 7: Chipscope_IBA_0 Advanced Tab XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 8

eference System Specifics For the second ChipScope PLB v4.6 IBA instance for SPLB0, click on Debug Debug Configuration.... In the EDK project and select Add ChipScope Peripheral.... In the Add New ChipScope Peripheral window, select To monitor PLB v4.6 bus signals (adding PLB IBA), then click OK, as shown in Figure 8. X-ef Target - Figure 8 Figure 8: Add New ChipScope Peripheral Window X1060_08_062608 In the Monitor Bus Signals section, in the Please select the bus that you want to monitor section, select plb_v46_1. In the Please select the signals on the bus that you want to monitor section, select Bus Control Signals, Bus Address Signals, Bus ead Data Signals, and Bus Write Data Signals as shown in Figure 9. X-ef Target - Figure 9 Figure 9: Chipscope_IBA_1 Basic Tab X1060_09_062608 XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 9

eference System Specifics Select the Advanced Tab. In the User/Trigger Out and IBA Storage tab, select Enable driving port iba_trig_out as shown in Figure 10, then click OK. X-ef Target - Figure 10 X1060_10_062608 Figure 10: Chipscope_IBA_1 Advanced Tab XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 10

eference System Specifics For the MCI ILA instance, click on Debug Debug Configuration... in the EDK project and select Add ChipScope Peripheral.... In the Add New ChipScope Peripheral window, select To monitor arbitrary system level signals (adding ILA) and click on OK, as shown in Figure 11. X-ef Target - Figure 11 X1060_11_062608 Figure 11: Add New ChipScope Peripheral Window In the Basic Tab, Select the clock to be used on monitoring: to mc_clk. The ports for the triggers which are based upon the memory controller are added manually in the Ports tab in the EDK project which is discussed shortly. Select the Advanced tab. In the Misc tab, deselect Enable The Trigger Out Signal trig_out. In the User/Trigger Unit tab, set the following values as shown in Table 3. The following set up allows for the widths of the MCI signals and the output from the trigger out on the second PLB v4.6 IBA. Table 3: Advanced User/Trigger Unit Settings N Number of Match Unit Enabled for Trigger Unit N Width of Trigger Input for Trigger Unit N 0 1 1 1 1 1 2 1 36 3 1 1 4 1 1 5 1 16 6 1 1 7 1 1 8 1 1 9 1 1 XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 11

eference System Specifics Click OK. If a Unconnected Core box appears, click No since the ports will be defined in the ports section in the EDK project. In the System Assembly View/Ports tab, expand the tree nodes for chipscope_plbv46_iba_0, chipscope_plbv46_iba_1, and chipscope_ila_0. For chipscope_plbv46_iba_1, iba_trig_out port is connected to New Connection. For chipscope_plbv46_iba_0, iba_trig_in port is connected to chipscope_plbv46_iba_1_iba_trig_out. For chipscope_ila_0, make the connections shown in Table 4. Note: The mc_ prefix is replaced with the name of the bus interface connection between the memory controller and the PPC440. In this case the bus interface is called mc. Table 4: chipscope_ila_0 Port Connections POT TIG0 TIG1 TIG2 TIG3 TIG4 TIG5 TIG6 TIG7 TIG8 TIG9 The connections shown in Table 4 are shown in Figure 12. Connection ppc440_mc_ddr2_0_mc_miaddrreadytoaccept mc_mcmieaddatavalid mc_mimcaddess mc_mimcaddessvalid mc_mimcbankconflict mc_mimcbyteenable mc_mimceadnotwite mc_mimcowconflict mc_mimcwitedatavalid chipscope_plbv46_iba_1_iba_trig_out X-ef Target - Figure 12 Figure 12: System Assembly View/Ports Tab X1060_12_062608 Starting the ChipScope tool will be discussed later. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 12

Software Application A generic CDC file for the ChipScope Analyzer project to import is generated in the implementation/chipscope_plbv46_ila_0_wrapper/ directory after the system is implemented for the ChipScope ILA. Since the CDC file is generic, the modified CDC file for the MCI signals is stored in the CDC/ directory. The CDC files for the ChipScope Analyzer project to import are generated in the implementation/chipscope_plbv46_iba_0_wrapper/ and implementation/chipscope_plbv46_iba_0_wrapper/ after the system is implemented. In this application note, the CDC files are stored in the CDC/ directory General Debugging Dumping the executable from the software application is beneficial to monitor the system s behavior. This can be accomplished through simulation or GDB. The powerpc-eabi-objdump command should be used to see the human-readable execution code of the program. For example: powerpc-eabi-objdump -SD name_of_executable.elf > debug.dis. Note: This technique is shown in the simulation example. Internal egisters PPC440 processor internal registers can only be accessed in simulation. Viewing internal registers can help in debugging the system dealing with the core pipeline stages. For example, the PDCD0 and PDCD1 registers are part of the predecode stage. These registers are helpful in determining if the processor is fetching the correct data from the memory. An example of using these registers is given in this application note. PowerPC 440 Processor Core egisters The user has the ability to view the PowerPC 440 processor core registers in simulation or in hardware. egisters that can be seen in both environments are User Mode, Timer Control egisters, Supervisor Mode, SP General egisters, MMU Control egisters, Exception Handling egisters, Cache Control, and Debug egisters. Software Application Hello_Memory: Software application that demonstrates the ability of the master to do single and burst writes and reads by setting up the slave registers for the master transaction. This software application allows master transactions to occur to either the PPC440MC DD2 or XPS BAM core depending on a #define in the code. By default, master transactions occur to the PPC440MC DD2 core. This software application is beneficial to see transactions across the crossbar and system. In addition, the linker script is setup to run code out of the DD2 core. Included in this software application is a function called wait_for_done() which is called before the master starts any transaction. This function polls the GPIO tor the PPC440MC DD2 to finish calibration based upon the mi_miaddrreadytoaccept signal from the memory controller. This is useful for prevent master transactions from occurring before the memory controller is ready to accept transactions. To verify this feature, set the linker script to run code out of BAM and the software application to run master operations to DD2 which is discussed in the simulation section. The software application is set up to do a single read and write and a burst read and write by writing to slave registers. For the single read operation, the processor writes a word to the memory location where the master reads. For the burst read operation, the processor writes four words to the memory location where the master starts the burst reads. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 13

Executing the eference System Executing the eference System Executing the eference System using the Pre-Built Bitstream and the Compiled Software Applications To execute the system using files in the ready_for_download/ in the project root directory, follow these steps: 1. Change directories to the ready_for_download directory. 2. Use impact to download the bitstream by using the following command: impact -batch xapp1060.cmd 3. Invoke XMD and connect to the processor by using the following command: xmd -opt xapp1060.opt 4. Download the executables by using the following command: dow hello_memory.elf Note: The above method does not allow for debugging through SDK and ChipScope. This should be used to verify basic system operation. Executing the eference System from EDK To execute the system using EDK, follow these steps: 1. Open system.xmp in EDK. 2. Use Hardware Generate Bitstream to generate a bitstream for the system. 3. Download the bitstream to the board with Device Configuration Download Bitstream. 4. Launch XMD with Debug Launch XMD.... 5. Download the executables by using the following command: dow hello_memory.elf Note: The above method does not allow for debugging through SDK and ChipScope. This should be used to verify basic system operation. unning Software Applications In Hardware Executing Software Applications From SDK 1. Open system.xmp in EDK. 2. Click on Software Launch Platform Studio SDK. 3. Once SDK starts, in the Application Wizard select Cancel. During this time the software projects and libraries recompile. 4. Select Project Build Automatically. Before proceeding to the next step, ensure that all software applications are built. During this time the software projects and libraries are recompiled. 5. In the SDK project, click on Device Configuration Program FPGA. This will program the board with the PPC440 Bootloop. Executing Hello Memory 1. Expand the hello_memory tree node and expand the Binaries tree node and double click on hello_memory.c. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 14

Executing the eference System 2. In the hello_memory.c window, set a breakpoint before the single read operation which is on line 102. Left click on the line two times on the certain line number as shown in Figure 13. Follow the same process for the single write operation line 120, burst read operation line 141, and burst write operation line 157. X-ef Target - Figure 13 X1060_13_062608 Figure 13: Setting Hello Memory SDK Breakpoints 3. In the Binaries Tree node, right click on hello_memory.elf and select Debug As 1 Debug on Hardware. Starting ChipScope Analyzer Before starting Analyzer, make sure the previous steps in Executing Software Applications From SDK section have been followed. 1. Open ChipScope Analyzer in ChipScope Pro Analyzer. 2. Click on the Open Cable/Search JTAG Chain icon. Then click OK in the ChipScope Pro Analyzer window. 3. Select File Open Project... and select No to Do you want to save the changes you made to project new project?. Then select the ppc440_debug.cpj file in the cpj/ directory. The ChipScope project imported cdc files from the cdc/ directory. efer to the ChipScope documentation in importing CDC files. 4. Table 5 shows the relation of the ChipScope icons to the buses in the system. Table 5: ChipScope Icons Unit Unit:0 MyILA0 Unit:1 MyILA1 Unit:2 MyILA2 BUS MPLB SPLB0 MCI XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 15

Executing the eference System 5. In the Project tab, select Trigger Setup for Unit:1 MyILA1 and Unit:2 MyILA2 and select Trigger Setup un in both cases. 6. In the ChipScope project, Unit:1 MyILA1 is setup to trigger on the PLB Address (M2:TIG2) of 0000F000. Unit:0 MyILA0 and Unit:2 MyILA2 trigger when Unit:1 MyILA1 trigger condition is met. Single and burst reads occur at the address of 0x0000F000 and single and burst writes occurs at address 0x0000F100, The trigger address is changed in future steps to demonstrate writes. X-ef Target - Figure 14 X1060_14_062608 Figure 14: ChipScope ILA1 Trigger XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 16

Executing the eference System 7. Select the esume button in the SDK project as shown in Figure 15. The waveform in Figure 16 shows a single read. The Unit:2 MyILA2 waveform shows memory transactions and the single read during the master transaction. X-ef Target - Figure 15 X1060_15_062608 Figure 15: SDK Project Debug X-ef Target - Figure 16 X1060_16_062608 Figure 16: ChipScope ILA1 Single ead Waveform 8. In the ChipScope project, change the M2:TIG2 to 0000_F100 for UNIT:1 MyILA1. In the Project tab, select Trigger Setup for Unit:1 MyILA1 and Unit:2 MyILA2 and select Trigger Setup un in both cases. 9. In the Debug SDK window, select the esume button. The breakpoint is setup before the single write. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 17

Executing the eference System 10. In the ChipScope project, the ChipScope core has triggered based upon the resume button (actions by the software). The waveform shows a single write as shown in Figure 17. The Unit:2 MyILA2 waveform shows memory transactions and the single write during the master transaction. X-ef Target - Figure 17 X1060_17_062608 Figure 17: ChipScope ILA1 Single Write Waveform 11. In the ChipScope project, change the M2:TIG2 to 0000_F000 for UNIT:1 MyILA1. In the Project tab, select Trigger Setup for Unit:1 MyILA1 and Unit:2 MyILA2 and select Trigger Setup un in both cases. 12. In the Debug SDK window, select the esume button. The breakpoint is setup before the burst read. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 18

Executing the eference System 13. In the ChipScope project, the ChipScope core has triggered based upon the resume button. The waveform shows a burst read as shown in Figure 18. The Unit:2 MyILA2 waveform shows memory transactions and the burst read during the master transaction. X-ef Target - Figure 18 X1060_18_062608 Figure 18: ChipScope ILA1 Burst ead Waveform 14. In the ChipScope project, change the M2:TIG2 to 0000_F100 for UNIT:1 MyILA1. In the Project tab, select Trigger Setup for Unit:1 MyILA1 and Unit:2 MyILA2 and select Trigger Setup un in both cases. 15. In the Debug SDK window, select the esume button. The breakpoint is setup before the burst write. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 19

Executing the eference System 16. In the ChipScope project, the ChipScope core has triggered based upon the resume button. The waveform shows a burst write as shown in Figure 19. The Unit:2 MyILA2 waveform shows memory transactions and the burst write during the master transaction. X-ef Target - Figure 19 X1060_19_062608 Figure 19: ChipScope ILA1 Burst Write Waveform 17. Click on the Stop button to Terminate the debug session in the SDK project. Master Operations to XPS BAM 1. The above steps can be modified to monitor master operations to XPS BAM. In the software application remove the #define main_memory line and rebuild and debug the software application in SDK. Note: The software application will still be run from external memory. 2. In the Project tab, select Trigger Setup for Unit:0 MyILA0 and Unit:1 MyILA1 and select Trigger Setup un in both cases. 3. In the ChipScope project, for Unit:1 MyILA,1 set the trigger for PLB Address (M2:TIG2) to FFFFF000. Single and burst reads occur at the address of 0xFFFFF000 and single and burst writes occurs at address 0xFFFFF100. 4. Follow the same set of procedures as the previous section. Viewing DC egisters for the PPC440 Processor Block For the setup of the MIB, the MI_CONTOL register is set to 0xF810008F. In addition, the MI_OWCONFLICT_MASK and MI_BANKCONFLICT_MASK is set to 0x003FFE00 and 0x00C00000, respectively. efer to DD2 Memory Controller for PowerPC 440 Processor Product Specification in setting these parameters based upon the system. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 20

Executing the eference System These registers are DC registers in the PPC440 processor block. In this system, the PPC440 wrapper is set up for these registers and are shown in Figure 20. The next steps verify the values of these registers in the system. X-ef Target - Figure 20 X1060_20_062608 Figure 20: Setting MemCon Parameters 1. In SDK, select Xilinx Tools Launch EDK Shell.... 2. In the EDK Shell invoke XMD by entering in xmd. 3. In XMD, enter in connect ppc hw. Note: By default DC addresses are mapped to look like PLB addresses when connecting to the processor as shown in the following figure. In this case 0x78020000 is the base address and 0x78020fff is the high address. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 21

Executing the eference System X-ef Target - Figure 21 X1060_21_062608 Figure 21: XMD Window 4. Because the DC registers are emulated PLB address ranges, the offset will be a multiple of 4. Table 6 shows the relation with the MIB DC registers in this example. Table 6: DC to PLB Address Mapping egister DC Address Address MI_Control 0x10 0x78020040 MI_OWCONFLICT_MASK 0x11 0x78020044 MI_BANKCONFLICT_MASK 0x12 0x78020048 5. In XMD, enter in mrd 0x78020040 3 w. The following results should be seen which verify that the register values entered in the PPC440 wrapper in EDK. X-ef Target - Figure 22 X1060_22_062608 Figure 22: XMD DC eads XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 22

Executing the Simulation Executing the Simulation Setting the Simulation Environment Compiling Libraries 1. Compile Unisim, Simprim, XilinxCoreLib, SecureIP, Smartmodel libraries and EDK libraries. Open XPS and select Cancel on the Create new or open existing project dialog box. Select Simulation Compile Simulation Libraries.... Note: The hard blocks for this application note use SecureIP libraries and not Smartmodels libraries. 2. Follow the instructions to compile with the ModelSim simulator and select Both VHDL and Verilog. Both VHDL and Verilog simulation support are required for this reference system. 3. Set the options to compile the ISE libraries as shown in Figure 23. X-ef Target - Figure 23 X1060_23_062608 Figure 23: Compiling ISE Libraries XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 23

Executing the Simulation 4. Set the options to compile the EDK libraries as shown in Figure 24. X-ef Target - Figure 24 X1060_24_062608 Figure 24: Compiling EDK Libraries 5. On the following dialog box, select Do not compile deprecated library elements and then select Compile > to start the compilation process. Note: This process might take a few hours depending on the machine being used. 6. Close XPS. Setting Environmental Variables and ModelSim in Windows 1. Go to Start Control Panel System Advanced and click on Environment Variables. 2. Set the following variables if necessary: a. MODELSIM <path to modelsim.ini>\modelsim.ini 3. Ensure that all of the EDK libraries and ISE libraries are mapped in the modelsim.ini file. a. If the libraries are not mapped correctly, copy the library mappings from the modelsim.ini file found in the compile EDK_Lib directory to the current modelsim.ini file above the [Vcom] section. An example modelsim.ini file is provided in the windows_setup directory. Setting Environmental Variables and ModelSim in Linux 1. Set the following variables: a. setenv MODELSIM <path to modelsim.ini script>/modelsim.ini XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 24

Executing the Simulation 2. Ensure that the EDK libraries and ISE libraries are mapped in the modelsim.ini file. a. If the libraries are not mapped correctly, copy the library mappings from the modelsim.ini file compile EDK_Lib directory of the to the current modelsim.ini file above the [Vcom] section. An example modelsim.ini file is provided in the linux_setup directory. Simulation Directories and Files Two simulation directories are used for Linux and Windows. The directories are sim_lin/ and sim_win/. Windows Simulation Files The sim_win/ directory contains the following pertinent files and directories: 256Mb_ddr2/: Directory that contains Micron DD2 memory model. mem/: Directory that contains the perl scripts to create the data files for the DD2 memory model system_tb_v.do: ModelSim compile script for Verilog simulation. system_tb.v: Verilog testbench for system. uart_rcvr.v: For simulated S232 terminal. uart_rcvr_wrapper.v: For simulated S232 terminal. Note: The simulated S232 terminal will not be displayed in Windows. Output from the software application is monitored in the ModelSim terminal while the simulation is running. Linux Simulation Files The sim_lin/ directory contains the following pertinent files and directories: 256Mb_ddr2/: Directory that contains Micron DD2 memory model. mem/: Directory that contains the perl scripts to create the data files for the DD2 memory model system_tb_v.do: ModelSim compile script for Verilog simulation. system_tb.v: Verilog testbench for system. uart_rcvr.v: For simulated S232 terminal. uart_rcvr_wrapper.v: For simulated S232 terminal. Executing the Simulation Executing the Simulation from EDK To generate and run the system simulation from EDK, follow these steps: 1. Open system.xmp in EDK. Note: For faster calibration of the memory controller, change the PAAMETE C_SIM_ONLY = 0 under the PPC440MC DD2 instance to PAAMETE C_SIM_ONLY = 1. For the following sections, the system is set to PAAMETE C_SIM_ONLY = 1. 2. Click on Software Launch Platform Studio SDK. 3. Once SDK starts, in the Application Wizard select Cancel. 4. Select Project Build Automatically. Before proceeding to the next step, ensure that all software applications are built. During this time the software projects and libraries are recompiled. 5. In the Applications/Software Projects tab, Make Project Active and Mark to Initialize BAMs for the hello_memory software applications. This step is required for all applications regardless if they are run from either XPS BAM or PPC440MC DD2 so that XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 25

Executing the Simulation the ELF is converted to files that can be used for loading the external memory model. All other software applications projects are inactive. Note: Only have ONE active software application in EDK. 6. Use Simulation Generate Simulation HDL Files. Note: Creating the simulation files will take a long time since ChipScope cores are in the system. 7. Launch ModelSim with Simulation Launch HDL Simulator... 8. In ModelSim, execute the compile script for Verilog by using one of the following command depending on the operating system: do../../sim_win/system_tb_v.do or do../../sim_lin/system_tb_v.do unning Hello Memory 1. In ModelSim, execute the run command with the specified run time for the hello_memory software application. run 70 us 2. Launch an EDK shell. Change directories to the <project>/sdk_projects/hello_memory/debug directory. Execute the following command: powerpc-eabi-objdump -SD hello_memory.elf > debug.dis. Open the debug.dis with a text editor. This will be analyzed in the next section. Analysis of Simulation 1. In the Modelsim wave window, scroll down to the GP0 signal under the PowerPC Processor Standard egisters divider. 2. At 56.165 us, notice how the registers are the same as in Figure 25. This time demonstrates the system before the hardware breakpoint. X-ef Target - Figure 25 X1060_25_062608 Figure 25: PowerPC Processor GP egisters XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 26

Executing the Simulation 3. During the same time, scroll down to the PowerPC Processor Internal egisters. For the PDCD0ADD and PDCD1ADD which are at 0x00000280 and 0x00000284. Notice how the values for PDCD0DATA and PDCD1DATA are 0x3F60A000 and 0x93810010 which are fetched from memory. In the debug.dis file, scroll down to the 0x00000280 and 0x00000284 addresses. The following is displayed to verify the right data was fetched from the addresses in main memory. 280:3f 60 a0 00 lis r27,-24576 284:93 81 00 10 stw r28,16(r1) X-ef Target - Figure 26 X1060_26_062608 Figure 26: PowerPC Processor Internal egisters 4. Scroll down to the plb_v46_1 divider. The following waveforms are similar to ChipScope analyzer traces in the ChipScope section. 5. At 56.165 us, a single read occurs to the main memory as shown in Figure 27. X-ef Target - Figure 27 X1060_27_062608 Figure 27: Single ead to PPC440MC DD2 6. At 58.658us, a single write occurs to the main memory as shown in Figure 28. X-ef Target - Figure 28 X1060_28_062608 Figure 28: Single Write to PPC440MC DD2 XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 27

Executing the Simulation 7. At 62.060 us, a burst read occurs to the main memory as shown in Figure 29. X-ef Target - Figure 29 X1060_29_062608 Figure 29: Burst ead to PPC440MC DD2 8. At 64.175 us, a burst write occurs to the main memory as shown in Figure 30. X-ef Target - Figure 30 X1060_30_062608 Figure 30: Burst Write to PPC440MC DD2 Executing Master Operations to DD2 While unning Code Out of BAM 1. In the hello_memory.c file, ensure the following #define is uncommented: #define main_memory 2. In SDK, right click on hello_memory and select Generate Linker Script.... Set all code segments to xps_bram_1 and select Generate. 3. Follow the steps in the Executing the Simulation from EDK section to set up the simulation files and the simulation. 4. un the simulation for 65 us. 5. In the waveform, scroll down to the ddr2_init divider. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 28

eferences 6. Notice at time ~12.170 us that reads are occurring to the XPS GPIO. The software application is polling the GPIO registers to see if the memory controller is ready to accept transactions. Scroll up to the plb_v46_1 divider. Once the memory controller is ready to accept transactions which is at 60.615 us, master transactions are executed as in Figure 31. X-ef Target - Figure 31 X1060_31_062608 Figure 31: plb_v46_1 Master Transactions eferences 1. UG200 Embedded Processor Block in Virtex-5 FPGAs eference Guide 2. DS567 DD2 Memory Controller for PowerPC 440 Processors Product Specification 3. DS621 PPC440 Virtex-5 (Wrapper) Product Specification evision History The following table shows the revision history for this document. Date Version evision 9/11/08 1.0 Initial Xilinx release. 9/26/08 1.1 Made minor content changes; updated Figure 1. Notice of Disclaimer Xilinx is disclosing this Application Note to you AS-IS with no warranty of any kind. This Application Note is one possible implementation of this feature, application, or standard, and is subject to change without further notice from Xilinx. You are responsible for obtaining any rights you may require in connection with your use or implementation of this Application Note. XILINX MAKES NO EPESENTATIONS O WAANTIES, WHETHE EXPESS O IMPLIED, STATUTOY O OTHEWISE, INCLUDING, WITHOUT LIMITATION, IMPLIED WAANTIES OF MECHANTABILITY, NONINFINGEMENT, O FITNESS FO A PATICULA PUPOSE. IN NO EVENT WILL XILINX BE LIABLE FO ANY LOSS OF DATA, LOST POFITS, O FO ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, O INDIECT DAMAGES AISING FOM YOU USE OF THIS APPLICATION NOTE. XAPP1060 (v1.1) September 26, 2008 www.xilinx.com 29