Weitere ähnliche Inhalte Ähnlich wie [SITCON2015] 自己的異質多核心平台自己幹 (20) [SITCON2015] 自己的異質多核心平台自己幹6. Outline
• 神人寫的GPGPU: Nyuzi processor, 在DE2-115 board執行
• github搜尋
• 概說Nyuzi processor特性
• 如何在DE2-115讓Nyuzi processor開始執行
• 在SoCKit board使用Golden System Reference Design (GSRD)
• RocketBoards.org組織提供
• 怎麼去做porting
7. Nyuzi Processor特色-SIMD
• A custom RISC instruction set (load-store architecture)
• 30 general purpose scalar registers
• 32 vector registers, each with 16 lanes
• Instructions are 32-bit fixed length and must be 32-bit aligned
des op2 op1 mask
add_i_mask v1, s2, v2, v3
total number of registers available per block: 65536
我比較大
需透過LLVM-
GPGPU來產
生machine
code
10. $ jload boot.hex
$ bin/serial_boot program.elf
GPGPU
Niso II
The DE2-115 Board
Ubutun14.04
USB Blaster-JTAG Clock rate: ~60 Mhz
SuperFish
12. Niso II
The DE2-115 Board
GPGPU
Memory
UART
0
0xffffffff
5. boot.c等待
serial_boot.c的command
stack
0x2000
code
JTAG Loader
PC
start.s
boot.c stack
0x200000
2. GPGPU reset後從address 0
開始執行
3. start.s 設定sp = 0x2000
4. 跳至boot.c
boot.hex
Ubutun14.04
step1 step6 step4
start.s boot.c
$ jload
NyuziProcessor/tools/serial_boot/serial_boot.c
1.
13. Niso II
The DE2-115 Board
GPGPU
Memory
UART
0
0xffffffff
NyuziProcessor/tools/serial_boot/serial_boot.c
解譯program.ELF
8. serial_boot.c告知
boot.c,code已經搬移
結束.跳至start.s
stack
0x2000
code
JTAG Loader
PC
start.s
boot.c stack
0x200000
9. 設置PC開始執行,並把
sp設置0x200000 (?)
Ubutun14.04
step1 step6 step4
6.告知GPGPU把HEX code 寫至board memory
boot.c
$ bin/serial_boot program.elf
7.收到HEX code寫至board memory
start.s
14. $ jload boot.hex
$ bin/serial_boot program.elf
怎那麼麻煩? (搬code進板子memory)
因為Niso II在納涼(閒置)
16. GSRD
• 提供開發者有一個Linux
環境可以操作FPGA
• Software IP
• Linux Driver
• File I/O來操作Software IP
• 開發流程概念:
• 先有個Image,先run.再針
對各部分update
• 細節可參考
• Booting Linux Using
Prebuilt SD Card Image
• Creating and Updating SD
Card
18. • H2F(Host to FPGA)
• High bandwidth
• Light weight
• F2H (FPGA to HPS system)
• F2S (FPGA-to-HPS SDRAM Interface)
19. Cyclone V HPS Memory Map
• 在SoCKit版中,Cortex-A9可主動透過
H2F傳資料給software IP
• LWAXI
• 0xFF200000 ~0xFF3FFFFF(2MB)
• HPS2FPGA (high bandwidth)
• 0xC000000開始
24. Software IP使用Qsys,有這麼簡單@@?
• 必須了解AXI master slave
• AMBA AXI and ACE Protocol Specification AXI3, AXI4, and AXI4-Lite, ACE and ACE-Lite
• 我不了解,但我會改 Demo AXI Memory Design Example
• Qsys System Design Tutorial
• 注意細節:
• 所有AXI master或者slave的pin都要宣告
• AXI slave's ID bit width
• If an AXI slave's ID bit width is smaller than required for your system, the AXI slave response
might not reach all AXI
• maximum_master_id_width_in_the_interconnect +
log2(number_of_masters_in_the_same_interconnect)
• 所以我把Nyuzi Processor製作成Qsys元件
28. 經過下列步驟,就可以撰寫程式來測試FPGA是
否有加成功? Yes, it works.
• Converting .sof to .rbf
• Device tree generation
• 給寫driver用的。概念上就是知道I/O的name,就可以透過查詢
Device Tree得到address來操作[跨板子設計]
• Preloader image generation
• 會產生出preloader的source code ,所以有些FPGA初始化設定
可以在這裡撰寫編譯
• Configure Pinmux
• Preloader and U-Boot Customization - v13.1
• Updating SD card
過程與細節可參考我的研究紀錄
31. Niso II
The DE2-115 Board
GPGPU
Memory
UART
0
0xffffffff
5. boot.c等待
serial_boot.c的command
stack
0x2000
code
JTAG Loader
PC
start.s
boot.c stack
0x200000
2. GPGPU reset後從address 0
開始執行
3. start.s 設定sp = 0x2000
4. 跳至boot.c
boot.hex
Ubutun14.04
step1 step6 step4
start.s boot.c
$ jload
NyuziProcessor/tools/serial_boot/serial_boot.c
1.
32. Niso II
The DE2-115 Board
GPGPU
Memory
UART
0
0xffffffff
NyuziProcessor/tools/serial_boot/serial_boot.c
解譯program.ELF
8. serial_boot.c告知
boot.c,code已經搬移
結束.跳至start.s
stack
0x2000
code
JTAG Loader
PC
start.s
boot.c stack
0x200000
9. 設置PC開始執行,並把
sp設置0x200000 (?)
Ubutun14.04
step1 step6 step4
6.告知GPGPU把HEX code 寫至board memory
boot.c
$ bin/serial_boot program.elf
7.收到HEX code寫至board memory
start.s
34. Cortex-A9
The SoCKit Board
GPGPU
Memory
0 0xffffffff
stackcode
PC
Ubutun14.04
LINUX
HPS
SD card
Program.hex produced by elf2hex
LWAXI
step 1
step 2
F2H
LWAXI
F2H
1. 透過Linux宣告code空間,並設置code base
address、stack address(?)
2. cortex-A9從SD card搬code至指定memory
3. 透過cortex-A9來控制GPGPU RESET signal(?)
Address data
0xFF200000 RESET
0xFF200004 Code base address
0xFF200008 Stack address
(*highest* stack)
0xFF20000C Heap address
0xFF200010 Frame address
36. Cortex-A9
The SoCKit Board
GPGPU
Memory
0 0xffffffff
stackcode
PC
Ubutun14.04
LINUX
HPS
SD card
Program.hex produced by elf2hex
LWAXI
1. 透過Linux宣告code空間,並設置code base
address、stack address(?)
2. cortex-A9從SD card搬code至指定memory
3. 透過cortex-A9來控制GPGPU RESET signal(?)
step 1
step 2
LWAXI
F2H 主動
Address data
0xFF200000 RESET
0xFF200004 Code base address
0xFF200008 Stack address
(*highest* stack)
0xFF20000C Heap address
0xFF200010 Frame address
PC
step 3
37. • 設計了memory I/O
• 你想要存取0xff200000你需要使用mmap
• fd = open(“/dev/mem”,..)
• used_ptr = mmap(..,fd,0xff200000)
• 透過LWAXI設定GPGPU的初始狀態, 且GPGPU透過F2H主動抓code
來執行
• 透過LWAXI設定Reset signal
上圖work之後的幾個概念整理
38. boot.hex
• How to build
• Elf2hex is as a loader
• Tutorial: Creating an LLVM Backend for the Cpu0 Architecture