Download presentation
Presentation is loading. Please wait.
Published byCarol Reeves Modified over 9 years ago
1
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 1 Hello World 軟 / 硬體實作 硬體實作 軟體實作
2
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 2 System Block Diagram DE2_70 50MHZ SOPC(FPGA) On-Chip Memory LCD Controller NIOS II Processor JTAG UART System Interconnect Fabric LCD RESET_N(1) USB Blaster PC NIOS II Program POWER 功能 : 於 LCD 顯示 “Hello World”
3
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 3 Hello World “ 硬 ” 體實作 1. 建立 Quartus Project 2. 建立 SOPC 3. 完成 Quartus Top 4.Compile/Download
4
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 4 1. 建立 Quartus Project 建立 QUARTUS Project
5
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 5 Start Quartus Windows Menu “ 開始 所有程式 Altera Quartus II 7.2 (32-btis)” 建立 QUARTUS Project
6
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 6 Start“New Project Wizard…” Qaurtus Menu “File New Project Wizard…” 建立 QUARTUS Project
7
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 7 Specify Project Info. 建立 QUARTUS Project
8
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 8 Add Project Files 建立 QUARTUS Project
9
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 9 Select FPGA 建立 QUARTUS Project
10
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 10 Select EDA Tool 建立 QUARTUS Project
11
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 11 Confirm/Finish 建立 QUARTUS Project
12
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 12 2. 建立 SOPC 建立 SOPC
13
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 13 於 Qaurtus 下啟動 SOPC Builder – 選單 “Tools SOPC Builder…”, 或 – 按下 SOPC Builder ICON 啟動 SOPC Builder 建立 SOPC
14
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 14 輸入 SYSTEM 資訊 建立 SOPC
15
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 15 Add “On-Chip Memory” 建立 SOPC
16
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 16 Add “NIOS II Processor” 建立 SOPC
17
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 17 Add “JTAG UART” 建立 SOPC
18
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 18 Add “LCD” 建立 SOPC
19
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 19 完成 SOPC 設計 建立 SOPC
20
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 20 Generate Code - DE2_70_SOPC.V (top) - DE2_70_SOPC.PTF 建立 SOPC
21
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 21 SOPC_DE2_70_SOPC.v ( 內容 ) 建立 SOPC
22
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 22 SOPC_DE2_70_SOPC.v(SYMB LE) 建立 SOPC
23
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 23 3. 完成Q uartus Top 完成 Quartus Top
24
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 24 目的 : 連接 SOPC 與週邊 完成 Quartus Top
25
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 25 New Verilog File 完成 Quartus Top
26
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 26 Rename Verilog File 完成 Quartus Top
27
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 27 Coding MY_FIRST_SOPC.v module MY_FIRST_SOPC ( ////////////////////Clock Input //////////////////// iCLK_50,// 50 MHz ////////////////////LCD Module 16X2//////////////// oLCD_ON,// LCD Power ON/OFF oLCD_BLON,// LCD Back Light ON/OFF oLCD_RW,// LCD Read/Write Select, 0 = Write, 1 = Read oLCD_EN,// LCD Enable oLCD_RS,// LCD Command/Data Select, 0 = Command, 1 = Data LCD_D,// LCD Data bus 8 bits ); 完成 Quartus Top
28
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 28 Port Declaration // PORT declarations //================================================== ////////////////////////Clock Input //////////////////////// inputiCLK_50;// 50 MHz ////////////////////LCD Module 16X2//////////////////////////// inout[7:0]LCD_D; // LCD Data bus 8 bits outputoLCD_ON; // LCD Power ON/OFF outputoLCD_BLON; // LCD Back Light ON/OFF outputoLCD_RW; // LCD Read/Write Select, 0 = Write, 1 = Read outputoLCD_EN; // LCD Enable outputoLCD_RS; // LCD Command/Data Select, // 0 = Command, 1 = Data 完成 Quartus Top
29
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 29 Power On LCD //==========16*2 LCD Module assign oLCD_ON = 1'b1;// LCD ON assign oLCD_BLON= 1'b1;// LCD Back Light 完成 Quartus Top
30
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 30 Connect SYSTEM // Structural coding //================================================== DE2_70_SOPC u1 ( // 1) global signals:.clk(iCLK_50),.reset_n(1), // the_lcd.LCD_E_from_the_lcd(oLCD_EN),.LCD_RS_from_the_lcd(oLCD_RS),.LCD_RW_from_the_lcd(oLCD_RW),.LCD_data_to_and_from_the_lcd(LCD_D) ); endmodule 完成 Quartus Top
31
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 31 Pin Assignment - Analysis 選單 “File Save” save “MY_FIRST_SOPC.V” 選單 “Processing Start Start Analysis & Elaboration” 完成 Quartus Top
32
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 32 開啟 Pin Planner 完成 Quartus Top
33
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 33 輸入 PIN 角位置 完成 Quartus Top 滑鼠雙擊 後, 打 B2
34
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 34 4. Compile/Download Compile/Download
35
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 35 Compile Compile/Download
36
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 36 Download 1 3 2 4 DE2_70 左邊 SWITCH 須切至 “RUN” Compile/Download
37
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 37 No USB-Blaster? 1 2 3 Compile/Download
38
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 38 Hello World “ 軟 ” 體實作
39
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 39 Start NIOS II IDE 7.2 Windows 選單 “ 開始 所有程式 Altera NIOS II EDS 7.2 NIOS II IDE 7.2” New Project
40
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 40 Setup Workspace 選單 “File Switch Workspace…” C:\DE2_70\MY_FIRST_SOPC\ software\project_hello New Project
41
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 41 New Nios Project 選單 “File New Nios II C/C++ Application” 1 2 3 4 5 C:\DE2_70\MY_FIRST_SOPC\ DE2_70_SOPC.ptf New Project
42
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 42 NIOS II IDE 介面 Coding Editor Project Management
43
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 43 Coding – hello_world.c #include #include "system.h" void hello_lcd(void); int main() { printf("Hello from Nios II!\n"); hello_lcd(); return 0; } void hello_lcd(void){ FILE *pLCD; char szHello[] = "DE2_70\nHello\n"; pLCD = fopen(LCD_NAME, "w"); if (pLCD){ fwrite(szHello, strlen(szHello), 1, pLCD); //fclose(pLCD); }else{ printf("failed to open LCD\n"); } Coding
44
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 44 Menu “Project Build All” Sytem.h Compile
45
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 45 Download Hardware.SOF Menu “Tools Quartus II Progammer” 1 2 3 4 5 Download HW C:\DE2_70\MY_FIRST_SOPC\ MY_FIRST_SOPC.sof
46
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 46 Run 1 2
47
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 47 Run Configuration 1. 滑鼠 左鍵雙擊 Run 2 3 4 5 NIOS II Hardware Target Connection 只有第一次未指定硬體時 才會出現此畫面
48
SOPC/NIOSII 設計與實作課程 © 2007 Terasic Corporation 48 LCD 上出現 NIO2 IDE Console 出現 結果 DE2_70 Hello Run
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.