(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ...

Abstract
很多人跑DE2本身的範例,都可以上μC/OS-II這個作業系統,但只要自己用SOPC Builder建立的Nios II系統,就無法上μC/OS-II,本文示範如何用SOPC Builder手動打造一個在DE2上能跑uC/OS-II的Nios II系統。

使用環境:Quartus II 7.2 SP1 + Nios II 7.2 SP1 + DE2(Cyclone II EP2C35F627C6) + μC/OS-II

Introduction
本文為我較早期的文章,雖然仍有參考價值,不過並非最佳的設計,建議您一併參考
(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統 (SRAM精簡版)? (SOC) (Quartus II) (Nios II) (SOPC Builder) (μC/OS-II) (DE2)

根據Altera原廠的資料,要讓Nios II上μC/OS-II,只要依照Using MicroC/OS-II RTOS with the Nios II Processor Tutorial這份資料照著做即可,不過這份資料有幾個問題:
1.這份資料是Altera為自己的開發版所寫的,儘管你照著步驟做,仍無法在DE2上執行。
2.他使用了已經編譯好的sof檔,若你主要是用於Nios II軟體的開發,可以採用這種方式。若你可能加入自己設計的硬體元件,則勢必重新編譯sof檔,很多人就是因為這樣而無法上μC/OS-II。

在(原創) 如何成功執行『Using μC/OS-II RTOS with the Nios II Processor Tutorial』? (中級) (IC Design) (Quartus II) (Nios II) (μC/OS-II)  中雖然克服了萬難讓Nios II上μC/OS-II了,不用總有個遺憾,為什麼只能用DE2原廠範例的DE2_SD_Card_Audio.sof呢?為什麼不能自己用SOPC Builder建立一個Nios II系統跑uC/OS-II呢?後來在Terasic原廠網站
http://www.terasic.com/downloads/cd-rom/de2/DE2_System_v1.4b.zip
中發現在這個目錄下
\DE2_demonstrations\SOPC_Builder\Reference_Design\DE2_NIOS\
有Terasic原廠所建議的Nios II硬體設計,經過一番研究後,整理出這份文件。

Solution
要讓Nios II軟體跑在on-chip memory並不是不可能,但DE2最多只能有49K的on-chip memory,所以若要讓軟體能跑,必須動一些最佳化的方式讓軟體盡量的小,在(原創) 如何在DE2執行Checksum Master範例 (中級) (IC Design) (DE2) (Quartus II) (Nios II) (SOPC Builder)用過幾個方式從軟體解決,有興趣的人可以參考,本篇主要是從硬體解決,直接將μC/OS-II跑在SRAM上。

Quartus II
使用Quartus II建立一個全新的project
Step 1:
建立一個新project

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第1张图片

Step 2:

 (原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第2张图片

按Next下一步。

Step 3:
輸入project路徑名稱、project名稱與top-level module名稱,按Next下一步

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第3张图片 

Step 4:
c:/DE2/hello_ucosii目錄尚未建立,是否建立此目錄,按Yes繼續

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第4张图片 

Step 5:
加入既有檔案,由於我們目前沒有任何檔案,所以按Next下一步

 (原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第5张图片

Step 6:
選擇FPGA型號,DE2用的是EP2C35F627C6,按Next下一步

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第6张图片 

Step 7:
EDA工具設定,不需額外設定,按Next下一步

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第7张图片 

Step 8:
最後的Summary,按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第8张图片 

SOPC Builder
使用SOPC Builder建立一個全新的Nios II系統
Step 1:
啟動SOPC Builder

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第9张图片

Step 2:
輸入System名稱:nios_ii,選擇Verilog

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第10张图片 

Step 3:
加入Nios II Processor
選擇左側Altera SOPC Builder->Nios II Processor,滑鼠按兩下加入

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第11张图片

使用預設的Nios II/f即可,按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第12张图片

Step 4:
加入SRAM
由於我們要將μC/OS-II放在SRAM跑,所以要加入SRAM controller,不過這裡有個值得注意的地方,你不能使用SOPC Builder所附的SRAM controller,必須改用Terasic本身所附的SRAM controller,將SRAM_16Bit_512K.7z下載,或者
http://www.terasic.com/downloads/cd-rom/de2/DE2_System_v1.4b.zip內的\DE2_demonstrations\SOPC_Builder\Component\SRAM_16Bit_512K
目錄複製到
C:\DE2\hello_ucosii\
複製完成後,請重新開啟SOPC Builder,就可以在左側的Altera SOPC Builder->Terasic Technologies Inc\發現SRAM_16Bit_512K這個contoller,滑鼠按兩下加入

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第13张图片

Step 5:
加入Tristate Bridge
由於SRAM需要連接到Tristate Bridge的slave,所以需要加入Tristate Bridge controller,在左側Altera SOPC Builder->Bridges and Adapters->Memoery Mapped下找到Avalon-MM Tristate Bridge,滑鼠按兩下加入

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第14张图片

按Finish即可,完成後如下圖出現了一個錯誤訊息:

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第15张图片

錯誤訊息表示Tristate Bridge的master必須接到一個slave裝置,所以加上一個Flash Memory controller連上Tristate Bridge。

Step 6:
加入Flash Memory controller
在左側Altera SOPC Builder->Memories and Memory Controllers->Flash下找到Flash Memory(CFI),按兩下加入,將Address Width(bits)改成22

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第16张图片

加入後,會如下圖,發現tristate_bridge的tristate_master仍然沒和cfi_flash相接:

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第17张图片

所以我們必須手動的接上去

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第18张图片

Step 7:
加入JTAG UART
由於我們需在console顯示文字,所以需要加上JTAG UART
在左側Altera SOPC Builder->Interface Protocols->Serial下找到JTAG UART,滑鼠點兩下加入,接受預設值即可,按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第19张图片

最後如下圖所示

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第20张图片

Step 8:
加入Interval Timer
由於μC/OS-II需要用到Internal Timer,所以需要加上。
在左側Altera SOPC Builder->Peripherals->Microcontroller Peripherals下找到Interval Timer,滑鼠點兩下加入,接受預設值即可,按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第21张图片

最後如下圖所示

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第22张图片

Step 9:
加入System ID Peripheral
System ID Peripheral可以用來辨識硬體,雖然沒有加入也能執行,不過Altera原廠手冊仍建議加入此controller。
在左側Altera SOPC Builder->Peripherals->Debug and Performance下找到System ID Peripheral,滑鼠點兩下加入,接受預設值即可,按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第23张图片

最後如下圖所示

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第24张图片

Step 10:
解決錯誤訊息
上圖最下面有幾個錯誤訊息

None.gif Error : cpu.instruction_master: " cpu.jtag_debug_module " (0x800..0xfff) overlaps " cfi_flash.s1 " (0x0..0x3fffff)
None.gifError : cpu.data_master:
" cpu.jtag_debug_module " (0x800..0xfff) overlaps " cfi_flash.s1 " (0x0..0x3fffff)
None.gifError : cpu.d_irq:Interrupt number conflict(jtag_uart
, timer.irg) on 0




None.gif Error : cpu.instruction_master: " cpu.jtag_debug_module " (0x800..0xfff) overlaps " cfi_flash.s1 " (0x0..0x3fffff)


點兩下,將Reset Vector選擇cfi_flash,Exception Vector選擇sram_16bit_512k_0,按Finish完成

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第25张图片

Step 11:
重新分配Base Address
Menu的System->Auto-Assign Base Address

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第26张图片

Step 12:
重新分配IRQ
Menu的System->Auto-Assign IRQs

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第27张图片

Step 13:
新增Clock Settings
將原本clk改成100.0 Mhz
另外加上clk_50為50.0 Mhz

至此,一個能跑μC/OS-II最小的Nios II系統已經完成,而且是我們DIY用SOPC Builder完成的,最後完成圖如下。

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第28张图片

最後按下Generate開始產生硬體,詢問是否儲存,按Save

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第29张图片

需要一些時間,完全看你CPU速度而定。

Quartus II Top Module
至此我們還缺Quartus II的Top Module,建立一個新的Verilog檔,名為hello_ucosii.v
hello_ucosii.v

1 None.gif module hello_ucosii (
2 ExpandedBlockStart.gifContractedBlock.gif  /**/ ////////////////////    Clock Input         ////////////////////    
3 None.gif     CLOCK_27,                        //     On Board 27 MHz
4 None.gif   CLOCK_50,                        //     On Board 50 MHz
5 None.gif     EXT_CLOCK,                        //     External Clock
6 ExpandedBlockStart.gifContractedBlock.gif     /**/ ////////////////////    Push Button        ////////////////////
7 None.gif     KEY,                            //     Pushbutton[3:0]
8 ExpandedBlockStart.gifContractedBlock.gif     /**/ ////////////////////    Flash Interface        ////////////////
9 None.gif     FL_DQ,                            //     FLASH Data bus 8 Bits
10 None.gif     FL_ADDR,                        //     FLASH Address bus 20 Bits
11 None.gif     FL_WE_N,                        //     FLASH Write Enable
12 None.gif     FL_RST_N,                        //     FLASH Reset
13 None.gif     FL_OE_N,                        //     FLASH Output Enable
14 None.gif     FL_CE_N,                        //     FLASH Chip Enable
15 ExpandedBlockStart.gifContractedBlock.gif     /**/ ////////////////////    SRAM Interface        ////////////////
16 None.gif     SRAM_DQ,                        //     SRAM Data bus 16 Bits
17 None.gif     SRAM_ADDR,                        //     SRAM Address bus 18 Bits
18 None.gif     SRAM_UB_N,                        //     SRAM High-byte Data Mask
19 None.gif     SRAM_LB_N,                        //     SRAM Low-byte Data Mask 
20 None.gif     SRAM_WE_N,                        //     SRAM Write Enable
21 None.gif     SRAM_CE_N,                        //     SRAM Chip Enable
22 None.gif     SRAM_OE_N                        //     SRAM Output Enable
23 None.gif );
24 None.gif
25 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Clock Input         ////////////////////////
26 None.gif input            CLOCK_27;                //     On Board 27 MHz
27 None.gif input            CLOCK_50;                //     On Board 50 MHz
28 None.gif input            EXT_CLOCK;                //     External Clock
29 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Push Button        ////////////////////////
30 None.gif input    [ 3 : 0 ]    KEY;                    //     Pushbutton[3:0]
31 None.gif
32 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Flash Interface    ////////////////////////
33 None.gif inout    [ 7 : 0 ]    FL_DQ;                    //     FLASH Data bus 8 Bits
34 None.gif output    [ 21 : 0 ]    FL_ADDR;                //     FLASH Address bus 22 Bits
35 None.gif output            FL_WE_N;                //     FLASH Write Enable
36 None.gif output            FL_RST_N;                //     FLASH Reset
37 None.gif output            FL_OE_N;                //     FLASH Output Enable
38 None.gif output            FL_CE_N;                //     FLASH Chip Enable
39 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    SRAM Interface    ////////////////////////
40 None.gif inout    [ 15 : 0 ]    SRAM_DQ;                //     SRAM Data bus 16 Bits
41 None.gif output    [ 17 : 0 ]    SRAM_ADDR;                //     SRAM Address bus 18 Bits
42 None.gif output            SRAM_UB_N;                //     SRAM Low-byte Data Mask
43 None.gif output            SRAM_LB_N;                //     SRAM High-byte Data Mask
44 None.gif output            SRAM_WE_N;                //     SRAM Write Enable
45 None.gif output            SRAM_CE_N;                //     SRAM Chip Enable
46 None.gif output            SRAM_OE_N;                //     SRAM Output Enable
47 None.gif
48 None.gifwire    CPU_CLK;
49 None.gifwire    CPU_RESET;
50 None.gifwire    CLK_18_4;
51 None.gifwire    CLK_25;
52 None.gif
53 None.gif //     Flash
54 None.gif assign    FL_RST_N    =     1 ' b1;
55 None.gif
56 None.gifReset_Delay    delay1    (.iRST(KEY[ 0 ]),.iCLK(CLOCK_50),.oRESET(CPU_RESET));
57 None.gif
58 None.gifSDRAM_PLL     PLL1    (.inclk0(CLOCK_50),.c0(DRAM_CLK),.c1(CPU_CLK),.c2(CLK_25));
59 None.gif
60 None.gifnios_ii u0    (
61 None.gif  // 1) global signals:
62 None.gif   .clk(CPU_CLK),
63 None.gif    .reset_n(CPU_RESET),
64 None.gif   
65 None.gif  // the_sram_0
66 None.gif   .SRAM_ADDR_from_the_sram_16bit_512k_0(SRAM_ADDR),
67 None.gif  .SRAM_CE_N_from_the_sram_16bit_512k_0(SRAM_CE_N),
68 None.gif  .SRAM_DQ_to_and_from_the_sram_16bit_512k_0(SRAM_DQ),
69 None.gif  .SRAM_LB_N_from_the_sram_16bit_512k_0(SRAM_LB_N),
70 None.gif  .SRAM_OE_N_from_the_sram_16bit_512k_0(SRAM_OE_N),
71 None.gif  .SRAM_UB_N_from_the_sram_16bit_512k_0(SRAM_UB_N),
72 None.gif  .SRAM_WE_N_from_the_sram_16bit_512k_0(SRAM_WE_N),
73 None.gif           
74 None.gif   // the_tri_state_bridge_0_avalon_slave
75 None.gif    .select_n_to_the_cfi_flash(FL_CE_N),
76 None.gif   .address_to_the_cfi_flash(FL_ADDR),
77 None.gif   .data_to_and_from_the_cfi_flash(FL_DQ),
78 None.gif   .read_n_to_the_cfi_flash(FL_OE_N),
79 None.gif   .write_n_to_the_cfi_flash(FL_WE_N)
80 None.gif);
81 None.gif
82 None.gifendmodule


56行的Reset_Dealy module和SDRAM_PLL module,我們須自己建立。
Reset_Delay.v

1 None.gif module    Reset_Delay(iRST,iCLK,oRESET);
2 None.gifinput        iCLK;
3 None.gifinput        iRST;
4 None.gifoutput reg    oRESET;
5 None.gifreg    [ 23 : 0 ]    Cont;
6 None.gif
7 None.gifalways@(posedge iCLK or negedge iRST)
8 None.gifbegin
9 None.gif    if ( ! iRST)
10 None.gif    begin
11 None.gif        oRESET    <=     1 ' b0;
12 None.gif         Cont    <=     24 ' h0000000;
13 None.gif     end
14 None.gif    else
15 None.gif    begin
16 None.gif        if (Cont != 24 ' hFFFFFF)
17 None.gif         begin
18 None.gif            Cont    <=     Cont + 1 ;
19 None.gif            oRESET    <=     1 ' b0;
20 None.gif         end
21 None.gif        else
22 None.gif        oRESET    <=     1 ' b1;
23 None.gif     end
24 None.gifend
25 None.gif
26 None.gifendmodule


SDRAM_PLL.v

  1 None.gif // megafunction wizard: %ALTPLL%
  2 None.gif // GENERATION: STANDARD
  3 None.gif // VERSION: WM1.0
  4 None.gif // MODULE: altpll
  5 None.gif
  6 None.gif // ============================================================
  7 None.gif // File Name: SDRAM_PLL.v
  8 None.gif // Megafunction Name(s):
  9 None.gif //              altpll
10 None.gif // ============================================================
11 None.gif // ************************************************************
12 None.gif // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
13 None.gif //
14 None.gif // 6.0 Build 202 06/20/2006 SP 1 SJ Full Version
15 None.gif // ************************************************************
16 None.gif
17 None.gif
18 None.gif // Copyright (C) 1991-2006 Altera Corporation
19 None.gif // Your use of Altera Corporation's design tools, logic functions
20 None.gif // and other software and tools, and its AMPP partner logic
21 None.gif // functions, and any output files any of the foregoing
22 None.gif // (including device programming or simulation files), and any
23 None.gif // associated documentation or information are expressly subject
24 None.gif // to the terms and conditions of the Altera Program License
25 None.gif // Subscription Agreement, Altera MegaCore Function License
26 None.gif // Agreement, or other applicable license agreement, including,
27 None.gif // without limitation, that your use is for the sole purpose of
28 None.gif // programming logic devices manufactured by Altera and sold by
29 None.gif // Altera or its authorized distributors.  Please refer to the
30 None.gif // applicable agreement for further details.
31 None.gif
32 None.gif
33 None.gif // synopsys translate_off
34 None.gif `timescale 1 ps /   1 ps
35 None.gif // synopsys translate_on
36 None.gif module SDRAM_PLL (
37 None.gif    inclk0,
38 None.gif    c0,
39 None.gif    c1,
40 None.gif    c2);
41 None.gif
42 None.gif    input      inclk0;
43 None.gif    output      c0;
44 None.gif    output      c1;
45 None.gif    output      c2;
46 None.gif
47 None.gif    wire [ 5 : 0 ] sub_wire0;
48 None.gif    wire [ 0 : 0 ] sub_wire6 =   1 ' h0;
49 None.gif     wire [ 2 : 2 ] sub_wire3 = sub_wire0[ 2 : 2 ];
50 None.gif    wire [ 1 : 1 ] sub_wire2 = sub_wire0[ 1 : 1 ];
51 None.gif    wire [ 0 : 0 ] sub_wire1 = sub_wire0[ 0 : 0 ];
52 None.gif    wire  c0 = sub_wire1;
53 None.gif    wire  c1 = sub_wire2;
54 None.gif    wire  c2 = sub_wire3;
55 None.gif    wire  sub_wire4 = inclk0;
56 ExpandedBlockStart.gifContractedBlock.gif    wire [ 1 : 0 ] sub_wire5 =   dot.gif {sub_wire6, sub_wire4} ;
57 None.gif
58 None.gif    altpll    altpll_component (
59 None.gif                .inclk (sub_wire5),
60 None.gif                .clk (sub_wire0),
61 None.gif                .activeclock (),
62 None.gif                .areset ( 1 ' b0),
63 None.gif                 .clkbad (),
64 ExpandedBlockStart.gifContractedBlock.gif                .clkena ( dot.gif {6dot.gif{1'b1}}),
65InBlock.gif                .clkloss (),
66InBlock.gif                .clkswitch (1'b0),
67InBlock.gif                .enable0 (),
68InBlock.gif                .enable1 (),
69InBlock.gif                .extclk (),
70ExpandedSubBlockStart.gifContractedSubBlock.gif                .extclkena (dot.gif{4dot.gif{1'b1}}),
71InBlock.gif                .fbin (1'b1),
72InBlock.gif                .locked (),
73InBlock.gif                .pfdena (1'b1),
74InBlock.gif                .pllena (1'b1),
75InBlock.gif                .scanaclr (1'b0),
76InBlock.gif                .scanclk (1'b0),
77InBlock.gif                .scandata (1'b0),
78InBlock.gif                .scandataout (),
79InBlock.gif                .scandone (),
80InBlock.gif                .scanread (1'b0),
81InBlock.gif                .scanwrite (1'b0),
82InBlock.gif                .sclkout0 (),
83InBlock.gif                .sclkout1 ());
84InBlock.gif    defparam
85InBlock.gif        altpll_component.clk0_divide_by = 1,
86InBlock.gif        altpll_component.clk0_duty_cycle = 50,
87InBlock.gif        altpll_component.clk0_multiply_by = 1,
88InBlock.gif        altpll_component.clk0_phase_shift = "-3000",
89InBlock.gif        altpll_component.clk1_divide_by = 1,
90InBlock.gif        altpll_component.clk1_duty_cycle = 50,
91InBlock.gif        altpll_component.clk1_multiply_by = 2,
92InBlock.gif        altpll_component.clk1_phase_shift = "0",
93InBlock.gif        altpll_component.clk2_divide_by = 2,
94InBlock.gif        altpll_component.clk2_duty_cycle = 50,
95InBlock.gif        altpll_component.clk2_multiply_by = 1,
96InBlock.gif        altpll_component.clk2_phase_shift = "0",
97InBlock.gif        altpll_component.compensate_clock = "CLK0",
98InBlock.gif        altpll_component.inclk0_input_frequency = 20000,
99InBlock.gif        altpll_component.intended_device_family = "Cyclone II",
100InBlock.gif        altpll_component.lpm_type = "altpll",
101InBlock.gif        altpll_component.operation_mode = "NORMAL",
102InBlock.gif        altpll_component.pll_type = "FAST",
103InBlock.gif        altpll_component.port_activeclock = "PORT_UNUSED",
104InBlock.gif        altpll_component.port_areset = "PORT_UNUSED",
105InBlock.gif        altpll_component.port_clkbad0 = "PORT_UNUSED",
106InBlock.gif        altpll_component.port_clkbad1 = "PORT_UNUSED",
107InBlock.gif        altpll_component.port_clkloss = "PORT_UNUSED",
108InBlock.gif        altpll_component.port_clkswitch = "PORT_UNUSED",
109InBlock.gif        altpll_component.port_fbin = "PORT_UNUSED",
110InBlock.gif        altpll_component.port_inclk0 = "PORT_USED",
111InBlock.gif        altpll_component.port_inclk1 = "PORT_UNUSED",
112InBlock.gif        altpll_component.port_locked = "PORT_UNUSED",
113InBlock.gif        altpll_component.port_pfdena = "PORT_UNUSED",
114InBlock.gif        altpll_component.port_pllena = "PORT_UNUSED",
115InBlock.gif        altpll_component.port_scanaclr = "PORT_UNUSED",
116InBlock.gif        altpll_component.port_scanclk = "PORT_UNUSED",
117InBlock.gif        altpll_component.port_scandata = "PORT_UNUSED",
118InBlock.gif        altpll_component.port_scandataout = "PORT_UNUSED",
119InBlock.gif        altpll_component.port_scandone = "PORT_UNUSED",
120InBlock.gif        altpll_component.port_scanread = "PORT_UNUSED",
121InBlock.gif        altpll_component.port_scanwrite = "PORT_UNUSED",
122InBlock.gif        altpll_component.port_clk0 = "PORT_USED",
123InBlock.gif        altpll_component.port_clk1 = "PORT_USED",
124InBlock.gif        altpll_component.port_clk2 = "PORT_USED",
125InBlock.gif        altpll_component.port_clk3 = "PORT_UNUSED",
126InBlock.gif        altpll_component.port_clk4 = "PORT_UNUSED",
127InBlock.gif        altpll_component.port_clk5 = "PORT_UNUSED",
128InBlock.gif        altpll_component.port_clkena0 = "PORT_UNUSED",
129InBlock.gif        altpll_component.port_clkena1 = "PORT_UNUSED",
130InBlock.gif        altpll_component.port_clkena2 = "PORT_UNUSED",
131InBlock.gif        altpll_component.port_clkena3 = "PORT_UNUSED",
132InBlock.gif        altpll_component.port_clkena4 = "PORT_UNUSED",
133InBlock.gif        altpll_component.port_clkena5 = "PORT_UNUSED",
134InBlock.gif        altpll_component.port_enable0 = "PORT_UNUSED",
135InBlock.gif        altpll_component.port_enable1 = "PORT_UNUSED",
136InBlock.gif        altpll_component.port_extclk0 = "PORT_UNUSED",
137InBlock.gif        altpll_component.port_extclk1 = "PORT_UNUSED",
138InBlock.gif        altpll_component.port_extclk2 = "PORT_UNUSED",
139InBlock.gif        altpll_component.port_extclk3 = "PORT_UNUSED",
140InBlock.gif        altpll_component.port_extclkena0 = "PORT_UNUSED",
141InBlock.gif        altpll_component.port_extclkena1 = "PORT_UNUSED",
142InBlock.gif        altpll_component.port_extclkena2 = "PORT_UNUSED",
143InBlock.gif        altpll_component.port_extclkena3 = "PORT_UNUSED",
144InBlock.gif        altpll_component.port_sclkout0 = "PORT_UNUSED",
145InBlock.gif        altpll_component.port_sclkout1 = "PORT_UNUSED";
146InBlock.gif
147InBlock.gif
148InBlock.gifendmodule
149InBlock.gif
150InBlock.gif// ============================================================
151InBlock.gif// CNX file retrieval info
152InBlock.gif// ============================================================
153InBlock.gif// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
154InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
155InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "0"
156InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
157InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low"
158InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1"
159InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_USE_CUSTOM STRING "0"
160InBlock.gif// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0"
161InBlock.gif// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0"
162InBlock.gif// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0"
163InBlock.gif// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "1"
164InBlock.gif// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0"
165InBlock.gif// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
166InBlock.gif// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
167InBlock.gif// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
168InBlock.gif// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "e0"
169InBlock.gif// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "Any"
170InBlock.gif// Retrieval info: PRIVATE: DEV_FAMILY STRING "Cyclone II"
171InBlock.gif// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1"
172InBlock.gif// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "2"
173InBlock.gif// Retrieval info: PRIVATE: DIV_FACTOR2 NUMERIC "1"
174InBlock.gif// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
175InBlock.gif// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
176InBlock.gif// Retrieval info: PRIVATE: DUTY_CYCLE2 STRING "50.00000000"
177InBlock.gif// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
178InBlock.gif// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
179InBlock.gif// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "1"
180InBlock.gif// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
181InBlock.gif// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
182InBlock.gif// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
183InBlock.gif// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "50.000"
184InBlock.gif// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
185InBlock.gif// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "50.000"
186InBlock.gif// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
187InBlock.gif// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
188InBlock.gif// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
189InBlock.gif// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1"
190InBlock.gif// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "0"
191InBlock.gif// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1"
192InBlock.gif// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
193InBlock.gif// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
194InBlock.gif// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
195InBlock.gif// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "ps"
196InBlock.gif// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT2 STRING "ps"
197InBlock.gif// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
198InBlock.gif// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
199InBlock.gif// Retrieval info: PRIVATE: MIRROR_CLK2 STRING "0"
200InBlock.gif// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "1"
201InBlock.gif// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "1"
202InBlock.gif// Retrieval info: PRIVATE: MULT_FACTOR2 NUMERIC "1"
203InBlock.gif// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1"
204InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "50.00000000"
205InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000"
206InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ2 STRING "25.00000000"
207InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "1"
208InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "1"
209InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE2 STRING "1"
210InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
211InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
212InBlock.gif// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT2 STRING "MHz"
213InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "-3.00000000"
214InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
215InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT2 STRING "0.00000000"
216InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "ns"
217InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "ps"
218InBlock.gif// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT2 STRING "ps"
219InBlock.gif// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
220InBlock.gif// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "0"
221InBlock.gif// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
222InBlock.gif// Retrieval info: PRIVATE: PLL_ENA_CHECK STRING "0"
223InBlock.gif// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0"
224InBlock.gif// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0"
225InBlock.gif// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0"
226InBlock.gif// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
227InBlock.gif// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
228InBlock.gif// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
229InBlock.gif// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
230InBlock.gif// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "0"
231InBlock.gif// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
232InBlock.gif// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
233InBlock.gif// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0"
234InBlock.gif// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000"
235InBlock.gif// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
236InBlock.gif// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
237InBlock.gif// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
238InBlock.gif// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0"
239InBlock.gif// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
240InBlock.gif// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
241InBlock.gif// Retrieval info: PRIVATE: STICKY_CLK2 STRING "1"
242InBlock.gif// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
243InBlock.gif// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
244InBlock.gif// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
245InBlock.gif// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
246InBlock.gif// Retrieval info: PRIVATE: USE_CLK2 STRING "1"
247InBlock.gif// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
248InBlock.gif// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
249InBlock.gif// Retrieval info: PRIVATE: USE_CLKENA2 STRING "0"
250InBlock.gif// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
251InBlock.gif// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
252InBlock.gif// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1"
253InBlock.gif// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
254InBlock.gif// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "1"
255InBlock.gif// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "-3000"
256InBlock.gif// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1"
257InBlock.gif// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
258InBlock.gif// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "2"
259InBlock.gif// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
260InBlock.gif// Retrieval info: CONSTANT: CLK2_DIVIDE_BY NUMERIC "2"
261InBlock.gif// Retrieval info: CONSTANT: CLK2_DUTY_CYCLE NUMERIC "50"
262InBlock.gif// Retrieval info: CONSTANT: CLK2_MULTIPLY_BY NUMERIC "1"
263InBlock.gif// Retrieval info: CONSTANT: CLK2_PHASE_SHIFT STRING "0"
264InBlock.gif// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
265InBlock.gif// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "20000"
266InBlock.gif// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone II"
267InBlock.gif// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
268InBlock.gif// Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL"
269InBlock.gif// Retrieval info: CONSTANT: PLL_TYPE STRING "FAST"
270InBlock.gif// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
271InBlock.gif// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_UNUSED"
272InBlock.gif// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
273InBlock.gif// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
274InBlock.gif// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
275InBlock.gif// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
276InBlock.gif// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
277InBlock.gif// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
278InBlock.gif// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
279InBlock.gif// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_UNUSED"
280InBlock.gif// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
281InBlock.gif// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
282InBlock.gif// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
283InBlock.gif// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
284InBlock.gif// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
285InBlock.gif// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
286InBlock.gif// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
287InBlock.gif// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
288InBlock.gif// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
289InBlock.gif// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
290InBlock.gif// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
291InBlock.gif// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_USED"
292InBlock.gif// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
293InBlock.gif// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
294InBlock.gif// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED"
295InBlock.gif// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED"
296InBlock.gif// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED"
297InBlock.gif// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED"
298InBlock.gif// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED"
299InBlock.gif// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED"
300InBlock.gif// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED"
301InBlock.gif// Retrieval info: CONSTANT: PORT_enable0 STRING "PORT_UNUSED"
302InBlock.gif// Retrieval info: CONSTANT: PORT_enable1 STRING "PORT_UNUSED"
303InBlock.gif// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED"
304InBlock.gif// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
305InBlock.gif// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
306InBlock.gif// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
307InBlock.gif// Retrieval info: CONSTANT: PORT_extclkena0 STRING "PORT_UNUSED"
308InBlock.gif// Retrieval info: CONSTANT: PORT_extclkena1 STRING "PORT_UNUSED"
309InBlock.gif// Retrieval info: CONSTANT: PORT_extclkena2 STRING "PORT_UNUSED"
310InBlock.gif// Retrieval info: CONSTANT: PORT_extclkena3 STRING "PORT_UNUSED"
311InBlock.gif// Retrieval info: CONSTANT: PORT_sclkout0 STRING "PORT_UNUSED"
312InBlock.gif// Retrieval info: CONSTANT: PORT_sclkout1 STRING "PORT_UNUSED"
313InBlock.gif// Retrieval info: USED_PORT: @clk 0 0 6 0 OUTPUT_CLK_EXT VCC "@clk[5..0]"
314InBlock.gif// Retrieval info: USED_PORT: @extclk 0 0 4 0 OUTPUT_CLK_EXT VCC "@extclk[3..0]"
315InBlock.gif// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
316InBlock.gif// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
317InBlock.gif// Retrieval info: USED_PORT: c2 0 0 0 0 OUTPUT_CLK_EXT VCC "c2"
318InBlock.gif// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
319InBlock.gif// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
320InBlock.gif// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
321InBlock.gif// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
322InBlock.gif// Retrieval info: CONNECT: c2 0 0 0 0 @clk 0 0 1 2
323InBlock.gif// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
324InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL.v TRUE FALSE
325InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL.inc FALSE FALSE
326InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL.cmp FALSE FALSE
327InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL.bsf FALSE FALSE
328InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL_inst.v FALSE FALSE
329InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL_bb.v FALSE FALSE
330InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL_waveforms.html FALSE FALSE
331InBlock.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL_wave*.jpg FALSE FALSE
332ExpandedBlockEnd.gif// Retrieval info: GEN_FILE: TYPE_NORMAL SDRAM_PLL.ppf TRUE FALSE


你一定會問,為什麼還要自己加上Reset_Delay.v和SDRAM_PLL.v,明明我只用到SRAM,卻還要用到SDRAM的pll?

這是參考友晶科技reference design的作法,所以加上Reset_Delay.v和SDRAM_PLL.v。

先談SDRAM_PLL.v,這是由MegaWizard透過MegaCore產生出來的code,主要有三個功能,c0產生SDRAM所需要的50MHz相位延遲60度的clock,c1產生100MHz給Nios II CPU使用,c2產生除頻的25MHz,由於要讓Nios II CPU跑100MHz,所以才動用SDRAM_PLL.v。

Reset_Delay.v則是延緩reset的時間,詳細理由我還不清楚。

根據實驗,若你願意只讓Nios II CPU只跑50MHz,的確可以不加SDRAM_PLL.v和Reset_Delay.v,依然可以正常運作。
hello_ucosii.v

 1 None.gif module hello_ucosii (
 2 ExpandedBlockStart.gifContractedBlock.gif   /**/ ////////////////////    Clock Input         ////////////////////     
 3 None.gif     CLOCK_27,                          //     On Board 27 MHz
 4 None.gif   CLOCK_50,                          //     On Board 50 MHz
 5 None.gif     EXT_CLOCK,                    //     External Clock
 6 ExpandedBlockStart.gifContractedBlock.gif      /**/ ////////////////////    Push Button        ////////////////////
 7 None.gif     KEY,                                //     Pushbutton[3:0]
 8 ExpandedBlockStart.gifContractedBlock.gif      /**/ ////////////////////    Flash Interface        ////////////////
 9 None.gif     FL_DQ,                              //     FLASH Data bus 8 Bits
10 None.gif     FL_ADDR,                          //     FLASH Address bus 20 Bits
11 None.gif     FL_WE_N,                          //     FLASH Write Enable
12 None.gif     FL_RST_N,                          //     FLASH Reset
13 None.gif     FL_OE_N,                          //     FLASH Output Enable
14 None.gif     FL_CE_N,                          //     FLASH Chip Enable
15 ExpandedBlockStart.gifContractedBlock.gif      /**/ ////////////////////    SRAM Interface        ////////////////
16 None.gif     SRAM_DQ,                          //     SRAM Data bus 16 Bits
17 None.gif     SRAM_ADDR,                      //     SRAM Address bus 18 Bits
18 None.gif     SRAM_UB_N,                      //     SRAM High-byte Data Mask
19 None.gif     SRAM_LB_N,                      //     SRAM Low-byte Data Mask  
20 None.gif     SRAM_WE_N,                      //     SRAM Write Enable
21 None.gif     SRAM_CE_N,                      //     SRAM Chip Enable
22 None.gif     SRAM_OE_N                          //     SRAM Output Enable
23 None.gif );
24 None.gif
25 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Clock Input         ////////////////////////
26 None.gif input              CLOCK_27;      //     On Board 27 MHz
27 None.gif input              CLOCK_50;      //     On Board 50 MHz
28 None.gif input              EXT_CLOCK;  //     External Clock
29 None.gif
30 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Push Button        ////////////////////////
31 None.gif input     [ 3 : 0 ]    KEY;         //     Pushbutton[3:0]
32 None.gif
33 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    Flash Interface    ////////////////////////
34 None.gif inout     [ 7 : 0 ]    FL_DQ;         //     FLASH Data bus 8 Bits
35 None.gif output [ 21 : 0 ]    FL_ADDR;     //     FLASH Address bus 22 Bits
36 None.gif output              FL_WE_N;     //     FLASH Write Enable
37 None.gif output              FL_RST_N;     //     FLASH Reset
38 None.gif output              FL_OE_N;     //     FLASH Output Enable
39 None.gif output              FL_CE_N;     //     FLASH Chip Enable
40 None.gif
41 ExpandedBlockStart.gifContractedBlock.gif /**/ ////////////////////////    SRAM Interface    ////////////////////////
42 None.gif inout     [ 15 : 0 ]    SRAM_DQ;         //     SRAM Data bus 16 Bits
43 None.gif output [ 17 : 0 ]    SRAM_ADDR;     //     SRAM Address bus 18 Bits
44 None.gif output              SRAM_UB_N;     //     SRAM Low-byte Data Mask 
45 None.gif output              SRAM_LB_N;     //     SRAM High-byte Data Mask 
46 None.gif output              SRAM_WE_N;   //     SRAM Write Enable
47 None.gif output              SRAM_CE_N;     //     SRAM Chip Enable
48 None.gif output              SRAM_OE_N;     //     SRAM Output Enable
49 None.gif
50 None.gif //     Flash
51 None.gif assign    FL_RST_N     =      1 ' b1;
52 None.gif
53 None.gifnios_ii u0    (
54 None.gif   //  1) global signals:
55 None.gif   .clk(CPU_CLK),
56 None.gif    .reset_n(KEY[ 0 ]),
57 None.gif    
58 None.gif   //  the_sram_0
59 None.gif   .SRAM_ADDR_from_the_sram_16bit_512k_0(SRAM_ADDR),
60 None.gif  .SRAM_CE_N_from_the_sram_16bit_512k_0(SRAM_CE_N),
61 None.gif  .SRAM_DQ_to_and_from_the_sram_16bit_512k_0(SRAM_DQ),
62 None.gif  .SRAM_LB_N_from_the_sram_16bit_512k_0(SRAM_LB_N),
63 None.gif  .SRAM_OE_N_from_the_sram_16bit_512k_0(SRAM_OE_N),
64 None.gif  .SRAM_UB_N_from_the_sram_16bit_512k_0(SRAM_UB_N),
65 None.gif  .SRAM_WE_N_from_the_sram_16bit_512k_0(SRAM_WE_N),
66 None.gif            
67 None.gif    //  the_tri_state_bridge_0_avalon_slave
68 None.gif    .select_n_to_the_cfi_flash(FL_CE_N),
69 None.gif   .address_to_the_cfi_flash(FL_ADDR),
70 None.gif   .data_to_and_from_the_cfi_flash(FL_DQ),
71 None.gif   .read_n_to_the_cfi_flash(FL_OE_N),
72 None.gif   .write_n_to_the_cfi_flash(FL_WE_N)
73 None.gif);
74 None.gif
75 None.gifendmodule


處理pin腳
Step 1:
pins.tcl

1 None.gif cmp add_assignment " hello_ucosii "   ""   " CLOCK_27 "   " LOCATION "   " PIN_D13 "
2 None.gifcmp add_assignment " hello_ucosii "   ""   " CLOCK_50 "   " LOCATION "   " PIN_N2 "
3 None.gifcmp add_assignment " hello_ucosii "   ""   " EXT_CLOCK "   " LOCATION "   " PIN_N26 "
4 None.gifcmp add_assignment " hello_ucosii "   ""   " EXT_CLOCK "   " LOCATION "   " PIN_N26 "
5 None.gifcmp add_assignment " hello_ucosii "   ""   " KEY[0] "   " LOCATION "   " PIN_G26 "
6 None.gifcmp add_assignment " hello_ucosii "   ""   " KEY[1] "   " LOCATION "   " PIN_N23 "
7 None.gifcmp add_assignment " hello_ucosii "   ""   " KEY[2] "   " LOCATION "   " PIN_P23 "
8 None.gifcmp add_assignment " hello_ucosii "   ""   " KEY[3] "   " LOCATION "   " PIN_W26 "
9 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[0] "   " LOCATION "   " PIN_AE4 "
10 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[1] "   " LOCATION "   " PIN_AF4 "
11 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[2] "   " LOCATION "   " PIN_AC5 "
12 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[3] "   " LOCATION "   " PIN_AC6 "
13 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[4] "   " LOCATION "   " PIN_AD4 "
14 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[5] "   " LOCATION "   " PIN_AD5 "
15 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[6] "   " LOCATION "   " PIN_AE5 "
16 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[7] "   " LOCATION "   " PIN_AF5 "
17 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[8] "   " LOCATION "   " PIN_AD6 "
18 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[9] "   " LOCATION "   " PIN_AD7 "
19 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[10] "   " LOCATION "   " PIN_V10 "
20 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[11] "   " LOCATION "   " PIN_V9 "
21 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[12] "   " LOCATION "   " PIN_AC7 "
22 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[13] "   " LOCATION "   " PIN_W8 "
23 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[14] "   " LOCATION "   " PIN_W10 "
24 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[15] "   " LOCATION "   " PIN_Y10 "
25 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[16] "   " LOCATION "   " PIN_AB8 "
26 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_ADDR[17] "   " LOCATION "   " PIN_AC8 "
27 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_CE_N "   " LOCATION "   " PIN_AC11 "
28 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[0] "   " LOCATION "   " PIN_AD8 "
29 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[1] "   " LOCATION "   " PIN_AE6 "
30 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[2] "   " LOCATION "   " PIN_AF6 "
31 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[3] "   " LOCATION "   " PIN_AA9 "
32 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[4] "   " LOCATION "   " PIN_AA10 "
33 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[5] "   " LOCATION "   " PIN_AB10 "
34 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[6] "   " LOCATION "   " PIN_AA11 "
35 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[7] "   " LOCATION "   " PIN_Y11 "
36 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[8] "   " LOCATION "   " PIN_AE7 "
37 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[9] "   " LOCATION "   " PIN_AF7 "
38 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[10] "   " LOCATION "   " PIN_AE8 "
39 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[11] "   " LOCATION "   " PIN_AF8 "
40 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[12] "   " LOCATION "   " PIN_W11 "
41 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[13] "   " LOCATION "   " PIN_W12 "
42 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[14] "   " LOCATION "   " PIN_AC9 "
43 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_DQ[15] "   " LOCATION "   " PIN_AC10 "
44 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_LB_N "   " LOCATION "   " PIN_AE9 "
45 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_OE_N "   " LOCATION "   " PIN_AD10 "
46 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_UB_N "   " LOCATION "   " PIN_AF9 "
47 None.gifcmp add_assignment " hello_ucosii "   ""   " SRAM_WE_N "   " LOCATION "   " PIN_AE10 "
48 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_CE_N "   " LOCATION "   " PIN_V17 "
49 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[0] "   " LOCATION "   " PIN_AC18 "
50 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[1] "   " LOCATION "   " PIN_AB18 "
51 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[2] "   " LOCATION "   " PIN_AE19 "
52 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[3] "   " LOCATION "   " PIN_AF19 "
53 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[4] "   " LOCATION "   " PIN_AE18 "
54 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[5] "   " LOCATION "   " PIN_AF18 "
55 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[6] "   " LOCATION "   " PIN_Y16 "
56 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[7] "   " LOCATION "   " PIN_AA16 "
57 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[8] "   " LOCATION "   " PIN_AD17 "
58 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[9] "   " LOCATION "   " PIN_AC17 "
59 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[10] "   " LOCATION "   " PIN_AE17 "
60 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[11] "   " LOCATION "   " PIN_AF17 "
61 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[12] "   " LOCATION "   " PIN_W16 "
62 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[13] "   " LOCATION "   " PIN_W15 "
63 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[14] "   " LOCATION "   " PIN_AC16 "
64 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[15] "   " LOCATION "   " PIN_AD16 "
65 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[16] "   " LOCATION "   " PIN_AE16 "
66 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[17] "   " LOCATION "   " PIN_AC15 "
67 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[18] "   " LOCATION "   " PIN_AB15 "
68 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[19] "   " LOCATION "   " PIN_AA15 "
69 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[20] "   " LOCATION "   " PIN_Y15 "
70 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_ADDR[21] "   " LOCATION "   " PIN_Y14 "
71 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[0] "   " LOCATION "   " PIN_AD19 "
72 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[1] "   " LOCATION "   " PIN_AC19 "
73 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[2] "   " LOCATION "   " PIN_AF20 "
74 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[3] "   " LOCATION "   " PIN_AE20 "
75 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[4] "   " LOCATION "   " PIN_AB20 "
76 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[5] "   " LOCATION "   " PIN_AC20 "
77 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[6] "   " LOCATION "   " PIN_AF21 "
78 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_DQ[7] "   " LOCATION "   " PIN_AE21 "
79 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_OE_N "   " LOCATION "   " PIN_W17 "
80 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_WE_N "   " LOCATION "   " PIN_AA17 "
81 None.gifcmp add_assignment " hello_ucosii "   ""   " FL_RST_N "   " LOCATION "   " PIN_AA18 "


在View->Utility Windows->Tcl Console出現Tcl Console
輸入

None.gif source pins.tcl


Step 2:
將沒用到的pin設為tri-state
Menu的Assignment->Device..

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第30张图片

按下Device and Pin Options..
選擇Unused Pins tab,將Reserve all unused pins設為 As input tri-stated

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第31张图片

至此,Quartus II部分已經完成,可以開始編譯產生.sof檔,這需要很久的時間,完全看你CPU速度而定,編譯完成後燒將hello_ucosii.sof燒進DE2。

Nios II IDE
Step 1:

建立Hello MicroC/OS-II project
Menu:File->New->Nios II C/C++ Application

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第32张图片

Step 2:
選擇Hello MicroC/OS-II template,講指定nios_ii.ptf路徑,完成按Finish

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第33张图片

Step 3:
執行hello_ucosii_0
選著hello_ucosii_0 project,右鍵Run As->Nios II Hardware

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第34张图片

最後執行結果,表示μC/OS-II順利執行

(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ..._第35张图片

完整程式碼下載
hello_ucosii_sram_big.7z (含SDRAM_PLL.v和Reset_Delay.v)
hello_ucosii_sram_small.7z (不含SDRAM_PLL.v和Reset_Delay.v)

Conclusion
DE2和Altera原廠的版子還是有些差異,很多Altera官方的文件並不適用,在本文又再次證明了這個事實。

See Also
(原創) DE2_NIOS_Lite 1.0 (SOC) (Nios II) (SOPC Builder) (DE2)
(原創) DE2_NIOS_Lite 1.1 (SOC) (Nios II) (SOPC Builder) (μC/OS-II) (DE2)
(原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統 (SRAM精簡版)? (SOC) (Quartus II) (Nios II) (SOPC Builder) (μC/OS-II) (DE2)
(原創) 如何自己用SOPC Builder建立一個能在DE2-70上跑μC/OS-II的Nios II系統? (SOC) (Nios II) (μC/OS-II) (DE2-70)

 

你可能感兴趣的:((原創) 如何自己用SOPC Builder建立一個能在DE2上跑μC/OS-II的Nios II系統? (IC Design) (DE2) (Quartus II) (Nios II) (SOPC ...)