1 / 48

Hello World 軟 / 硬體實作

硬體實作 軟體實作. Hello World 軟 / 硬體實作. DE2_70. NIOS II Program. SOPC(FPGA). System Interconnect Fabric. 50MHZ. RESET_N(1). NIOS II Processor. On-Chip Memory. POWER. LCD Controller. LCD. PC. USB Blaster. JTAG UART. System Block Diagram. 功能 : 於 LCD 顯示 “ Hello World”.

hallam
Download Presentation

Hello World 軟 / 硬體實作

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 硬體實作 軟體實作 Hello World 軟/硬體實作

  2. DE2_70 NIOS II Program SOPC(FPGA) System Interconnect Fabric 50MHZ RESET_N(1) NIOS II Processor On-Chip Memory POWER LCD Controller LCD PC USB Blaster JTAG UART System Block Diagram • 功能: 於LCD 顯示 “Hello World”

  3. 建立 Quartus Project 建立 SOPC 完成Quartus Top Compile/Download Hello World “硬”體實作

  4. 1.建立 Quartus Project 建立QUARTUS Project

  5. Windows Menu “開始所有程式AlteraQuartus II 7.2 (32-btis)” Start Quartus 建立QUARTUS Project

  6. Qaurtus Menu “FileNew Project Wizard…” Start“New Project Wizard…” 建立QUARTUS Project

  7. Specify Project Info. 建立QUARTUS Project

  8. Add Project Files 建立QUARTUS Project

  9. Select FPGA 建立QUARTUS Project

  10. Select EDA Tool 建立QUARTUS Project

  11. Confirm/Finish 建立QUARTUS Project

  12. 2.建立 SOPC 建立 SOPC

  13. 啟動 SOPC Builder • 於Qaurtus 下啟動SOPC Builder • 選單 “Tools SOPC Builder…”, 或 • 按下 SOPC Builder ICON 建立 SOPC

  14. 輸入 SYSTEM 資訊 建立 SOPC

  15. Add “On-Chip Memory” 建立 SOPC

  16. Add “NIOS II Processor” 建立 SOPC

  17. Add “JTAG UART” 建立 SOPC

  18. Add “LCD” 建立 SOPC

  19. 完成SOPC 設計 建立 SOPC

  20. Generate Code - DE2_70_SOPC.V (top) - DE2_70_SOPC.PTF 建立 SOPC

  21. SOPC_DE2_70_SOPC.v (內容) 建立 SOPC

  22. SOPC_DE2_70_SOPC.v(SYMBLE) 建立 SOPC

  23. 3. 完成Quartus Top 完成Quartus Top

  24. 目的:連接SOPC與週邊 完成Quartus Top

  25. New Verilog File 完成Quartus Top

  26. Rename Verilog File 完成Quartus Top

  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. Port Declaration // PORT declarations //================================================== //////////////////////// Clock Input //////////////////////// input iCLK_50; // 50 MHz //////////////////// LCD Module 16X2 //////////////////////////// inout [7:0] LCD_D; // LCD Data bus 8 bits output oLCD_ON; // LCD Power ON/OFF output oLCD_BLON; // LCD Back Light ON/OFF output oLCD_RW; // LCD Read/Write Select, 0 = Write, 1 = Read output oLCD_EN; // LCD Enable output oLCD_RS; // LCD Command/Data Select, // 0 = Command, 1 = Data 完成Quartus Top

  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. 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. Pin Assignment - Analysis • 選單 “FileSave” save “MY_FIRST_SOPC.V” • 選單 “ProcessingStartStart Analysis & Elaboration” 完成Quartus Top

  32. 開啟Pin Planner 完成Quartus Top

  33. 輸入PIN角位置 滑鼠雙擊後, 打B2 完成Quartus Top

  34. 4. Compile/Download Compile/Download

  35. Compile Compile/Download

  36. 1 3 2 4 Download • DE2_70 左邊SWITCH 須切至 “RUN” Compile/Download

  37. 2 1 3 No USB-Blaster? Compile/Download

  38. Hello World “軟”體實作

  39. Start NIOS II IDE 7.2 • Windows選單“開始所有程式AlteraNIOS II EDS 7.2NIOS II IDE 7.2” New Project

  40. Setup Workspace • 選單“FileSwitch Workspace…” C:\DE2_70\MY_FIRST_SOPC\ software\project_hello New Project

  41. 3 4 1 C:\DE2_70\MY_FIRST_SOPC\ DE2_70_SOPC.ptf 2 5 New Nios Project • 選單“FileNewNios II C/C++ Application” New Project

  42. Editor Project Management NIOS II IDE 介面 Coding

  43. Coding – hello_world.c #include <stdio.h> #include <stdlib.h> #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. Menu “ProjectBuild All” Sytem.h Compile Compile

  45. Download Hardware .SOF • Menu “ToolsQuartus II Progammer” 5 3 2 1 C:\DE2_70\MY_FIRST_SOPC\ MY_FIRST_SOPC.sof 4 Download HW

  46. 2 1 Run Run

  47. Run Configuration Target Connection NIOS II Hardware 1.滑鼠 左鍵雙擊 3 2 4 只有第一次未指定硬體時 才會出現此畫面 5 Run

  48. 結果 • LCD 上出現 • NIO2 IDE Console 出現 DE2_70 Hello Run

More Related