新聞中心

        EEPW首頁 > EDA/PCB > 設計應用 > 用Vivado-HLS實現低latency 除法器

        用Vivado-HLS實現低latency 除法器

        作者: 時間:2017-06-13 來源:網絡 收藏

        本文引用地址:http://www.104case.com/article/201706/358171.htm

        1 Vivado HLS簡介

        2創建一個Vivado-HLS工程

        2.1打開Vivado HLS GUI



        2.2創建新工程

        在 Welcome Page, 選擇Create New Project


        2.3添加源文件

        指定頂層需要綜合的源文件名,并添加文件.

        2.4添加測試文件

        添加測試文件.



        2.5創建solution

        3 C Validation

        4 C Synthesis. 13

        5 Explore不同新的Solution. 15

        1 Vivado HLS簡介

        Xilinx Vivado High-Level Synthesis (HLS)工具將C, C++,或者SystemC設計規范,算法轉成Register Transfer Level(RTL)實現,可綜合到Xilinx FPGA.

        將DSP算法快速轉到RTL FPGA實現將C至RTL時間縮短4倍基于C語言的驗證時間縮短100倍RTL仿真時間縮短3倍

        2創建一個Vivado-HLS工程2.1打開Vivado HLS GUI雙擊桌面上Vivado HLS GUI圖標,或從Start > All Programs >

        Vivado > Vivado HLS GUI

        打開GUI之后,Vivado-HLS welcome界面如下所示:

        2.2創建新工程在Welcome Page,選擇Create New Project

        2.3添加源文件指定頂層需要綜合的源文件名,并添加文件。

        本除法器設計采用移位算法

        #include radix2div.h

        quotient_t radix2div (

        dividend_t dividend, // (numerator)

        divisor_t divisor, // (denominator)

        remainder_t *remainder //

        ) {

        #pragma AP latency max=3

        #pragma AP pipeline

        quotient_i_t quo, y; // +1 bits unsigned

        subtract_t sub_out, rem_r; // +1 bits signed

        boolean_t last_bit, next_bit;

        loop_cnt_t i;

        ///////////////////////////////////////////////

        last_bit = 0;

        rem_r = 0;

        if (LOOP_MAX > 32)

        quo = 0ULL;

        else

        quo = 0;

        //////////////////////////////////////////////////

        div_booth_label0: for (i = 0; i

        #include

        #include radix2div.h

        //////////////////////////////////////////////////////////////////////////////

        quotient_t radix2div (

        dividend_t dividend, // (numerator)

        divisor_t divisor, // (denominator)

        remainder_t *remainder //

        );

        //////////////////////////////////////////////////////////////////////////////

        int test_divider (dividend_t dividend,

        divisor_t divisor



        {

        quotient_t quotient;

        remainder_t remainder;

        quotient = radix2div(dividend,divisor,

        fprintf(stdout, >>>>>>>>> dividend = %u, divisor = %u quotient = %u remainder = %u n,

        dividend, divisor, quotient, remainder);

        fprintf(stdout, >>>>>>>>>—— n);

        if ((quotient == dividend/divisor) (remainder == dividend-(divisor*quotient)) ) {

        printf (PASS n);

        }

        else {

        printf (FAIL n);

        return 1;

        }

        }

        //////////////////////////////////////////////////////////////////////////////

        int main () {

        int i, j;

        dividend_t max_num;

        max_num = 0;

        j = LOOP_MAX-1;

        for(i = 0; i j; i = i+1) {

        max_num = max_num +pow(2,i);

        }

        //////////////////////////////////////////////////////////////////////////////

        test_divider (max_num,1);

        test_divider (2,pow(2,9)-1);

        test_divider (max_num,pow(2,9)-1);

        test_divider (8,1);

        test_divider (99,10);

        //////////////////////////////////////////////////////////////////////////////

        test_divider (max_num,1);


        test_divider (2,pow(2,9)-1);


        test_divider (max_num,pow(2,9)-1);


        test_divider (8,1);


        test_divider (99,10);


        }

        2.5 創建solution
        創建solution, 時鐘約束, 并選器件.

        打開包括工程信息Vivado HLS GUI.

        3 C Validation

        在將c/c++/system c 轉換成RTL之前,必須先驗證C 設計,確保其功能是正確的

        點擊 “Run C Simulation” 圖標,


        4 C Synthesis
        現在可以對設計做C 綜合,生成RTL代碼. 當綜合完成,, GUI 更新綜合結果. 包括資源使用,latency等。

        為了達到了預先要求為3 個時鐘周期, 將latency 的directive設置為3。

        5 Explore 不同新的Solution

        project -> new solution。

        在同一個工程里面,可以使用同一套源代碼,進行不同solutions的嘗試。



        關鍵詞: VivadoHLS VivadoHLSGUI

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 陆河县| 商丘市| 乡城县| 普陀区| 安徽省| 建宁县| 延安市| 宁津县| 锡林浩特市| 灵山县| 尤溪县| 措勤县| 嘉峪关市| 大足县| 拉萨市| 长丰县| 武隆县| 辰溪县| 汕尾市| 中江县| 错那县| 黔西县| 揭东县| 博罗县| 大田县| 枣庄市| 上犹县| 平湖市| 永和县| 柯坪县| 南宁市| 溧水县| 西乡县| 日照市| 灵寿县| 西平县| 景泰县| 义乌市| 旬邑县| 荔波县| 友谊县|