Using SOPC Builder - Springerextras.springer.com/2004/978-3-662-06730-7/literature/tt/tt_sopc...iv...
Transcript of Using SOPC Builder - Springerextras.springer.com/2004/978-3-662-06730-7/literature/tt/tt_sopc...iv...
with Excalibur Devices Tutorial
Using SOPC Builder
101 Innovation DriveSan Jose, CA 95134(408) 544-7000www.altera.com
Document Version: 1.1Document Date: June 2003
ii Altera CorporationTU-SOPCTTRL1.1
Copyright Using SOPC Builder with Excalibur Devices Tutorial
Copyright © 2003 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, specific device designations, and all other words and logos that are identified as trademarks and/or service marks are, unless noted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and other countries. All other product or service names are the property of their respective holders. Altera products are protected under numerous U.S. and foreign patents and pending applications, mask work rights, and copyrights. Altera warrants performance of its semiconductor products to current specifications in accordance with Altera’s standard warranty, but reserves the right to make changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Altera Corporation. Altera customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services.
Altera Corporation
About this Document
This tutorial introduces you to the Altera® SOPC Builder. It shows you how to use the Quartus® II software to create and build your own SOPC Builder system that runs on the EPXA1 development board.
Table 1 shows the tutorial revision history.
f Refer to the SOPC Builder readme file (sopc_builder_readme) for late-breaking information that is not available in this tutorial.
How to Find Information
■ The Adobe Acrobat Find feature allows you to search the contents of a PDF file. Click the binoculars toolbar icon to open the Find dialog box.
■ Bookmarks serve as an additional table of contents.■ Thumbnail icons, which provide miniature previews of each page,
provide a link to the pages.■ Numerous links, shown in green text, allow you to jump to related
information.
Table 1. Tutorial Revision History
Date Description
June 2003 Updated for Quartus II version 3.0.
July 2002 First release.
iii
About this Document Using SOPC Builder with Excalibur Devices Tutorial
How to Contact Altera
For the most up-to-date information about Altera products, go to the Altera world-wide web site at www.altera.com.
For technical support on this product, go to www.altera.com/mysupport. For additional information about Altera products, consult the sources shown in Table 2.
Note:(1) You can also contact your local Altera sales office or sales representative.
Table 2. How to Contact Altera
Information Type USA & Canada All Other Locations
Technical support www.altera.com/mysupport/ www.altera.com/mysupport/
(800) 800-EPLD (3753)(7:00 a.m. to 5:00 p.m. Pacific Time)
(408) 544-7000 (1)(7:00 a.m. to 5:00 p.m. Pacific Time)
Product literature www.altera.com www.altera.com
Altera literature services [email protected] (1) [email protected] (1)
Non-technical customer service
(800) 767-3753 (408) 544-7000 (7:30 a.m. to 5:30 p.m. Pacific Time)
FTP site ftp.altera.com ftp.altera.com
iv Altera Corporation
Using SOPC Builder with Excalibur Devices Tutorial About this Document
Typographic Conventions
The Using SOPC Builder with Excalibur Devices Tutorial uses the typographic conventions shown in Table 3.
Table 3. Conventions
Visual Cue Meaning
Bold Type with Initial Capital Letters
Command names, dialog box titles, checkbox options, and dialog box options are shown in bold, initial capital letters. Example: Save As dialog box.
bold type External timing parameters, directory names, project names, disk drive names, filenames, filename extensions, and software utility names are shown in bold type. Examples: fMAX, \qdesigns directory, d: drive, chiptrip.gdf file.
Italic Type with Initial Capital Letters
Document titles are shown in italic type with initial capital letters. Example: AN 75: High-Speed Board Design.
Italic type Internal timing parameters and variables are shown in italic type. Examples: tPIA, n + 1.Variable names are enclosed in angle brackets (< >) and shown in italic type. Example: <file name>, <project name>.pof file.
Initial Capital Letters Keyboard keys and menu names are shown with initial capital letters. Examples: Delete key, the Options menu.
“Subheading Title” References to sections within a document and titles of on-line help topics are shown in quotation marks. Example: “Typographic Conventions.”
Courier type Signal and port names are shown in lowercase Courier type. Examples: data1, tdi, input. Active-low signals are denoted by suffix n, e.g., resetn.
Anything that must be typed exactly as it appears is shown in Courier type. For example: c:\qdesigns\tutorial\chiptrip.gdf. Also, sections of an actual file, such as a Report File, references to parts of files (e.g., the AHDL keyword SUBDESIGN), as well as logic function names (e.g., TRI) are shown in Courier.
1., 2., 3., and a., b., c.,... Numbered steps are used in a list of items when the sequence of the items is important, such as the steps listed in a procedure.
■ Bullets are used in a list of items when the sequence of the items is not important.
v The checkmark indicates a procedure that consists of one step only.
1 The hand points to information that requires special attention.
r The angled arrow indicates you should press the Enter key.
f The feet direct you to more information on a particular topic.
Altera Corporation v
Contents
About this Document ................................................................................................................................. iiiHow to Find Information .............................................................................................................. iiiHow to Contact Altera .................................................................................................................. ivTypographic Conventions ..............................................................................................................v
Overview ..........................................................................................................................................................9Introduction ......................................................................................................................................9Hardware & Software Requirements ..........................................................................................10Directory Structure ........................................................................................................................10More Information ...........................................................................................................................10
Design Entry .................................................................................................................................................11Create a Quartus II Project ............................................................................................................11
Start the Quartus II Software ................................................................................................11Create a Project .......................................................................................................................11
Create an Excalibur System Module ...........................................................................................16Start SOPC builder .................................................................................................................17Add CPU & Peripherals ........................................................................................................18
Excalibur Device ...........................................................................................................19LCD Peripheral ...............................................................................................................25Specify Base Addresses .................................................................................................27Set the Excalibur Device ................................................................................................27
Generate the System ..............................................................................................................28Add the Symbol to the .bdf ..................................................................................................30
Compilation ..................................................................................................................................................33Create Compiler Settings ..............................................................................................................33
View the Compiler General Settings ...................................................................................34Specify the Device Family & Device ...................................................................................35
Assign Signals to Device Pins ......................................................................................................37Reserve Unused Pins .....................................................................................................................39Compile the Design .......................................................................................................................42
Software Build & Programming ............................................................................................................45Software Build ................................................................................................................................45
Altera Corporation vii
Contents Using SOPC Builder with Excalibur Devices Tutorial
Verify GNU Tools ..................................................................................................................45Select Software Build Settings ..............................................................................................45
Using Quartus II Software Builder with the GNU Tools .........................................46Using the excalibur-build Utility .................................................................................46
Simulate the Design .......................................................................................................................47Download Files to the Board ........................................................................................................47Next Steps .......................................................................................................................................48
viii Altera Corporation
Altera Corporation
1
Overview
Overview
Introduction This tutorial introduces you to using SOPC builder with the Excalibur
devices. It shows you how to use SOPC builder and the Quartus® II software to create and process your own Excalibur device system module design that interfaces with components provided on the EPXA1 development board.
This tutorial is for SOPC builder novices or users who are new to using embedded systems in FPGAs. The tutorial guides you through the steps necessary to create, build the software and simulate an Excalibur hardware design system module, called xa_tutorial, and download it onto the EPXA1 development board. This simple, single-master system module has an Excalibur device processor and associated advanced microprocessor bus architecture (AMBA) high-performance bus (AHB) system peripherals and interconnections.
After you create the xa_tutorial design and connect to external pins, you can download it to the Altera® Excalibur device on the EPXA1 development board. The external physical pins on the Excalibur device are in turn connected to other hardware components on the EPXA1 development board, allowing the ARM-based Excalibur Stripe to interface with SDRAM, flash memory, LEDs, switches, and buttons.
This tutorial is divided into the following three sections:
■ “Design Entry” on page 11 teaches you how to create the Excalibur device system module in a block design file (.bdf) using the MegaWizard® Plug-In Manager and SOPC Builder.
■ “Compilation” on page 33 teaches you how to compile SOPC Builder design using compiler settings, pin assignments, and EDA tool settings to control compilation processing.
■ “Software Build & Programming” on page 45 teaches you how to use the Quartus II software to add the software files needed for the xa_tutorial project, set the software build settings and select the links for simulating the project. This section also teaches you how to download the hardware and software image file to the device on the EPXA1 development board.
9
Using SOPC Builder with Excalibur Devices Tutorial Overview
Hardware & Software Requirements
This tutorial requires the following hardware and software:
■ GNU Tools for ARM and Excalibur component available on the GNU Tools and Excalibur Component CD-ROM
■ ModelSim® Altera Edition version 5.7c or higher■ Quartus II software version 3.0 or higher■ A EPXA1 development board, set up as described in the EXPA1
Development Kit Getting Started User Guide
Directory Structure
This tutorial assumes that you create and save your files in a working directory on the c: drive on your computer. If your working directory is on another drive, substitute the appropriate drive name.
The GNU Tools and Excalibur Component CD-ROM installation creates the directories shown in Table 1 in the \altera\kits\xa directory by default:
More Information
SOPC builder includes support for the Excalibur device and peripheral using the AHB protocol. For more Excalibur-related and SOPC builder information see the documents available at www. altera.com/literature/lit-index.html.
Table 1. Directory Structure
Directory Name
Description
bin Contains the GNU tools and Excalibur component scripts.
components Contains the SOPC builder Excalibur device description files.
documents Contains documentation for the the Excalibur devices and SOPC builder.
examples Contains Excalibur example designs.
tutorials Contains the files for this tutorial.
10 Altera Corporation
Altera Corporation
Design Entry
Design Entry2
This design entry section shows you how to create the Excalibur system module project, which includes how you create a top-level block-level diagram (.bdf) that contains the Excalibur system module. You create and instantiate the Excalibur system module using the SOPC builder.
1 The instructions in this section assume that you are familiar with the Quartus II software interface, specifically the toolbars. Refer to the Quartus II Help for information that is not included in the tutorial.
Create a Quartus II Project
To create a Quartus II project, perform the following steps:
■ Start the Quartus II Software■ Create a Project
Start the Quartus II Software
To start the Quartus II software and begin creating your project, choose Start > Programs > Altera > Quartus II <version> (Windows Start menu) to start the Quartus II software.
Create a Project
With the New Project wizard, you specify the working directory for the project, assign the project name, and designate the name of the top-level design entity. To create a new project, perform the following steps:
1. Choose New Project Wizard (File menu).
2. Click Next in the introduction (the introduction does not display if you turned it off previously).
3. Specify the working directory for your project. This tutorial uses the following directory: c:\altera\kits\xa\tutorials\xa_tutorial
4. Specify the name of the project and the top-level design entity, xa_tutorial (see Figure 1). Click Next.
11
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 1. Specify the Project Name & Directory
5. Click Next to accept the default settings (see Figure 2).
12 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
Figure 2. Add Files [page 2 of 6]
6. Click Next to accept the default settings.
7. Choose Excalibur_ARM from the drop-down list and select Yes to assign a specific device (see Figure 3).
Altera Corporation 13
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 3. Device Family [page 4 of 6]
8. Click Next.
9. Choose 484 in the Pin Count drop-down box to show all devices.
10. Choose EPXA1F484C1 from the Available devices list (see Figure 4).
11. Under Filters, specify the following options (see Figure 4):
– Package: Any– Pin count: 484– Speed grade: Any
14 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
Figure 4. Select a Target Device
12. Click Next. A summary of project decisions you made displays (see Figure 5).
Altera Corporation 15
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 5. New Project Wizard Summary
13. Click Finish.
You have finished creating your xa_tutorial Quartus II project.
Create an Excalibur System Module
This section describes how to create the top-level block design file (.bdf) that contains an Excalibur system module. Altera provides a partial .bdf file for you to start with. First, you will use SOPC builder to configure the Excalibur device, configure system peripherals, and connect these elements to make an Excalibur system module. Next, you connect the Excalibur system module ports to the Excalibur device pins that are connected to hardware components on the EPXA1 development board.
1 The xa_tutorial.bdf file is the Altera-provided top-level design entity of the xa_tutorial project.
This section includes the following steps:
1. “Start SOPC builder” on page 17
2. “Add CPU & Peripherals” on page 18
3. “Generate the System” on page 28
4. “Add the Symbol to the .bdf” on page 30.
16 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
Start SOPC builder
SOPC builder is a wizard that guides you through the process of creating a system module or a more general multi-master SOPC module. A complete system module contains a master and its associated system peripherals.
SOPC builder helps you easily specify options for the system module. The wizard prompts you for the values you want to set for parameters and which optional ports and peripherals you want to use. Once the wizard generates the system module, you can instantiate it in the design file.
To start SOPC builder, perform the following steps:
1. In the Quartus II software, choose SOPC Builder (Tools menu).
2. In the Create New System box, enter xa1 as the system name and select Verilog as the language (see Figure 6).
Figure 6. Create New System
3. Click OK. The Altera SOPC Builder appears (see Figure 7).
Altera Corporation 17
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 7. SOPC Builder System Contents Page
4. Select Excalibur in the Target Device family drop-down box.
5. Enter 25 in the System Clock frequency box.
To build your system, you add the components from the left panel (system builder pool) to the system table to create your system module.
Add CPU & Peripherals
The system peripherals allow the Excalibur device to connect and communicate with internal logic in the Excalibur device, or external hardware on the EPXA1 development board. Use SOPC builder to specify the name, type, memory map addresses, and interrupts of the system peripherals for your system module.
1 The following instructions ensure that the xa1 design functions correctly on the EPXA1 development board, and allow you to run the software examples provided in your project’s software development kit (SDK) directory.
18 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
f See EPXA1 Development Board Hardware Reference Manual for more information about the Excalibur device board components.
You will add the following modules with SOPC builder:
■ Excalibur device– ARM processor– UART– Flash interface– PIO
■ LCD driver logic
Excalibur Device
To add the Excalibur device, perform the following steps:
1. Choose Excalibur stripe under AHB Modules.
2. Click Add. The Excalibur wizard displays.
3. Specify the following options (see Figure 8):
– Excalibur family: Excalibur_ARM– Available device: EPXA1– Boot from flash: turn on– Byte order: Little endian– SDRAM: turn off– UART: turn on
Altera Corporation 19
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 8. Select & Configure the Excalibur Device
4. Click Next.
20 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
5. Specify the following options (see Figure 9):
– Do you want to use the STRIPE-TO-PLD bridge?: turn on– Do you want to use the PLD-TO-STRIPE bridge?: turn off – Do you want to use the STRIPE-TO-PLD interrupt sources?:
turn off– Do you want to use the PLD-TO-STRIPE interrupt sources?:
turn off– Do you want to use processor debug extensions?: turn off – Do you want to use the GPIO?: turn on and select 4 bits
6. Click Next.
Figure 9. Excalibur MegaWizard Page 2: Specify Bridge Use and Interrupt
Altera Corporation 21
Design Entry Excalibur Devices Using SOPC Builder Tutorial
7. Specify the following AHB1 and AHB2 clock options (see Figure 10):
– Enter External clock reference frequency: 25.0 MHz– Bypass PLL1: turn off– Enter AHB1 frequency: 200.00000 MHz– Select AHB2 frequency: 100.00000 MHz
8. Click Next.
Figure 10. Excalibur MegaWizard Page 3: Configure PLLs and Clock Frequency
9. Select 016K for the SRAM0 size and 00000000 for the base address (see Figure 11).
22 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
10. Select 16K for the SRAM1 size and 00020000 for the base address (see Figure 11).
Figure 11. Excalibur MegaWizard Page 4: Specify PLD Memory Settings
11. Click Next. The wizard displays all the wizard-created files based on the decisions that you made for the Excalibur device (see Figure 12).
Altera Corporation 23
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 12. Excalibur MegaWizard Directory Files Summary
10. Click Finish. This returns you to the SOPC builder xa1 window. The Excalibur device is added to your system (see Figure 13).
Figure 13. SOPC Builder with Excalibur Device
24 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
LCD Peripheral
To import the provided LCD driver hardware design files, perform the following steps:
1. Choose Interface to User Logic from the SOPC Builder component list and click Add.
2. Click the Ports tab of the Interface to User Logic window (see Figure 14).
Figure 14. Add LCD Peripheral
3. In the Bus Interface Type drop-down box, choose AHB Slave.
4. Check Import Verilog, VDHL, EDIF or Quartus Schematic File.
5. Click Add and browse to \xa_tutorial\lcd_peripheral.
Altera Corporation 25
Design Entry Excalibur Devices Using SOPC Builder Tutorial
6. Select ahb_lcd.v, lcd_addr_inc.v, and xa1_ahb_inc.v and click Open
7. Specify ahb_lcd as the Top module.
8. Click Read port-list from files. SOPC Builder reads the ports from the Verilog HDL files and automatically assigns most of the pins with the appropriate width, direction, and type.
9. Change the type to export for the following ports: Lcd_rs, lcd_rw, lcd_e, lcd_db, lcd_vo. This action displays the signals on the system module so that they can be connected to device pins.
10. Click Next.
11. Select Simulate user logic.
12. Click Add to System.
13. In the SOPC Builder window, right click on user_defined_interface_0 and rename it to lcd.
14. Choose Show Master Connections (View menu) to display the matrix that shows the system master and slaves connected to it.
You are finished adding peripherals for the xa1 system (see Figure 15).
26 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
Figure 15. SOPC Builder System
Specify Base Addresses
SOPC builder assigns default base address values for the components in your system module. However, you can modify these defaults by clicking the base address and typing the a different value.
Set the Excalibur Device
To set the excalibur device, perform the following steps:
1. Click the More “ARM_Stripe” Settings tab.
2. Under software settings, specify the following options (see Figure 16):
a. Set Host Communication function to ARM_Stripe/arm_stripe_uart at address 0x7fffc280.
b. Set Program Memory function to ARM_Stripe/arm_stripe_sram0 at address 0x00000000.
Altera Corporation 27
Design Entry Excalibur Devices Using SOPC Builder Tutorial
c. Set Data Memory function to ARM_Stripe/arm_stripe_sram0 at address 0x00000000.
3. Under Simulation select Use Fast Stripe Simulation Model.
Figure 16. More “ARM_Stripe” Settings Tab
Generate the System
Before generating the design, perform the following steps:
1. Select the System Generation tab.
2. Under Options, specify the following options (Figure 17):
– SDK: Turn on– HDL: Turn on– Simulation: Turn on
28 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
Figure 17. SOPC Builder System Generation Tab
To generate the design, perform the following steps:
1. Click Generate.
The SOPC builder performs a variety of actions during design generation, depending on which options you have specified. For the design created using this tutorial, which has all available SOPC builder options turned on, the SOPC builder performs the following actions:
– Generates the SDK, C, and Assembly language header and source files
– Generates the HDL source files– Creates the simulation project and source files
During generation, information and messages appear in the window area of the System Generation tab. When generation is complete, the SYSTEM GENERATION COMPLETED message displays (see Figure 18).
Altera Corporation 29
Design Entry Excalibur Devices Using SOPC Builder Tutorial
Figure 18. System Generation Completes
2. Click Exit. This returns you to the Quartus II Software Symbol dialog box.
Add the Symbol to the .bdf
During generation, SOPC builder creates a symbol for your SOPC builder system module. You can add the xa1 symbol to your .bdf. In the Quartus II software, the newly-created xa1 project directory displays. To add the symbol, perform the following steps:
To open xa_tutorial.bdf and add the xa1 symbol to it, perform the following steps:
1. Choose Open (File menu).
2. In the Files of Type drop-down box, choose Device Design Files.
3. Choose xa_tutorial.bdf.
4. Click OK.
30 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Design Entry
Design Entry
2
5. Double click in the xa_tutorial.bdf to display the Symbol window.
6. Under projects choose xa1.bsf. A preview of the xa1 symbol appears in the Symbol dialog box.
7. The xa1 symbol graphic is attached to the pointer. Click OK to instantiate the xa1 symbol in the .bdf file.
8. To place the graphic symbol, align the pins on the symbol with the existing pins in the .bdf and click in the window (see Figure 19).
Figure 19. Adding the xa_tutorial_system Symbol
9. Choose Save (File menu).
Altera Corporation 31
Design Entry Excalibur Devices Using SOPC Builder Tutorial
32 Altera Corporation
Altera Corporation
Compilation
Compilation
3
The Quartus II compiler consists of a series of modules that check a design for errors, synthesize the logic, fit the design into an Altera device, and generate output files for simulation, timing analysis, and device programming.
This compilation section guide you through the steps necessary to create compiler settings, assign signals to device pins, and compile the design. The compilation section involves the following steps:
1. Create Compiler Settings
2. Assign Signals to Device Pins
3. Reserve Unused Pins
4. Compile the Design
Create Compiler Settings
You can create compiler settings to control the compilation process. The compiler settings specify the compilation focus, the type of compilation to perform, the device to target, and other options. This section involves the following steps:
1. View the Compiler General Settings
2. Specify the Device Family & Device
1 The procedures explain how to view and edit compiler settings using menu commands and dialog boxes. However, you can also easily specify compiler settings by following the steps in the Compiler Settings Wizard (Processing menu).
33
Compilation Excalibur Devices Using SOPC Builder Tutorial
View the Compiler General Settings
The General tab of the Compiler Settings dialog box (Processing menu) allows you to select an existing group of compiler settings for use during compilation, define and save a new group of compiler settings, specify the compilation focus, or delete existing settings.
To view the default compiler general settings created for the current project, perform the following steps:
1. Choose Settings (Assignments menu).
2. Under Compiler Settings category, choose General.
At this point in the tutorial, the General tab displays only the default compiler general settings. These default settings are given the name of the top-level design entity in the project, xa_tutorial (see Figure 20).
34 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Compilation
Compilation
3
Figure 20. Default Compiler Settings
Specify the Device Family & Device
The EPXA1 development board includes an EPXA1F484C1 device. In this section, you will target this device in the compiler settings.
To select the device family and device, perform the following steps:
1. Under Compiler Settings category choose Device (see Figure 21).
2. In the Family list, choose EXCALIBUR_ARM.
3. If you receive a message that asks if you want the Quartus II software to choose a device automatically, click No.
4. Under Target device, select Specific device selected in 'Available devices' list.
Altera Corporation 35
Compilation Excalibur Devices Using SOPC Builder Tutorial
5. In the Available devices list, choose EPXA1F484C1.
6. In the Show in ‘Available devices’ list, verify the following options:
– Package: Any– Pin count: 484– Speed grade: Any
1 As you change these options from Any, the number of available device listed decreases, making it easier for you to find your target device.
36 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Compilation
Compilation
3
Figure 21. Device Settings
Assign Signals to Device Pins
The EPXA1 stripe peripheral signals, such as the UART, EBI, and clock signals, are automatically assigned to the correct pins by the Quartus II software. Table 2 shows the pin assignments for the signals in the FPGA that you must make.
Table 2. Pin Assignments (Part 1 of 2)
Signal Pin Assignment
pld_clk Pin_u1
reset Pin_u18
lcd_db[0] Pin_AB10
lcd_db[1] Pin_M6
lcd_db[2] Pin_M5
lcd_db[3] Pin_M4
Altera Corporation 37
Compilation Excalibur Devices Using SOPC Builder Tutorial
To make the assignments, perform the following steps:
1. Choose the pld_clk and reset pins in the .bdf (hold down the shift key to select multiple pins).
2. Right click and choose Assignment Editor.
3. In the Assignment Editor window, in the Category drop-down box, choose Locations > Pin.
4. Double click in the Location field next to the pin name and choose the correct pin assignment (see Table 2).
5. Choose the gpo[3..0] pin in the .bdf, right click, and choose Assignment Editor.
6. In the Assignment Editor window, in the Category drop-down box, choose Locations > Pin.
7. Double click in the Location field next to the pin name and choose the correct pin assignment (see Table 2).
8. Choose the remaining pins from Table 2 (hold down the shift key to select multiple pins), right click and choose Assignment Editor.
9. Double click in the Location field next to the pin name and choose the correct pin assignment (see Table 2).
lcd_db[4] Pin_M3
lcd_db[5] Pin_L3
lcd_db[6] Pin_L2
lcd_db[7] Pin_L1
lcd_e Pin_R10
lcd_rs Pin_T10
lcd_rw Pin_T9
lcd_vo Pin_AB9
gpo[0] Pin_Y21
gpo[1] Pin_Y18
gpo[2] Pin_W21
gpo[3] Pin_W17
Table 2. Pin Assignments (Part 2 of 2)
Signal Pin Assignment
38 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Compilation
Compilation
3
1 You may receive benign warning messages like the following message, which you can ignore. Warning: Assignment may contain error - destination name not found
Reserve Unused Pins
Before compiling the design, you must specify options that control the use of unused pins. To specify options for reserving unused pins, perform the following steps:
1 You must perform these steps. otherwise your design will not run on the EXPA1 development board.
1. Choose Settings (Assignments menu).
2. Under Compiler Settings category, choose Device.
3. Click Device & Pin Options (see Figure 22).
Figure 22. Device & Pin Options
Altera Corporation 39
Compilation Excalibur Devices Using SOPC Builder Tutorial
4. Click the Unused Pins tab (see Figure 23).
Figure 23. Unused Pins Tab
5. Under Reserve all unused pins, select As inputs, tri-stated.
6. Click OK.
7. Click Device & Pin Options.
8. Click the Configuration tab (see Figure 24).
40 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Compilation
Compilation
3
Figure 24. Device & Pin Options - Configuration
9. Choose Boot From Flash from the Configuration scheme drop-down list.
10. Click OK.
11. Click Device & Pin Options.
12. Click the General tab (see Figure 25).
Altera Corporation 41
Compilation Excalibur Devices Using SOPC Builder Tutorial
Figure 25. Device & Pin Options - General Tab
13. Turn on Enable INIT_DONE output.
14. Click OK.
15. Click OK, to finalize the unused pin settings and return to the Quartus II software window.
Compile the Design
During compilation the compiler locates and processes all design and project files, generates messages and reports related to the current compilation, and creates the .sof file and any optional programming files.
v To compile the xa1 design, choose Start Compilation (Processing menu).
42 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Compilation
Compilation
3
The compiler compiles the xa_tutorial design entity, and any subordinate design entities, using the xa_tutorial compiler settings. As the design compiles, the Status window automatically displays, as a percentage, the total compilation progress and the time spent in each stage of the compilation. The results of the compilation are updated in the Compilation Report window. The total compilation time may be 10 minutes or more, depending on your system.
The compiler may generate one or more of the following warning messages that do not affect the outcome of your design (see Figure 26).
Figure 26. Quartus Compiler Messages
When compilation completes, you can view the results in the xa_tutorial module Compilation Report window.
If the compiler displays any error messages, you should correct them in your design and recompile it until it is error-free before proceeding with the tutorial.
1 Verify that all the pin assignments are correct. This is a common error causing compilation errors.
You can select the message and choose Locate (right button pop-up menu) to find its source(s), and/or choose Help (right button pop-up menu) to display help on the message. Refer to the Compilation module in the Quartus II on-line tutorial for more information about viewing compilation results
Warning messages
Altera Corporation 43
Altera Corporation
Software Build & Programming
4
Programm
ingProgram
ming
4
You have already completed creating and instantiating the xa_tutorial system. This chapter guides you through the steps in SOPC Builder for building the software code and running the design on the EPXA1 development board.
Software Build This section gives instructions for building the software code using either the excalibur-build utility in the SDK Shell using GNU Tools or using Quartus II Software Builder with GNU tools.
To create the software build, you will add the software files, select software build settings, and establish the linking of the files. In this section you will set up the Quartus II software to compile the program. The various compiler and linker options will be set to produce a .hex file.
Verify GNU Tools
Verify that the GNU Tools are selected as the software toolset. To specify the directory of the software toolset, perform the following steps:
1. Choose Settings (Assignments menu).
2. Expand the Files & Directories category. and choose Toolset Directories.
3. In the Toolset directories list, select GNUPro for ARM.
4. In Toolset directory, type the directory for the GNU Tools <installed directory>/bin or select the software toolset directory using Browse.
5. Click OK.
Select Software Build Settings
You can use either the software builder with GNU tools or the excalibur-build utility to compile the software files.
45
Software Build & Programming Excalibur Devices Using SOPC Builder Tutorial
Using Quartus II Software Builder with the GNU Tools
To use the Quartus II software builder with the GNU tools, perform the following steps:
1. Choose Tcl Scripts (Tools menu).
2. Expand ARM_Stripe_sdk, choose make_quartus_sw_project.tcl, and click Run.
3. Choose Open (File menu).
4. In Files of type choose Software files (*.c, *.cpp, *.h, *.s, *.asm).
5. Turn on Add file to current project.
6. Choose the ARM_Stripe_sdk directory.
7. Choose the src directory.
8. Choose the following software files: main.c xa_lcd_so1602.c xa_lcd_so1602.h
9. Click Open.
10. To create the xa_tutorial_flash.hex, choose Start Software Build (Tools menu).
Using the excalibur-build Utility
To use the excalibur-build utility, perform the following steps:
1. Choose Programs > Altera > GNU Tools and Excal Component > XA SOPC SDK Shell (Windows Start menu).
2. To create the main_flash.hex, type the following commands: cd \<install directory>\arm_stripe_sdk\srcr excalibur-build xa_lcd_so1602.c main.cr
You will use either the xa_tutorial_flash.hex or the main_flash.hex file in “Download Files to the Board” on page 47 to program the flash on the EPXA1 Development Board. Both files contain the same data.
46 Altera Corporation
Excalibur Devices Using SOPC Builder Tutorial Software Build & Programming
Programm
ing
4
Simulate the Design
You can simulate the design using the simulation files that SOPC Builder automatically generates. To run a simulation with the Excalibur stripe simulation model (ESS), perform the following steps:
f For more information on ESS, refer to the Excalibur Stripe Simulation User Guide.
1. In the Quartus II software, choose SOPC Builder (Tools menu).
2. Select the System Generation page.
3. Click Run ModelSim to launch your simulation project in ModelSim. ModelSim opens and gives you a list of options to load, compile, and run your simulation.
4. To compile and load your simulation files, type ‘’s’’
5. To bring up a waveform window, type ‘’w’’
6. To launch the simulation, type run - allr
ESS launches a telnet window to emulate the output of the stripe UART and displays the following text from the printf: ‘’Look for a message on the LCD’’
You can view the signals in the ModelSim waveform window as the simulation shows code being executed.
Download Files to the Board
To program flash memory on the EPXA1 development board with the flash image that you created in “Software Build” on page 45, perform the following steps:
1 Ensure that you have set up the board as described in the EPXA1 Development Board Getting Started Guide.
1. Choose Programs > Altera > GNU Tools and Excal Component > XA SOPC SDK Shell (Windows Start menu).
2. If you used the Quartus II Software Builder to generate the flash image, change to the following directory: <install directory>\tutorials\xa_tutorial or
Altera Corporation 47
Software Build & Programming Excalibur Devices Using SOPC Builder Tutorial
If you used the excalibur-build utility to generate the flash image, change to the following directory: <install directory>\tutorials\xa_tutorial\arm_stripe_sdk\src
3. At the command prompt, type: exc_flash_programmer.exe -g xa_tutorial_flash.hexr
After programming completes, the message Flash programmed successfully appears in the command prompt window (see Figure 27). The EPXA1F484C1 device resets and boots from the data programmed into the flash memory. The LEDs on the development board illuminate a pattern and the following message is output through the UART: Look for a message on the LCD.....
A message then displays on the LCD module (see Figure 27).
Figure 27. Successful Download Message
Next Steps Congratulations! You have finished creating, verifying, and running the xa_tutorial system module using SOPC Builder.
See the Altera literature page for more information about SOPC Builder, the Excalibur device, and the EPXA1 development board at www.altera.com/literature/lit-index.html.
48 Altera Corporation