Lab 2: Adding Ip To A Hardware Design Lab: Targeting Microblaze™ On The Spartan™-3E Kit
Lab 2: Adding Ip To A Hardware Design Lab: Targeting Microblaze™ On The Spartan™-3E Kit
Objectives
After completing this lab, you will be able to:
Add additional IP to a hardware design
Update ucf file to support external ports of the added IP
Setup some of the compiler settings
Procedure
The purpose of this lab exercise is to extend the hardware design (Figure 2-1) created in Lab
1according to the following procedure
1. Open the project
2. Add and connect GPIO peripherals in the system
3. Configure the GPIO peripherals
4. Make external GPIO connections
5. Analyze the MHS file
6. Add the software application and compile
7. Verify the design in hardware
www.xilinx.com/univ
[email protected]
2-3
www.xilinx.com/univ
[email protected]
2-4
Step 1
Create a lab2 folder and copy the contents of the lab1 folder into the lab2. Launch
Xilinx Platform Studio (XPS) and open the project file.
Create a lab2 folder in the c:\xup\embedded\labs directory and copy the contents from lab1 to
lab2
Open XPS by selecting Start Programs Xilinx ISE Design Suite 10.1 Platform
Studio Xilinx Platform Studio
Select Open a recent project, Click OK and browse to C:\xup\embedded\labs\lab2
Click system.xmp to open the project
Step 2
Add two instances of an XPS GPIO Peripheral from the IP catalog to the
processor system via the System Assembly View.
XPS provides two methods for adding peripherals to an existing project. You will
use the first method, the System Assembly View panel, to add most of the
additional IP and connect them. The second method is to manually edit MHS file.
Select the IP Catalog tab in the left window and click on plus sign next to General Purpose
IO entry to view the available cores under it (Figure 2-2)
www.xilinx.com/univ
[email protected]
2-5
Double-click on the XPS General Purpose IO core twice, to add two instances to the System
Assembly View
Change the instance names of the peripherals to dip and push, by clicking once in the name
column, typing the new name for the peripheral followed by pressing Enter key
At this point, the System Assembly View should look like the following (Figure 2-3):
Click once in Bus Connection column for the push and dip instances to connect them as
slave devices to the PLB.
At this point, the Bus Connections tab should look like the following (Figure 2-4):
www.xilinx.com/univ
[email protected]
2-6
Figure 2-4. Bus Interfaces Tab showing Bus Connections to the Added Peripherals
Select the Addresses filter
You can manually assign the base address and size of your peripherals or have XPS generate
the addresses for you.
Click under the size column in the push and dip instances, change it to 64K, and hit Enter
key
Click Generate Addresses (located on the right most end of the tabs) to automatically
generate the base and high addresses for the peripherals in the system. The base address and
high addresses will change as shown in Figure 2-5 below
www.xilinx.com/univ
[email protected]
2-7
Step 3
There are four push buttons and four DIP switches on the Spartan-3E starter kit.
You will first configure the push and dip instances according to their sizes and
direction, and then make external pin connections.
Select the Ports filter in the toolbar of the System Assembly View
Double-click on the push instance to access the configuration window
Notice that the peripheral can be configured for two channels, but, since we want to use only
one channel leave the Enable Channel 2 unchecked.
Click on the GPIO Data Bus Width down arrow and set it to 4, you will use 4 push buttons
on the Spartan-3E starter kit.
The settings for the Common parameters should be set according to Figure 2-6 below.
www.xilinx.com/univ
[email protected]
2-8
Set the same parameters for the dip instance, as performed for the push buttons.
Step 4
You will connect the push and dip instances to the push buttons and DIP switches
on the Spartan-3E starter kit. In order to do this, you must establish the GPIO
data ports as external FPGA pins and then assign them to the proper locations on
the FPGA via the UCF file. The location constraints are provided for you in this
section. Normally, one would consult the Spartan-3E starter kit user manual to
find this information.
Make the GPIO_in port of the push instance as external by selecting Make External. You
should see a new external net connection (Figure 2-8).
www.xilinx.com/univ
[email protected]
2-9
www.xilinx.com/univ
[email protected]
2-10
Step 5
Open the system.mhs file, study its contents, and answer the following questions.
Double-click the system.mhs file to open it if it is not already open
Study the external ports sections and answer the following questions
?
1.
2.
www.xilinx.com/univ
[email protected]
2-11
________________________________________________________________
List the devices connected to the mb_plb bus:
________________________________________________________________
________________________________________________________________
Review the memory map in the Addresses tab of the System Assembly View
?
3.
$0000_0000
$FFFF_FFFF
Step 6
www.xilinx.com/univ
[email protected]
2-12
In the Application tab, double-click on compiler options to open the Compiler Options
dialogue box.
In the Environment tab, select the option Use Default Linker Script.
www.xilinx.com/univ
[email protected]
2-13
www.xilinx.com/univ
[email protected]
2-14
Click on
to compile the source code. Make sure that it compiles error free
Note: This will automatically run LibGen to generate the required libraries if it has not been
done already.
Step 7
www.xilinx.com/univ
[email protected]
2-15
Note: Once the bitstream is downloaded, you should see the DONE LED ON and a message
displayed in HyperTerminal as shown in Figure 2-14
Figure 2-15. Push button and DIP switch status displayed on hyperterminal
Disconnect and close the HyperTerminal window, and also close XPS
Conclusion
GPIO peripherals were added from the IP catalog and connected to a MicroBlaze system that was
created in the first lab. The peripherals were configured and external FPGA connections were
established. Pin location constraints were made in the UCF file to connect the peripherals to push
buttons and DIP switches on the Spartan-3E starter kit.
In future labs in this course, you will learn how to add user cores, add software to the system,
simulate the design, debug the software, and verify the functionality of the completed design by
using a Spartan-3E Starter Kit.
www.xilinx.com/univ
[email protected]
2-16
Answers
A
1.
2.
20
12
5
3
3.
Draw the address map of the system, providing instance names. You can sort the peripheral addresses
by base address from the Addresses tab of the Add/Edit Cores (dialog) box.
0x000000000x00001fff
dlmb, llmb
unused
0x81400000 0x8140ffff
push
0x81420000 0x8142ffff
dip
0x81440000 0x8144ffff
LEDs_8Bit
0x84000000 0x8400ffff
RS232_DCE
0x84400000 0x8440ffff
debug-module
0x8C000000 0x8fffffff
DDR_SDRAM
www.xilinx.com/univ
[email protected]
2-17
BEGIN microblaze
PARAMETER INSTANCE = microblaze_0
PARAMETER C_INTERCONNECT = 1
PARAMETER HW_VER = 7.10.b
PARAMETER C_DEBUG_ENABLED = 1
PARAMETER C_AREA_OPTIMIZED = 1
www.xilinx.com/univ
[email protected]
2-18
www.xilinx.com/univ
[email protected]
2-19
www.xilinx.com/univ
[email protected]
2-20
PORT DDR_DQS_Div_O =
fpga_0_DDR_SDRAM_DDR_DQS_Div_I_DDR_SDRAM_DDR_DQS_Div_O
PORT DDR_DQS_Div_I =
fpga_0_DDR_SDRAM_DDR_DQS_Div_I_DDR_SDRAM_DDR_DQS_Div_O
PORT MPMC_Clk0 = DDR_SDRAM_mpmc_clk_s
PORT MPMC_Clk90 = DDR_SDRAM_mpmc_clk_90_s
PORT MPMC_Rst = sys_periph_reset
END
BEGIN clock_generator
PARAMETER INSTANCE = clock_generator_0
PARAMETER HW_VER = 2.01.a
PARAMETER C_EXT_RESET_HIGH = 1
PARAMETER C_CLKIN_FREQ = 50000000
PARAMETER C_CLKOUT0_FREQ = 50000000
PARAMETER C_CLKOUT0_BUF = TRUE
PARAMETER C_CLKOUT0_PHASE = 0
PARAMETER C_CLKOUT0_GROUP = NONE
PARAMETER C_CLKOUT1_FREQ = 100000000
PARAMETER C_CLKOUT1_BUF = TRUE
PARAMETER C_CLKOUT1_PHASE = 0
PARAMETER C_CLKOUT1_GROUP = DCM0
PARAMETER C_CLKOUT2_FREQ = 100000000
PARAMETER C_CLKOUT2_BUF = TRUE
PARAMETER C_CLKOUT2_PHASE = 90
PARAMETER C_CLKOUT2_GROUP = DCM0
PORT CLKOUT0 = sys_clk_s
PORT CLKOUT1 = DDR_SDRAM_mpmc_clk_s
PORT CLKOUT2 = DDR_SDRAM_mpmc_clk_90_s
PORT CLKIN = dcm_clk_s
PORT LOCKED = Dcm_all_locked
PORT RST = net_gnd
END
BEGIN mdm
PARAMETER INSTANCE = debug_module
PARAMETER HW_VER = 1.00.b
PARAMETER C_MB_DBG_PORTS = 1
PARAMETER C_USE_UART = 1
PARAMETER C_UART_WIDTH = 8
PARAMETER C_BASEADDR = 0x84400000
PARAMETER C_HIGHADDR = 0x8440ffff
BUS_INTERFACE SPLB = mb_plb
BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg
PORT Debug_SYS_Rst = Debug_SYS_Rst
END
BEGIN proc_sys_reset
PARAMETER INSTANCE = proc_sys_reset_0
PARAMETER HW_VER = 2.00.a
PARAMETER C_EXT_RESET_HIGH = 1
PORT Slowest_sync_clk = sys_clk_s
PORT Dcm_locked = Dcm_all_locked
PORT Ext_Reset_In = sys_rst_s
PORT MB_Reset = mb_reset
PORT Bus_Struct_Reset = sys_bus_reset
www.xilinx.com/univ
[email protected]
2-21
www.xilinx.com/univ
[email protected]
2-22