天天看點

Vivado System Generator學習筆記

環境:win7 64   vivado 2014.1

開發闆:zedboard version d    xc7z020clg484-1

序列槽軟體:SecureCRT

注意:本文中所有的源碼、工程檔案在“我的資源”中可以找到,如果沒有請聯系作者本人。轉載請注明出處。

  前面一段時間各種事,一直就沒有更新部落格了。現在準備把前兩天的學習筆記放上來,以供分享讨論。

  這篇筆記主要是關于Vivado System Generator的學習筆記,是Xilinx官網的ug948教程的簡要說明,隻包括了自己實際驗證的部分。ug948、ug897都是很好的學習Vivado System Generator的資料,講的非常詳細,英文也不難,是以這裡不打算像之前一樣一步步的寫下來了,有了前面的基礎和一點matlab的基礎應該可以很快上手的。

1. 使用流程(個人總結,詳細請參考ug948)

1. 使用流程(建立slx)

    打開SG

    在matlab主界面:打開simulink

    建立model,在simulink library browser裡面選擇相應的元件,添加到model中

    修改相關參數,連接配接子產品

    設定參數,仿真

2. 使用流程(已有的slx檔案)

    打開SG

    在matlab主界面,設定工作目錄(非常重要);在左側欄可以看到已有的工程檔案。

    打開*.slx檔案,可進行編輯。打開simulink可選擇相關模型。

    添加Xilinx(System Generator子產品),一定注意設定part為已安裝的part。

    如果因為版本問題無法儲存,可以另存為新的檔案。(測試幾次mdl格式比較保險)

2. ug948學習導航

•  Lab 1: Use Simulink to create a simple design, create a subsystem, and then simulate.     基本概念和使用。

•  Lab 2: Build a basic design in System Generator, simulate the design, and then generate an FPGA bitstream for a target Xilinx technology.     首先介紹了matlab simulink的使用;

    然後使用Xilinx block改寫;注意必須使用Xilinx Gateway In / Gateway Out blocks 來定義FPGA的邊界;設計中必須有 Xilinx System Generator™ token     選中Xilinx子產品,ctrl+G将其打包成一個子產品,注意要包括Xilinx System Generator™ token

    采用不同的方案進行設計。如普通計算單元和DSP48單元。

•  Lab 3: Learn how signal routing blocks are used to re-define or modify fixed-point numbers at the bit-level. •  Lab 4: Create a finite state machine using the Mcode block in System Generator.     使用Mcode子產品,通過m檔案建構了一個狀态機并在SG中驗證。

•  Lab 5: Change sample rates in a multi-rate DSP design and then convert a serial data stream to a parallel data word and a parallel data word to a serial data stream. •  Lab 6: Use a Xilinx ROM block to implement a trig or math function such as arcsin. •  Lab 7: Include a System Generator model within a Vivado IDE design and combine that model with other RTL sources.     在vivado中添加各種rtl資源的方法。

•  Lab 8: Import C/C++ source files into a System Generator model by leveraging the tool integration with Vivado High-Level Synthesis (HLS).     HLS生成的子產品導入SG中應用的方法。

    添加HLS子產品:

        1. Add a Vivado HLS block by right clicking anywhere on the canvas workspace. 

        2. Select Xilinx BlockAdd and scroll down to the Vivado HLS block as shown in the figure below

        3. Double click the block and use the Browse button to select the solution created by Vivado HLS

•  Lab 9: Including a System Generator Design as a Module in an IP Integrator Design      export a design as an IP module into the Vivado® IP Catalog.包括兩個例子     第一個,raw_interface:

        1. Double-click the System Generator token and verify that the IP Catalog compilation target is selected.          2. Verify that the Create testbench option is checked.

        3. Click the Settings button and configure the IP Packager Settings 

        4. Click OK, then click Generate on the System Generator token

        5. 在./ip目錄下有生成的ip;在./ip_catalog有示例工程。

        6. Select Behavioral simulation;Run a validation check on this design to confirm the IP works within IP integrator.

    第二個,AXI4-Lite interface:         很強大的例子,AXI4接口;Locate the ELF file and associate

•  Lab 10: AXI4-Lite Interface Synthesis     how to package a System Generator design with a synthesized AXI4-Lite interface

    例子:rgb2gray

        1. 設定目錄;打開檔案;(另存為新檔案);設定器件;仿真驗證

        2. 設定子產品 Gateway In block to an AXI4-Lite Slave Interface:輕按兩下子產品--Implementation tab--set  Interface to AXI4-Lite.

        3.  package the design:輕按兩下 System Generator token,檢查器件,語言,目錄等項;click the Generate button 

        4. ip在./netlist/ip中;示例工程在./netlist/ip_catalog中。

        5. 打開工程;(validate)Generate Bitstream

        6. SDK:select Xilinx Tools > Repositories and add the full path to the directory containing the System Generator Model (…/netlist_mzed/ip)              Create a new Application Peripheral Tests Project 

            right-click the rgb2gray_bd_i Block Design instance and select Export Hardware to SDK.Launch SDK         7. add repository:./netlist/ip

        8. 建立工程,修改源碼,驗證。                •  Lab 11: Black Box Examples

3. 小結   看起來可能是泛泛的,但是确實是個人學習過程中的筆記,還有部分直接記在pdf中了,可以在附件中(我的資源)檢視。後續個人實際做了一個使用SG生成的IP并在實際中驗證成功。不過執行個體比較簡單,沒有展現出matlab的強大之處。盡管SG對matlab提供了很多支援,但是很多matlab的代碼、文法不能100%遷移使用,外加的第三方庫估計更難使用了。(MCode子產品的報錯真心是**,而且網上還不好查,得慢慢積累了)