用nios2 双口ram如何添加sdramip核并实现乒乓操作

基于FPGA的双摄像头定位系统的设计与实现FPGA,???,? ?
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
基于FPGA的双摄像头定位系统的设计与实现
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口基于FPGA的双摄像头定位系统的设计与实现_图文_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
基于FPGA的双摄像头定位系统的设计与实现
基​于​F​P​G​A​的​视​频​处​理
阅读已结束,如果下载本文需要使用
想免费下载本文?
你可能喜欢.sdram_clk(),
// SDRAM Clock // To do!! SDRAM Clock output
.sdram_clk(sdram_clk), // SDRAM Clock
// To do!! assign sdram clk to oDRAM0_CLK
assign oDRAM0_CLK
// SDRAM0 Clock
// To do!! assign sdram clk to oDRAM1_CLK
assign oDRAM1_CLK
// SDRAM1 Clock&
因為DE2-70有2顆SDRAM,所以要assign兩次clk。
.zs_dq_to_and_from_the_sdram(),
// SDRAM Data bus 32 Bits // To do!! SDRAM Data bus output
.zs_dq_to_and_from_the_sdram(DRAM_DQ), // SDRAM Data bus 32 Bits
因為DRAM_DQ是inout型態,不能使用wire連接,要直接連到inout port。
要如何知道SOPC System有哪些port呢?
開啟nios_ii.v,這是由SOPC Builder所產生的Verilog code,搜尋『module nios_ii (』,可以找到SOPC System的module定義,top module就是根據這裡的定義,連到DE2-70的I/O port。
Step 31:設定Reserved all unused pins As input tri-stated
Assignment -& Device
Device and Pin Options...
Unused Pins : Reserve all unused pins: As input tri-stated
這個步驟一定要做,否則Nios II無法執行,會出現以下錯誤訊息,初學者常常忽略這個步驟!!
Step 32:Import Pin Assignment
下載,其中的DE2_70_pin_assignments.csv記錄了DE2-70所有 I/O的連接腳位。
Assignments -& Import Assignments...
載入DE2_70_pin_assignments.csv,按OK繼續。
查看Pin Assignment結果
Assignments -& Assignment Editor
如下圖,表示Pin Assignment設定成功。
這個步驟也一定要做,否則Nios II無法執行,也會出現以下錯誤訊息,初學者常常忽略這個步驟!!
Step 33:設定nCEO為Use as regular I/O
Assignments –& Device
Device and Pin Options...
Dual-Purpose Pins
將nCEO改成Use as regular I/O
這是DE2-70設計上的問題,在DE2或其他的Altera的開發版並不需要如此設定。若不這樣設定,Quartus II在編譯時會出現以下錯誤訊息而編譯失敗。
Step 34:Quartus II編譯
需要2到10分鐘的時間,視CPU速度而定。
Programmer部分使用Programmer將編譯的的*.sof燒進FPGA
Step 35:啟動Programmer
按Hardware Setup,設定USB-Blaster。
選擇可用的USB-Blaster
按Start開始將*.sof燒進FPGA,當100%出現時,表示燒錄成功。
至目前為止,硬體部分結束,接下來是軟體部分。
Nios II EDS部分使用Nios II EDS開發Nios II軟體
Step 36:使用Hello Wrold測試硬體是否設計成功
Quartus II能正常編譯,不代表硬體設計成功,SOPC Builder各controller的參數設定錯誤、clk設定錯誤、top module連線錯誤、Quartus II設定錯誤...等,都可能造成Nios II無法執行,所以先用最簡單的Hello World測試硬體,若連Hello World都不能執行,軟體部分就不用繼續了,先回頭找硬體部分的bug。
右側選擇Hello World template,並指定SOPC Builder System PFT File:c:\DE2-70\hello_ucosii\nios_ii.ptf,這是先前SOPC Builder所generate的ptf檔。最後直接按Finish完成。
Nios II EDS會根據你選的project template與SOPC Builder System File產生2個project:1.hello_world_0:Nios II Software project。2.hello_world_0_syslib:Nios II System Library project。(System Library = HAL(Hardware Abstraction Layer) = BSP(Board Support Package) = Driver)
選hello_world_0,按滑鼠右鍵,選System Library Properties
將System clock timer選sys_clk_timer,另外將軟體全部跑在SDRAM,當然也可以跑在其他記憶體,只是因為SDRAM容量最大,而且SDRAM的clk需要phase shift,所以最常出現問題都是在SDRAM,所以在此特別使用SDRAM,至於其他記憶體可自行測試。
Rus As Nios II Hardware,此實Nios II軟體會透過JTAG UART傳到SDRAM開始執行。
若第一次執行,Nios II EDS會編譯整個System Library,需要一點時間,約2到3分鐘。
最後執行結果,Nios II由JTAG UART傳回Hello from Nios II到PC的Console。
若能正確執行Hello World,表示SOPC硬體正確,可以繼續軟體的開發。
Step 37測試Hello μC/OS-II
目前為止,single thread的軟體程式已經能跑在Nios II上,若要讓Nios II能跑multi thread,就必須靠OS才行,Nios II EDS已經已經巧妙的將μC/OS-II包在System Library裡面。
Step 38:開發一個多執行緒且控制硬體的程式
能成功執行Hello Wrold與Hello μC/OS-II,表示軟硬體都已經設定妥當,可以正式用C寫程式了。
再用Hello μC/OS-II template建立一個project。
將hello_ucosii.c改成如以下的程式
hello_ucosii.c / C&
1 #include &stdio.h& 2 #include "includes.h" 3 #include "system.h"
4 #include &io.h&
6 &/* Definition of Task Stacks */ 7 &#define
TASK_STACKSIZE
2048 8 OS_STK
task1_stk[TASK_STACKSIZE]; 9 OS_STK
task2_stk[TASK_STACKSIZE]; <span style="color: # <span style="color: # &/* Definition of Task Priorities */ <span style="color: # <span style="color: # &#define TASK1_PRIORITY
1<span style="color: # &#define TASK2_PRIORITY
2 <span style="color: # <span style="color: # &/* Prints "Hello World" and sleeps for three seconds */<span style="color: # void task1(void* pdata)<span style="color: # {<span style="color: #
while (<span style="color: #)<span style="color: #
{ <span style="color: #
printf("Hello uCOS-II\n");<span style="color: #
OSTimeDlyHMSM(<span style="color: #, <span style="color: #, <span style="color: #, <span style="color: #);<span style="color: #
}<span style="color: # }<span style="color: # &/* Prints "Hello World" and sleeps for three seconds */<span style="color: # void task2(void* pdata)<span style="color: # {<span style="color: #
unsigned int<span style="color: #
while (<span style="color: #)<span style="color: #
{ <span style="color: #
// read switch<span style="color: # &
i = IORD(PIO_SW_BASE, <span style="color: #);
<span style="color: #
// write ledr<span style="color: # &
IOWR(PIO_LEDR_BASE, <span style="color: #, i);<span style="color: #
}<span style="color: # }<span style="color: # &/* The main function creates two task and starts multi-tasking */<span style="color: # &int main(void)<span style="color: # {<span style="color: #
OSTaskCreateExt(task1,<span style="color: #
NULL,<span style="color: #
(void *)&task1_stk[TASK_STACKSIZE-<span style="color: #],<span style="color: #
TASK1_PRIORITY,<span style="color: #
TASK1_PRIORITY,<span style="color: #
task1_stk,<span style="color: #
TASK_STACKSIZE,<span style="color: #
NULL,<span style="color: #
<span style="color: #);<span style="color: #
OSTaskCreateExt(task2,<span style="color: #
NULL,<span style="color: #
(void *)&task2_stk[TASK_STACKSIZE-<span style="color: #],<span style="color: #
TASK2_PRIORITY,<span style="color: #
TASK2_PRIORITY,<span style="color: #
task2_stk,<span style="color: #
TASK_STACKSIZE,<span style="color: #
NULL,<span style="color: #
<span style="color: #);<span style="color: #
OSStart();<span style="color: #
return <span style="color: #;<span style="color: # }<span style="color: # <span style="color: # &
#include "system.h" #include &io.h&
system.h記載著SOPC Builder裡各controller的資訊,稍後會討論。io.h定義了IORD()與IOWR()兩個巨集,可以利用此巨集存取各controller的register。
void task1(void* pdata){
while (<span style="color: #)
printf("Hello uCOS-II\n");
OSTimeDlyHMSM(<span style="color: #, <span style="color: #, <span style="color: #, <span style="color: #);
}} void task2(void* pdata){
unsigned int
while (<span style="color: #)
// read switch
i = IORD(PIO_SW_BASE, <span style="color: #);
// write ledr
IOWR(PIO_LEDR_BASE, <span style="color: #, i);
i = IORD(PIO_SW_BASE, 0); // 讀取SW目前的值。IOWR(PIO_LEDR_BASE, 0, i);& // 將SW的值馬上給LEDR顯示。
也就是說,若SW為ON時,LEDR會亮,若SW為OFF時,LEDR就不亮。
我們是怎麼做到的呢?
我們透過IORD()巨集,去讀取pio_sw controller目前register的值,然後透過IOWR()巨集,將值寫入pio_ledr controller的register,讓LEDR顯示。
問題來了!!我們怎麼知道pio_sw與pio_ledr在哪裡?
之前#include &system.h&,我們來看看system.h的內容
開啟C:\DE2-70\hello_ucosii\software\hello_ucosii_1_syslib\Debug\system_description\system.h
#define PIO_SW_NAME "/dev/pio_sw"#define PIO_SW_TYPE "altera_avalon_pio"#define PIO_SW_BASE 0x#define PIO_SW_SPAN 16#define PIO_SW_DO_TEST_BENCH_WIRING 0#define PIO_SW_DRIVEN_SIM_VALUE 0#define PIO_SW_HAS_TRI 0#define PIO_SW_HAS_OUT 0#define PIO_SW_HAS_IN 1#define PIO_SW_CAPTURE 0#define PIO_SW_DATA_WIDTH 18#define PIO_SW_RESET_VALUE 0#define PIO_SW_EDGE_TYPE "NONE"#define PIO_SW_IRQ_TYPE "NONE"#define PIO_SW_BIT_CLEARING_EDGE_REGISTER 0#define PIO_SW_FREQ #define ALT_MODULE_CLASS_pio_sw altera_avalon_pio
#define PIO_SW_BASE 0x 定義了SOPC Builder為pio_sw所規劃的位址,而system.h也是Nios II EDS根據nios_ii.ptf所產生的。
#define PIO_LEDR_NAME "/dev/pio_ledr"#define PIO_LEDR_TYPE "altera_avalon_pio"#define PIO_LEDR_BASE 0x#define PIO_LEDR_SPAN 16#define PIO_LEDR_DO_TEST_BENCH_WIRING 0#define PIO_LEDR_DRIVEN_SIM_VALUE 0#define PIO_LEDR_HAS_TRI 0#define PIO_LEDR_HAS_OUT 1#define PIO_LEDR_HAS_IN 0#define PIO_LEDR_CAPTURE 0#define PIO_LEDR_DATA_WIDTH 18#define PIO_LEDR_RESET_VALUE 0#define PIO_LEDR_EDGE_TYPE "NONE"#define PIO_LEDR_IRQ_TYPE "NONE"#define PIO_LEDR_BIT_CLEARING_EDGE_REGISTER 0#define PIO_LEDR_FREQ #define ALT_MODULE_CLASS_pio_ledr altera_avalon_pio
#define PIO_LEDR_BASE 0x 定義了SOPC Builder為pio_ledr所規劃的位址。
設定標準輸出為LCD
透過μC/OS-II,一個thread在LCD顯示,另一個thread控制SW與LEDR。
完整程式碼下載 (一個未完成的半成品,可以根著本文一步一步完成) (最後完整的結果)
Question(這是我當時給學生的homework,各位有興趣可以自己自做做看)
1.為什麼只有SDRAM的clock需要phase shift -65度?為什其他的硬體的clk都不需要phase shift?
2.可以使用pointer,而不使用IORD()與IOWR()嗎?解釋你的理由?
#define SW (unsigned int *)SW_BASE#define LEDR (unsigned int *)LEDR_BASEvoid task2(void* pdata) {
while (<span style="color: #)
*LEDR = *SW;
3. 試著將Hello World執行在On-Chip Memory,並解釋你所使用的方法。
Conclusion對一個初學者來說,要讓Nios II能順利的在DE2-70跑起來,需要面臨很陡峭的學習曲線,因為其中有不少小trick很容易忽略而失敗。Nios II就只是這樣嗎?這只是Nios II的起手式,本系列共用4個Lab,此為第1個,第2個Lab以七段顯示器為範例,示範如何寫Slave IP,第3個Lab為Terasic的DE2_70_SD_Card_Audio_Player範例,除了實際體會HW/SW Co-Design外,將學習如何讀取SD卡,第4個Lab將實作一個數位像框,示範如何寫一個Master IP,並可直接從Flash啟動。ddr2 sdram操作时序 乒乓操作 乒乓操作 fpga 乒乓球的动画片 唐建军乒乓球教学片 ..
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
一片SDRAM实现乒乓操作
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口& 2&(C) OOMusou 2008
& 4&Filename&&& : DE2_70_NIOS.v
& 5&Compiler&&& : Quartus II 8.1
& 6&Description : DE2_70_NIOS reference design 1.1
& 7&Release&&&& : 11/25/
<span style="color: #&module DE2_70_NIOS (
<span style="color: #&& input&&&&&&&& iCLK_28,&&&&&&& // 28.63636 MHz
<span style="color: #&& input&&&&&&&& iCLK_50,&&&&&&& // 50 MHz
<span style="color: #&& input&&&&&&&& iCLK_50_2,&&&&& // 50 MHz
<span style="color: #&& input&&&&&&&& iCLK_50_3,&&&&& // 50 MHz
<span style="color: #&& input&&&&&&&& iCLK_50_4,&&&&& // 50 MHz
<span style="color: #&& input&&&&&&&& iEXT_CLOCK,&&&& // External Clock
<span style="color: #&& ////////////////////////////// Push Button ////////////////////////
<span style="color: #&& input& [<span style="color: #:<span style="color: #]& iKEY,&&&&&&&&&& // Pushbutton[3:0]
<span style="color: #&& ////////////////////////////// DPDT Switch ////////////////////////
<span style="color: #&& input& [<span style="color: #:<span style="color: #] iSW,&&&&&&&&&&& // Toggle Switch[17:0]
<span style="color: #&& ////////////////////////////// 7-SEG Dispaly& ////////////////////////
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX0_D,&&&&&&& // Seven Segment Digit 0
<span style="color: #&& output&&&&&&& oHEX0_DP,&&&&&& // Seven Segment Digit 0 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX1_D,&&&&&&& // Seven Segment Digit 1
<span style="color: #&& output&&&&&&& oHEX1_DP,&&&&&& // Seven Segment Digit 1 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX2_D,&&&&&&& // Seven Segment Digit 2
<span style="color: #&& output&&&&&&& oHEX2_DP,&&&&&& // Seven Segment Digit 2 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX3_D,&&&&&&& // Seven Segment Digit 3
<span style="color: #&& output&&&&&&& oHEX3_DP,&&&&&& // Seven Segment Digit 3 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX4_D,&&&&&&& // Seven Segment Digit 4
<span style="color: #&& output&&&&&&& oHEX4_DP,&&&&&& // Seven Segment Digit 4 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX5_D,&&&&&&& // Seven Segment Digit 5
<span style="color: #&& output&&&&&&& oHEX5_DP,&&&&&& // Seven Segment Digit 5 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX6_D,&&&&&&& // Seven Segment Digit 6
<span style="color: #&& output&&&&&&& oHEX6_DP,&&&&&& // Seven Segment Digit 6 decimal point
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oHEX7_D,&&&&&&& // Seven Segment Digit 7
<span style="color: #&& output&&&&&&& oHEX7_DP,&&&&&& // Seven Segment Digit 7 decimal point
<span style="color: #&& //////////////////////////////// LED ////////////////////////////
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oLEDG,&&&&&&&&& // LED Green[8:0]
<span style="color: #&& output [<span style="color: #:<span style="color: #] oLEDR,&&&&&&&&& // LED Red[17:0]
<span style="color: #&& //////////////////////////////// UART ////////////////////////////
<span style="color: #&& output&&&&&&& oUART_TXD,&&&&& // UART Transmitter
<span style="color: #&& input&&&&&&&& iUART_RXD,&&&&& // UART Receiver
<span style="color: #&& output&&&&&&& oUART_CTS,&&&&& // UART Clear To Send
<span style="color: #&& input&&&&&&&& iUART_RTS,&&&&& // UART Requst To Send
<span style="color: #&& //////////////////////////////// IRDA ////////////////////////////
<span style="color: #&& output&&&&&&& oIRDA_TXD,&&&&& // IRDA Transmitter
<span style="color: #&& input&&&&&&&& iIRDA_RXD,&&&&& // IRDA Receiver
<span style="color: #&& //////////////////////////////// SDRAM Interface ////////////////////////
<span style="color: #&& inout& [<span style="color: #:<span style="color: #] DRAM_DQ,&&&&&&& // SDRAM Data bus 32 Bits
<span style="color: #&& output [<span style="color: #:<span style="color: #] oDRAM0_A,&&&&&& // SDRAM0 Address bus 12 Bits
<span style="color: #&& output [<span style="color: #:<span style="color: #] oDRAM1_A,&&&&&& // SDRAM1 Address bus 12 Bits
<span style="color: #&& output&&&&&&& oDRAM0_LDQM0,&& // SDRAM0 Low-byte Data Mask
<span style="color: #&& output&&&&&&& oDRAM1_LDQM0,&& // SDRAM1 Low-byte Data Mask
<span style="color: #&& output&&&&&&& oDRAM0_UDQM1,&& // SDRAM0 High-byte Data Mask
<span style="color: #&& output&&&&&&& oDRAM1_UDQM1,&& // SDRAM1 High-byte Data Mask
<span style="color: #&& output&&&&&&& oDRAM0_WE_N,&&& // SDRAM0 Write Enable
<span style="color: #&& output&&&&&&& oDRAM1_WE_N,&&& // SDRAM1 Write Enable
<span style="color: #&& output&&&&&&& oDRAM0_CAS_N,&& // SDRAM0 Column Address Strobe
<span style="color: #&& output&&&&&&& oDRAM1_CAS_N,&& // SDRAM1 Column Address Strobe
<span style="color: #&& output&&&&&&& oDRAM0_RAS_N,&& // SDRAM0 Row Address Strobe
<span style="color: #&& output&&&&&&& oDRAM1_RAS_N,&& // SDRAM1 Row Address Strobe
<span style="color: #&& output&&&&&&& oDRAM0_CS_N,&&& // SDRAM0 Chip Select
<span style="color: #&& output&&&&&&& oDRAM1_CS_N,&&& // SDRAM1 Chip Select
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oDRAM0_BA,&&&&& // SDRAM0 Bank Address
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oDRAM1_BA,&&&&& // SDRAM1 Bank Address
<span style="color: #&& output&&&&&&& oDRAM0_CLK,&&&& // SDRAM0 Clock
<span style="color: #&& output&&&&&&& oDRAM1_CLK,&&&& // SDRAM0 Clock
<span style="color: #&& output&&&&&&& oDRAM0_CKE,&&&& // SDRAM0 Clock Enable
<span style="color: #&& output&&&&&&& oDRAM1_CKE,&&&& // SDRAM1 Clock Enable
<span style="color: #&& //////////////////////////////// Flash Interface ////////////////////////
<span style="color: #&& inout& [<span style="color: #:<span style="color: #] FLASH_DQ,&&&&&& // FLASH Data bus 15 Bits (0 to 14)
<span style="color: #&& inout&&&&&&&& FLASH_DQ15_AM1, // FLASH Data bus Bit 15 or Address A-1
<span style="color: #&& output [<span style="color: #:<span style="color: #] oFLASH_A,&&&&&& // FLASH Address bus 26 Bits
<span style="color: #&& output&&&&&&& oFLASH_WE_N,&&& // FLASH Write Enable
<span style="color: #&& output&&&&&&& oFLASH_RST_N,&& // FLASH Reset
<span style="color: #&& output&&&&&&& oFLASH_WP_N,&&& // FLASH Write Protect /Programming Acceleration
<span style="color: #&& input&&&&&&&& iFLASH_RY_N,&&& // FLASH Ready/Busy output
<span style="color: #&& output&&&&&&& oFLASH_BYTE_N,& // FLASH Byte/Word Mode Configuration
<span style="color: #&& output&&&&&&& oFLASH_OE_N,&&& // FLASH Output Enable
<span style="color: #&& output&&&&&&& oFLASH_CE_N,&&& // FLASH Chip Enable
<span style="color: #&& //////////////////////////////// SRAM Interface ////////////////////////
<span style="color: #&& inout& [<span style="color: #:<span style="color: #] SRAM_DQ,&&&&&&& // SRAM Data Bus 32 Bits
<span style="color: #&& inout& [<span style="color: #:<span style="color: #]& SRAM_DPA,&&&&&& // SRAM Parity Data Bus
<span style="color: #&& output [<span style="color: #:<span style="color: #] oSRAM_A,&&&&&&& // SRAM Address bus 21 Bits
<span style="color: #&& output&&&&&&& oSRAM_ADSC_N,&& // RAM Controller Address Status&&&&
<span style="color: #&& output&&&&&&& oSRAM_ADSP_N,&& // SRAM Processor Address Status
<span style="color: #&& output&&&&&&& oSRAM_ADV_N,&&& // SRAM Burst Address Advance
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oSRAM_BE_N,&&&& // SRAM Byte Write Enable
<span style="color: #&& output&&&&&&& oSRAM_CE1_N,&&& // SRAM Chip Enable
<span style="color: #&& output&&&&&&& oSRAM_CE2,&&&&& // SRAM Chip Enable
<span style="color: #&& output&&&&&&& oSRAM_CE3_N,&&& // SRAM Chip Enable
<span style="color: #&& output&&&&&&& oSRAM_CLK,&&&&& // SRAM Clock
<span style="color: #&& output&&&&&&& oSRAM_GW_N,&&&& // SRAM Global Write Enable
<span style="color: #&& output&&&&&&& oSRAM_OE_N,&&&& // SRAM Output Enable
<span style="color: #&& output&&&&&&& oSRAM_WE_N,&&&& // SRAM Write Enable
<span style="color: #&& //////////////////////////////// ISP1362 Interface ////////////////////////
<span style="color: #&& inout& [<span style="color: #:<span style="color: #] OTG_D,&&&&&&&&& // ISP1362 Data bus 16 Bits
<span style="color: #&& output [<span style="color: #:<span style="color: #]& oOTG_A,&&&&&&&& // ISP1362 Address 2 Bits
<span style="color: #0&& output&&&&&&& oOTG_CS_N,&&&&& // ISP1362 Chip Select
<span style="color: #1&& output&&&&&&& oOTG_OE_N,&&&&& // ISP1362 Read
<span style="color: #2&& output&&&&&&& oOTG_WE_N,&&&&& // ISP1362 Write
<span style="color: #3&& output&&&&&&& oOTG_RESET_N,&& // ISP1362 Reset
<span style="color: #4&& inout&&&&&&&& OTG_FSPEED,&&&& // USB Full Speed, 0 = Enable, Z = Disable
<span style="color: #5&& inout&&&&&&&& OTG_LSPEED,&&&& // USB Low Speed,&&&& 0 = Enable, Z = Disable
<span style="color: #6&& input&&&&&&&& iOTG_INT0,&&&&& // ISP1362 Interrupt 0
<span style="color: #7&& input&&&&&&&& iOTG_INT1,&&&&& // ISP1362 Interrupt 1
<span style="color: #8&& input&&&&&&&& iOTG_DREQ0,&&&& // ISP1362 DMA Request 0
<span style="color: #9&& input&&&&&&&& iOTG_DREQ1,&&&& // ISP1362 DMA Request 1
<span style="color: #0&& output&&&&&&& oOTG_DACK0_N,&& // ISP1362 DMA Acknowledge 0
<span style="color: #1&& output&&&&&&& oOTG_DACK1_N,&& // ISP1362 DMA Acknowledge 1
<span style="color: #2&& //////////////////////////////// LCD Module 16X2 ////////////////////////////
<span style="color: #3&& inout& [<span style="color: #:<span style="color: #]& LCD_D,&&&&&&&&& // LCD Data bus 8 bits
<span style="color: #4&& output&&&&&&& oLCD_ON,&&&&&&& // LCD Power ON/OFF
<span style="color: #5&& output&&&&&&& oLCD_BLON,&&&&& // LCD Back Light ON/OFF
<span style="color: #6&& output&&&&&&& oLCD_RW,&&&&&&& // LCD Read/Write Select, 0 = Write, 1 = Read
<span style="color: #7&& output&&&&&&& oLCD_EN,&&&&&&& // LCD Enable
<span style="color: #8&& output&&&&&&& oLCD_RS,&&&&&&& // LCD Command/Data Select, 0 = Command, 1 = Data
<span style="color: #9&& //////////////////////////////// SD Card Interface ////////////////////////
<span style="color: #0&& inout&&&&&&&& SD_DAT,&&&&&&&& // SD Card Data
<span style="color: #1&& inout&&&&&&&& SD_DAT3,&&&&&&& // SD Card Data 3
<span style="color: #2&& inout&&&&&&&& SD_CMD,&&&&&&&& // SD Card Command Signal
<span style="color: #3&& output&&&&&&& oSD_CLK,&&&&&&& // SD Card Clock
<span style="color: #4&& //////////////////////////////// I2C ////////////////////////////////
<span style="color: #5&& inout&&&&&&&& I2C_SDAT,&&&&&& // I2C Data
<span style="color: #6&& output&&&&&&& oI2C_SCLK,&&&&& // I2C Clock
<span style="color: #7&& //////////////////////////////// PS2 ////////////////////////////
<span style="color: #8&& inout&&&&&&&& PS2_KBDAT,&&&&& // PS2 Keyboard Data
<span style="color: #9&& inout&&&&&&&& PS2_KBCLK,&&&&& // PS2 Keyboard Clock
<span style="color: #0&& inout&&&&&&&& PS2_MSDAT,&&&&& // PS2 Mouse Data
<span style="color: #1&& inout&&&&&&&& PS2_MSCLK,&&&&& // PS2 Mouse Clock
<span style="color: #2&& //////////////////////////////// VGA ////////////////////////////
<span style="color: #3&& output&&&&&&& oVGA_CLOCK,&&&& // VGA Clock
<span style="color: #4&& output&&&&&&& oVGA_HS,&&&&&&& // VGA H_SYNC
<span style="color: #5&& output&&&&&&& oVGA_VS,&&&&&&& // VGA V_SYNC
<span style="color: #6&& output&&&&&&& oVGA_BLANK_N,&& // VGA BLANK
<span style="color: #7&& output&&&&&&& oVGA_SYNC_N,&&& // VGA SYNC
<span style="color: #8&& output [<span style="color: #:<span style="color: #]& oVGA_R,&&&&&&&& // VGA Red[9:0]
<span style="color: #9&& output [<span style="color: #:<span style="color: #]& oVGA_G,&&&&&&&& // VGA Green[9:0]
<span style="color: #0&& output [<span style="color: #:<span style="color: #]& oVGA_B,&&&&&&&& // VGA Blue[9:0]
<span style="color: #1&& //////////////////////////////// Ethernet Interface ////////////////////////////
<span style="color: #2&& inout& [<span style="color: #:<span style="color: #] ENET_D,&&&&&&&& // DM9000A DATA bus 16Bits
<span style="color: #3&& output&&&&&&& oENET_CMD,&&&&& // DM9000A Command/Data Select, 0 = Command, 1 = Data
<span style="color: #4&& output&&&&&&& oENET_CS_N,&&&& // DM9000A Chip Select
<span style="color: #5&& output&&&&&&& oENET_IOW_N,&&& // DM9000A Write
<span style="color: #6&& output&&&&&&& oENET_IOR_N,&&& // DM9000A Read
<span style="color: #7&& output&&&&&&& oENET_RESET_N,& // DM9000A Reset
<span style="color: #8&& input&&&&&&&& iENET_INT,&&&&& // DM9000A Interrupt
<span style="color: #9&& output&&&&&&& oENET_CLK,&&&&& // DM9000A Clock 25 MHz
<span style="color: #0&& //////////////////////////////// Audio CODEC ////////////////////////////
<span style="color: #1&& inout&&&&&&&& AUD_ADCLRCK,&&& // Audio CODEC ADC LR Clock
<span style="color: #2&& input&&&&&&&& iAUD_ADCDAT,&&& // Audio CODEC ADC Data
<span style="color: #3&& inout&&&&&&&& AUD_DACLRCK,&&& // Audio CODEC DAC LR Clock
<span style="color: #4&& output&&&&&&& oAUD_DACDAT,&&& // Audio CODEC DAC Data
<span style="color: #5&& inout&&&&&&&& AUD_BCLK,&&&&&& // Audio CODEC Bit-Stream Clock
<span style="color: #6&& output&&&&&&& oAUD_XCK,&&&&&& // Audio CODEC Chip Clock
<span style="color: #7&& //////////////////////////////// TV Devoder ////////////////////////////
<span style="color: #8&& input&&&&&&&& iTD1_CLK27,&&&& // TV Decoder1 Line_Lock Output Clock
<span style="color: #9&& input& [<span style="color: #:<span style="color: #]& iTD1_D,&&&&&&&& // TV Decoder1 Data bus 8 bits
<span style="color: #0&& input&&&&&&&& iTD1_HS,&&&&&&& // TV Decoder1 H_SYNC
<span style="color: #1&& input&&&&&&&& iTD1_VS,&&&&&&& // TV Decoder1 V_SYNC
<span style="color: #2&& output&&&&&&& oTD1_RESET_N,&& // TV Decoder1 Reset
<span style="color: #3&& input&&&&&&&& iTD2_CLK27,&&&& // TV Decoder2 Line_Lock Output Clock&&&&&&&&
<span style="color: #4&& input& [<span style="color: #:<span style="color: #]& iTD2_D,&&&&&&&& // TV Decoder2 Data bus 8 bits
<span style="color: #5&& input&&&&&&&& iTD2_HS,&&&&&&& // TV Decoder2 H_SYNC
<span style="color: #6&& input&&&&&&&& iTD2_VS,&&&&&&& // TV Decoder2 V_SYNC
<span style="color: #7&& output&&&&&&& oTD2_RESET_N,&& // TV Decoder2 Reset
<span style="color: #8&& //////////////////////////////// GPIO ////////////////////////////////
<span style="color: #9&& inout& [<span style="color: #:<span style="color: #] GPIO_0,&&&&&&&& // GPIO Connection 0 I/O
<span style="color: #0&& input&&&&&&&& GPIO_CLKIN_N0,& // GPIO Connection 0 Clock Input 0
<span style="color: #1&& input&&&&&&&& GPIO_CLKIN_P0,& // GPIO Connection 0 Clock Input 1
<span style="color: #2&& output&&&&&&& GPIO_CLKOUT_N0, // GPIO Connection 0 Clock Output 0
<span style="color: #3&& output&&&&&&& GPIO_CLKOUT_P0, // GPIO Connection 0 Clock Output 1
<span style="color: #4&& inout& [<span style="color: #:<span style="color: #] GPIO_1,&&&&&&&& // GPIO Connection 1 I/O
<span style="color: #5&& input&&&&&&&& GPIO_CLKIN_N1,& // GPIO Connection 1 Clock Input 0
<span style="color: #6&& input&&&&&&&& GPIO_CLKIN_P1,& // GPIO Connection 1 Clock Input 1
<span style="color: #7&& output&&&&&&& GPIO_CLKOUT_N1, // GPIO Connection 1 Clock Output 0
<span style="color: #8&& output&&&&&&& GPIO_CLKOUT_P1& // PIO Connection 1 Clock Output 1
<span style="color: #9&);
<span style="color: #0&
<span style="color: #1&// All inout port turn to tri-state
<span style="color: #2&assign SD_DAT&&&&& =&<span style="color: #'
<span style="color: #3&assign GPIO_0&&&&& =&<span style="color: #'
<span style="color: #4&assign GPIO_1&&&&& =&<span style="color: #'
<span style="color: #5&assign AUD_ADCLRCK =&<span style="color: #'
<span style="color: #6&
<span style="color: #7&// Turn On TV Decoder
<span style="color: #8&assign oTD1_RESET_N =&<span style="color: #'
<span style="color: #9&assign oTD2_RESET_N =&<span style="color: #'
<span style="color: #0&
<span style="color: #1&// Flash
<span style="color: #2&assign FL_RST_N =&<span style="color: #'b1;
<span style="color: #3&
<span style="color: #4&// 16*2 LCD Module
<span style="color: #5&assign oLCD_ON&& =&<span style="color: #'b1; // LCD ON
<span style="color: #6&assign oLCD_BLON =&<span style="color: #'b1; // LCD Back Light
<span style="color: #7&
<span style="color: #8&// Disable USB speed select
<span style="color: #9&assign OTG_FSPEED =&<span style="color: #'
<span style="color: #0&assign OTG_LSPEED =&<span style="color: #'
<span style="color: #1&
<span style="color: #2&// FLASH
<span style="color: #3&wire FLASH_16BIT_IP_A0;
<span style="color: #4&assign oFLASH_BYTE_N =&<span style="color: #'b1; // FLASH Byte/Word Mode Configuration
<span style="color: #5&assign oFLASH_RST_N& =&<span style="color: #'b1; // FLASH Reset
<span style="color: #6&assign oFLASH_WP_N&& =&<span style="color: #'b1; // FLASH Write Protect /Programming Acceleration
<span style="color: #7&
<span style="color: #8&// SSRAM
<span style="color: #9&wire SRAM_CLK;
<span style="color: #0&wire [<span style="color: #:<span style="color: #] SRAM_DUMMY_ADDR;&&&&&&&& // used to ignore the A0/A1 pin from Cypress SSRAM IP core
<span style="color: #1&
<span style="color: #2&assign oSRAM_ADSP_N =&<span style="color: #'b1;&&&&&&&& // SRAM Processor Address Status
<span style="color: #3&assign oSRAM_ADV_N& =&<span style="color: #'b1;&&&&&&&& // SRAM Burst Address Advance
<span style="color: #4&assign oSRAM_CE2&&& =&~oSRAM_CE1_N; // SRAM Chip Enable
<span style="color: #5&assign oSRAM_CE3_N& = oSRAM_CE1_N;& // SRAM Chip Enable
<span style="color: #6&assign oSRAM_GW_N&& =&<span style="color: #'b1;&&&&&&&& // SRAM Global Write Enable
<span style="color: #7&assign oSRAM_CLK&&& = SRAM_CLK;
<span style="color: #8&
<span style="color: #9&// SDRAM
<span style="color: #0&// the sdram is shahred with rtl and nios
<span style="color: #1&wire [<span style="color: #:<span style="color: #] dram_a;
<span style="color: #2&wire [<span style="color: #:<span style="color: #]& dram_
<span style="color: #3&wire&&&&&&& dram_cas_n;
<span style="color: #4&wire&&&&&&& dram_
<span style="color: #5&wire&&&&&&& dram_cs_n;
<span style="color: #6&wire [<span style="color: #:<span style="color: #]& dram_
<span style="color: #7&wire&&&&&&& dram_ras_n;
<span style="color: #8&wire&&&&&&& dram_we_n;
<span style="color: #9&
<span style="color: #0&// dram1
<span style="color: #1&assign oDRAM0_CLK = SRAM_CLK;&&&&&&& // SDRAM0 Clock
<span style="color: #2&assign oDRAM1_CLK = SRAM_CLK;&&&&&&& // SDRAM1 Clock
<span style="color: #3&
<span style="color: #4&assign oDRAM0_A&&&& = dram_a;
<span style="color: #5&assign oDRAM0_BA&&& = dram_
<span style="color: #6&assign oDRAM0_CAS_N = dram_cas_n;
<span style="color: #7&assign oDRAM0_CKE&& = dram_
<span style="color: #8&assign oDRAM0_CS_N& = dram_cs_n;
<span style="color: #9&assign oDRAM0_LDQM0 = dram_dqm[<span style="color: #];
<span style="color: #0&assign oDRAM0_UDQM1 = dram_dqm[<span style="color: #];
<span style="color: #1&assign oDRAM0_RAS_N = dram_ras_n;
<span style="color: #2&assign oDRAM0_WE_N& = dram_we_n;
<span style="color: #3&
<span style="color: #4&// dram2
<span style="color: #5&assign oDRAM1_A&&&& = dram_a;
<span style="color: #6&assign oDRAM1_BA&&& = dram_
<span style="color: #7&assign oDRAM1_CAS_N = dram_cas_n;
<span style="color: #8&assign oDRAM1_CKE&& = dram_
<span style="color: #9&assign oDRAM1_CS_N& = dram_cs_n;
<span style="color: #0&assign oDRAM1_LDQM0 = dram_dqm[<span style="color: #];
<span style="color: #1&assign oDRAM1_UDQM1 = dram_dqm[<span style="color: #];
<span style="color: #2&assign oDRAM1_RAS_N = dram_ras_n;
<span style="color: #3&assign oDRAM1_WE_N& = dram_we_n;
<span style="color: #4&
<span style="color: #5&// USB
<span style="color: #6&assign OTG_FSPEED =&<span style="color: #' // USB Full Speed, 0 = Enable, Z = Disable
<span style="color: #7&assign OTG_LSPEED =&<span style="color: #' // USB Low Speed,& 0 = Enable, Z = Disable
<span style="color: #8&
<span style="color: #9&// Clock 25MHz
<span style="color: #0&reg iCLK_25;
<span style="color: #1&
<span style="color: #2&always@(posedge iCLK_50)
<span style="color: #3&& iCLK_25 &=&~iCLK_25;
<span style="color: #4&
<span style="color: #5&// NIOS CPU
<span style="color: #6&wire CPU_CLK;
<span style="color: #7&wire CPU_RESET_N;
<span style="color: #8&
<span style="color: #9&Reset_Delay delay0 (
<span style="color: #0&& .iRST(iKEY[<span style="color: #]),
<span style="color: #1&& .iCLK(iCLK_50),
<span style="color: #2&& .oRESET(CPU_RESET_N)
<span style="color: #3&);
<span style="color: #4&
<span style="color: #5&// NIOS II system
<span style="color: #6&nios_ii nios_ii0 (
<span style="color: #7&& // 1) global signals:
<span style="color: #8&& .clk_50(iCLK_50),
<span style="color: #9&& .pll_c0_system(CPU_CLK),
<span style="color: #0&& .pll_c1_memory(SRAM_CLK),
<span style="color: #1&& .pll_c2_audio(oAUD_XCK),
<span style="color: #2&& .reset_n(CPU_RESET_N),
<span style="color: #3&& .clk_25(iCLK_25),
<span style="color: #4&& // the_DM9000A_IF_0
<span style="color: #5&& .avs_s1_export_ENET_CLK_from_the_DM9000A(oENET_CLK),
<span style="color: #6&& .avs_s1_export_ENET_CMD_from_the_DM9000A(oENET_CMD),
<span style="color: #7&& .avs_s1_export_ENET_CS_N_from_the_DM9000A(oENET_CS_N),
<span style="color: #8&& .avs_s1_export_ENET_DATA_to_and_from_the_DM9000A(ENET_D),
<span style="color: #9&& .avs_s1_export_ENET_INT_to_the_DM9000A(iENET_INT),
<span style="color: #0&& .avs_s1_export_ENET_RD_N_from_the_DM9000A(oENET_IOR_N),
<span style="color: #1&& .avs_s1_export_ENET_RST_N_from_the_DM9000A(oENET_RESET_N),
<span style="color: #2&& .avs_s1_export_ENET_WR_N_from_the_DM9000A(oENET_IOW_N),
<span style="color: #3&& // the_ISP1362
<span style="color: #4&& .avs_hc_export_OTG_ADDR_from_the_ISP1362(oOTG_A),
<span style="color: #5&& .avs_hc_export_OTG_CS_N_from_the_ISP1362(oOTG_CS_N),
<span style="color: #6&& .avs_hc_export_OTG_DATA_to_and_from_the_ISP1362(OTG_D),
<span style="color: #7&& .avs_hc_export_OTG_INT0_to_the_ISP1362(iOTG_INT0),
<span style="color: #8&& .avs_hc_export_OTG_RD_N_from_the_ISP1362(oOTG_OE_N),
<span style="color: #9&& .avs_hc_export_OTG_RST_N_from_the_ISP1362(oOTG_RESET_N),
<span style="color: #0&& .avs_hc_export_OTG_WR_N_from_the_ISP1362(oOTG_WE_N),
<span style="color: #1&& .avs_dc_export_OTG_INT1_to_the_ISP1362(iOTG_INT1),
<span style="color: #2&& // the_audio
<span style="color: #3&& .avs_s1_export_BCLK_to_the_AUDIO(AUD_BCLK),
<span style="color: #4&& .avs_s1_export_DACLRC_to_the_AUDIO(AUD_DACLRCK),
<span style="color: #5&& .avs_s1_export_DACDAT_from_the_AUDIO(oAUD_DACDAT),
<span style="color: #6&& .avs_s1_export_ADCLRC_to_the_AUDIO(AUD_ADCLRCK),
<span style="color: #7&& .avs_s1_export_ADCDAT_to_the_AUDIO(iAUD_ADCDAT),
<span style="color: #8&& // the_i2c_sclk
<span style="color: #9&& .out_port_from_the_i2c_sclk(oI2C_SCLK),
<span style="color: #0&& // the_i2c_sdat
<span style="color: #1&& .bidir_port_to_and_from_the_i2c_sdat(I2C_SDAT),
<span style="color: #2&& // the_lcd
<span style="color: #3&& .LCD_E_from_the_lcd(oLCD_EN),
<span style="color: #4&& .LCD_RS_from_the_lcd(oLCD_RS),
<span style="color: #5&& .LCD_RW_from_the_lcd(oLCD_RW),
<span style="color: #6&& .LCD_data_to_and_from_the_lcd(LCD_D),
<span style="color: #7&& // the_pio_button
<span style="color: #8&& .in_port_to_the_pio_button(iKEY),
<span style="color: #9&& // the_pio_green_led
<span style="color: #0&& .out_port_from_the_pio_green_led(oLEDG),
<span style="color: #1&& // the_pio_red_led
<span style="color: #2&& .out_port_from_the_pio_red_led(oLEDR),
<span style="color: #3&& // the_seg7&
<span style="color: #4&& .avs_s1_export_seg7_from_the_SEG7({oHEX7_DP, oHEX7_D, oHEX6_DP, oHEX6_D, oHEX5_DP,
<span style="color: #5&&&& oHEX5_D, oHEX4_DP,oHEX4_D, oHEX3_DP, oHEX3_D, oHEX2_DP, oHEX2_D, oHEX1_DP, oHEX1_D,
<span style="color: #6&&&& oHEX0_DP, oHEX0_D}),
<span style="color: #7&& // the_pio_switch
<span style="color: #8&& .in_port_to_the_pio_switch(iSW),
<span style="color: #9&& // the_sd_clk
<span style="color: #0&& .out_port_from_the_sd_clk(oSD_CLK),
<span style="color: #1&& // the_sd_cmd
<span style="color: #2&& .bidir_port_to_and_from_the_sd_cmd(SD_CMD),
<span style="color: #3&& // the_sd_dat
<span style="color: #4&& .bidir_port_to_and_from_the_sd_dat(SD_DAT),
<span style="color: #5&& // the_sd_dat3
<span style="color: #6&& .bidir_port_to_and_from_the_sd_dat3(SD_DAT3),
<span style="color: #7&& // the_sdram (u1)
<span style="color: #8&& .zs_addr_from_the_sdram_u1(dram_a),
<span style="color: #9&& .zs_ba_from_the_sdram_u1(dram_ba),
<span style="color: #0&& .zs_cas_n_from_the_sdram_u1(dram_cas_n),
<span style="color: #1&& .zs_cke_from_the_sdram_u1(dram_cke),
<span style="color: #2&& .zs_cs_n_from_the_sdram_u1(dram_cs_n),
<span style="color: #3&& .zs_dq_to_and_from_the_sdram_u1(DRAM_DQ),
<span style="color: #4&& .zs_dqm_from_the_sdram_u1(dram_dqm),
<span style="color: #5&& .zs_ras_n_from_the_sdram_u1(dram_ras_n),
<span style="color: #6&& .zs_we_n_from_the_sdram_u1(dram_we_n),
<span style="color: #7&& // the_tristate_bridge_avalon_slave (flash)
<span style="color: #8&& .address_to_the_cfi_flash({oFLASH_A[<span style="color: #:<span style="color: #],FLASH_16BIT_IP_A0}),
<span style="color: #9&& .data_to_and_from_the_cfi_flash({FLASH_DQ15_AM1,FLASH_DQ}),
<span style="color: #0&& .read_n_to_the_cfi_flash(oFLASH_OE_N),
<span style="color: #1&& .select_n_to_the_cfi_flash(oFLASH_CE_N),
<span style="color: #2&& .write_n_to_the_cfi_flash(oFLASH_WE_N),
<span style="color: #3&& // the_tristate_bridge_1_avalon_slave (ssram)
<span style="color: #4&& .address_to_the_ssram({oSRAM_A[<span style="color: #:<span style="color: #],SRAM_DUMMY_ADDR}),
<span style="color: #5&& .adsc_n_to_the_ssram(oSRAM_ADSC_N),
<span style="color: #6&& .bw_n_to_the_ssram(oSRAM_BE_N),
<span style="color: #7&& .bwe_n_to_the_ssram(oSRAM_WE_N),
<span style="color: #8&& .chipenable1_n_to_the_ssram(oSRAM_CE1_N),
<span style="color: #9&& .data_to_and_from_the_ssram((SRAM_DQ)),
<span style="color: #0&& .outputenable_n_to_the_ssram(oSRAM_OE_N),
<span style="color: #1&& // the_uart
<span style="color: #2&& .cts_n_to_the_uart(oUART_CTS),
<span style="color: #3&& .rts_n_from_the_uart(iUART_RTS),
<span style="color: #4&& .rxd_to_the_uart(iUART_RXD),
<span style="color: #5&& .txd_from_the_uart(oUART_TXD),
<span style="color: #6&);
<span style="color: #7&
<span style="color: #8&endmodule
// the sdram is shahred with rtl and nios
wire [<span style="color: #:<span style="color: #] dram_a;
wire [<span style="color: #:<span style="color: #]& dram_
wire&&&&&&& dram_cas_n;
wire&&&&&&& dram_
wire&&&&&&& dram_cs_n;
wire [<span style="color: #:<span style="color: #]& dram_
wire&&&&&&& dram_ras_n;
wire&&&&&&& dram_we_n;
assign oDRAM0_CLK = SRAM_CLK;&&&&&&& // SDRAM0 Clock
assign oDRAM1_CLK = SRAM_CLK;&&&&&&& // SDRAM1 Clock
assign oDRAM0_A&&&& = dram_a;
assign oDRAM0_BA&&& = dram_
assign oDRAM0_CAS_N = dram_cas_n;
assign oDRAM0_CKE&& = dram_
assign oDRAM0_CS_N& = dram_cs_n;
assign oDRAM0_LDQM0 = dram_dqm[<span style="color: #];
assign oDRAM0_UDQM1 = dram_dqm[<span style="color: #];
assign oDRAM0_RAS_N = dram_ras_n;
assign oDRAM0_WE_N& = dram_we_n;
assign oDRAM1_A&&&& = dram_a;
assign oDRAM1_BA&&& = dram_
assign oDRAM1_CAS_N = dram_cas_n;
assign oDRAM1_CKE&& = dram_
assign oDRAM1_CS_N& = dram_cs_n;
assign oDRAM1_LDQM0 = dram_dqm[<span style="color: #];
assign oDRAM1_UDQM1 = dram_dqm[<span style="color: #];
assign oDRAM1_RAS_N = dram_ras_n;
assign oDRAM1_WE_N& = dram_we_n;
宣告從SOPC的SDRAM port所連出的wire,並且連到top module的SDRAM port。
關鍵在於DRAM_DQ是個inout [31:0],不能設成wire,必須要直接從SOPC接出來,我第一次就是這樣失敗的。
// the_sdram (u1)
.zs_addr_from_the_sdram_u1(dram_a),
.zs_ba_from_the_sdram_u1(dram_ba),
.zs_cas_n_from_the_sdram_u1(dram_cas_n),
.zs_cke_from_the_sdram_u1(dram_cke),
.zs_cs_n_from_the_sdram_u1(dram_cs_n),
.zs_dq_to_and_from_the_sdram_u1(DRAM_DQ),
.zs_dqm_from_the_sdram_u1(dram_dqm),
.zs_ras_n_from_the_sdram_u1(dram_ras_n),
.zs_we_n_from_the_sdram_u1(dram_we_n),
從SOPC的SDRAM port連出的wire。
證明這種方式的正確性
從三個方式來證明:
1.執行Hello World project template,並將Nios II程式跑在SDRAM上。
2.執行Hello MicroC/OS-II project template,並將Nios II程式跑在SDRAM上。
3.執行Memory Test project template,證明64MB SDRAM皆可正常存取。
1.Hello World
2.Hello MicroC/OS-II
3.Memory Test
儘管能順利的在SDRAM執行Hello World與Hello MicroC/OS-II,還是很令人擔心這種方式是否能正確的存取DE2-70的64MB SDRAM,為了客觀起見,我們使用了Nios II內建的Memory Test project template。
使用Memory Test project template
將Nios II跑在SSRAM
因為SDRAM即將接受測試,所以將Nios II程式跑在SSRAM上
執行Memory Test
因為要測試SDRAM,所以輸入a繼續。
接著要我們輸入要測試的memory起始位置與結束位置,該怎麼填呢?回想一下SOPC Builder怎麼對SDRAM定址。
根據SOPC Builder,0x為SDRAM的起始位置,0x07ffffff為結束位置。
證明64MB SDRAM通過測試。
完整程式碼下載
Conclusion
或許有些人喜歡將2顆SDRAM分開使用,甚至有人1顆SDRAM是掛在Avalon bus上,另外1顆直接使用Sdram_Control_4Port控制;這就類似有人喜歡一顆硬碟分割成好幾個磁區,也有人喜歡將好幾顆硬碟合併成一顆使用。不過以傳輸來說,既然Nios II CPU是32 bit,所有的ip都是32 bit,SDRAM的16 bit反而是傳輸上的瓶頸,透過本文雙通道的方式,將2顆16 bit SDRAM合併成1顆32 bit SDRAM使用,可以讓整個系統順暢的以32 bit運行,不再需要Avalon bus的Dynamic Bus Sizing機制,充分發揮DE2-70兩顆SDRAM的優勢。}

我要回帖

更多关于 特权和你一起学nios2 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信