Professional Documents
Culture Documents
SoC Design 1
SoC Design 1
CEG5010 Tutorial 7
By K. H. Tsoi
Dept. Computer Science and Engineering
The Chinese University of Hong Kong
2004-2005
http://www.cse.cuhk.edu.hk/~ceg5010
Overview
Xilinx EDK
Introduction to SoC
Supporting tools
Software/Hardware co-design
Micro Processor
Bus
Bus (cont.)
DCR: Device Control Register Bus (PPC only)
Between CPU's general purpose registers (GPRs) and the
DCR slave logic's device control registers (DCRs)
10-bit address, 32-bit data
LMB: Local Memory Bus (fast) (MB only)
Connecting MicroBlaze instruction and data ports to BRAM
FSL: Fast Simplex Link Bus (MB only)
Direct connection hardware core
FIFO using SRL16
Point-to-Point, unidirectional communication
Single Master/Slave for each FSL
Memory & I/O
On-chip memory:
BlockRAM, distribute RAM
Off-chip memory:
SDRAM, DDRAM
Compact Flash
ROM
Rocket I/O
Board Specification
Lab Environment
Getting Start
Login
User: root
Password: root
Through TE7720
Connect JTAG to CON2 and use “LBPLAY2.EXE”
Directly to FPGA
Connect JTAG to CON7 and use IMPACT
Suzaku MicorBlaze Memory MAP
Start Address End Address Peripheral Device
0x0000 0000 0x0000 1FFF BRAM
0x0000 1000 0x7FFF FFFF Reserved
0x8000 0000 0x80FF FFFF OPB-SDRAM Controller SDRAM 16MByte
0x8100 0000 0xFEFF FFFF Free
0xFF00 0000 0xFF7F FFFF OPB-EMC FLASH Memory 4MByte
0xFF80 0000 0xFFCF FFFF Free
0xFFE0 0000 0xFFEF FFFF OPB-EMC LAN Controller
0xFFF0 0000 0xFFFF 0FFF Free
0xFFFF 1000 0xFFFF 10FF OPB-Timer
0xFFFF 1100 0xFFFF 1FFF Free
0xFFFF 2000 0xFFFF 20FF OPB-UART Lite RS232C
0xFFFF 2100 0xFFFF 2FFF Free
0xFFFF 3000 0xFFFF 30FF OPB-Interrupt Controller
0xFFFF 3100 0xFFFF 9FFF Free
0xFFFF A000 0xFFFF A0FF OPB-GPIO Boot Mode Jumper
LED
Software Reset
0xFFFF A100 0xFFFF FFFF Free
User IPs should make use of the “free” slots in
memory map
New configuration (bitstream) should be
downloaded to 0x00000000 of Flash Memory
New uclinux kernel should be downloaded to
0x000A0000 of Flash Memory
Do NOT confuse MB memory and Flash Memory
Suzaku Booting Process
EDK
Standalone Applications
User application is only program run on uP
Direct access to all system resources
Uses C library provided by Xilinx
Compiled by Xilinx’s modified GCC
E.g. mb_gcc
Fast, simple, only Xilinx tool chain required
Limited function: no server, no IPC, etc.
User must handle all communications
Applications With OS
OS (e.g. uC Linux) loaded first into uP
User application run as a normal program
under the OS
OS and user application all compiled using
cross development tools
Complicated and may have OS overheads
Feature rich: all you can get from an OS
User applications access hardware resource
through APIs included in the OS
On a Linux PC
Download cross development tool chain
microblaze-elf-tools-20040315.tar.gz
Download uCLinux distribution
uClinux-dist-20040408-suzaku4.tar.bz2
Download Hello demo program
hello.tar.gz
Extract them all to user home directory
Rename the uClinux directory
mv uClinux-dist-20040408-suzaku4 uClinux-dist
Set the path environment
export PATH=$HOME/bin:$PATH
Environment Setup: EDK/ProjNav
On a Windows PC
Download the FPGA Project
suzaku-20040611.zip
Extract to a working directory (no space
allowed in path)
Make sure you have ISE 6.2i and EDK 6.2i
installed
Use the 2005 version of Suzaku project if you
have ISE/EDK 6.3i
Application I: Hello World!
Only C program require
Left FPGA configuration untouched
Step 1: make kernel image
Step 2: make user application
Step 3: create Linux image
Step 4: download image to Flash memory
Step 5: reboot
Step 6: test user application
cd uClinux-dist
1 make menuconfig
3
6
9
10
11
12
13
14
15
16
17
18
19
make clean; make dep; make
Step 3: Create Linux System Image
Login as root
netflash http://www.cse.cuhk.edu.hk/~khtsoi/image.bin
Step 6: Testing Application
Login as root
Procedures
What is inside the FPGA?
2
file:///C:/EDK/data/wizards/ip_moreinfo.htm
Step 2: Import IP Template
5
4
10
Step 2: Import IP Template
11
12 13
These are I/O register of
our IP core
14
15
EDK will take care of these
16
Step 2: Import IP Template
17
18
Step 3: Create User IP
In file user_logic.vhd
Comment from line 176 and line 192–196
Insert the following after line 201
ADDER_CIRCUIT: process ( Bus2IP_Clk ) is
begin
Step 4: Connect User IP
Step 4: Connect User IP
4
Step 5: Generate Configuration File
1 3
2
Step 5: Generate Configuration File
Empty simulator
field if you don’t
have ModelSim
Step 5: Generate Configuration File
Open “top.vhd” and
“top.ucf” from the
7
parent directory.
10
Step 5: Generate Configuration File
Add the EDK project to the ISE project
Select “top-imp (top.vhd)” in “Module View”
Select menu “Project” “Add Source …”
Open the “xps_proj.xmp” in directory ..\xps_proj
Create Configuration bit file
Select “top-imp (top.vhd)” in “Module View”
Select “Generate Programming File” in Process View
Select menu “Process” “Rerun All”
The process should finish without error.
Step 6: Create User Application
We can start from the “Hello world!”
example by copying the hello directory to
my_adder directory
cp -r hello my_adder
Create a new C source file called
my_adder.c
We will use the GPIO API in uCLinux to
access our IP core
Step 6: Create User Application
Edit the Makefile
Replace all instances of “hello” with
“my_adder”
Compile the application
make -FLTFLAGS=-z
Install application and create system image
as in the “Hello world!” example
Step 8: Reboot and Test
Remember to download the system image
and reboot again as shown in previous slides
After both FPGA configuration and system
image have been downloaded
Login as root
Run the your demo program
my_adder
Misc
A better way to install user applications: FTP.
Bring up eth0 of Suzaku
Start FTP server in Suzaku: ftpd
Upload user application to /var/tmp
Do we really need 3 registers in the adder
example? No, it’s possible to use only one or
two registers to compute S=A+B.
Recovery
The best way to recover is rewrite the Flash
memory with original images
This require a dump of the
/dev/flash/all and backup it in a safe
place (your PC)
Use netflash to cover the corrupted portion
of Flash memory
In case the system cannot boot up, user can
use the JTAG cable to download the FPGA
configuration as shown in next slices.
3
Step 5: Generate Configuration File
6 7
10
9
12
Step 5: Generate Configuration File
14