• quartus之LPM_DIVIDE


    quartus的IP测试之LPM_DIVIDE

    1、基本作用

    一个用于除法的IP,可以输入除数、被除数,得到商、余值。

    2、基本测试

    `timescale 1ns/1ns
    module divide_tb;
        reg [7:0]denom;
        reg [7:0]numer;
        wire [7:0] quotient;
        wire [7:0] remain;
    
    initial begin
        $monitor($realtime,,"denom=%d,numer=%d,quotient=%d,remain=%d"
        ,denom,numer,quotient,remain);
        denom=1;
        numer=1;
        #1
        denom=4;
        numer=2;
        #2
        denom=6;
        numer=0;
        #2
        denom=0;
        numer=1;
        #4
        $stop;
    end
    
    divide_top U1_top(
        .denom(denom),
        .numer(numer),
        .quotient(quotient),
        .remain(remain)
    );
        
    
    endmodule
    module divide_top(
        input [7:0]    denom,
        input [7:0]    numer,
        output [7:0]    quotient,
        output [7:0]    remain
    );
    
    myip_divide U1_demo(
        .denom(denom),
        .numer(numer),
        .quotient(quotient),
        .remain(remain)
    );
    
    endmodule
    # run -all
    # 0 denom=  1,numer=  1,quotient=  1,remain=  0
    # 1 denom=  4,numer=  2,quotient=  0,remain=  2
    # 3 denom=  6,numer=  0,quotient=  0,remain=  0
    # 5 denom=  0,numer=  1,quotient=  x,remain=  x
    # ** Note: $stop    : D:/Library/FPGA_altera/A8_LPM_DIVIDE/standard_module/divide_tb.v(23)
    #    Time: 9 ns  Iteration: 0  Instance: /divide_tb

    3、使用小结

    除数为0时输出均为x,其他的和正常的整数除法的功能是一致的。

  • 相关阅读:
    get post 小结
    ddt 实例
    通俗大白话来理解TCP协议的三次握手和四次断开
    find xss
    use . adb . get wifi
    http bass
    mac 配置homebrew
    id 与 void * 转换
    Maven
    percent-encode 百分号编码
  • 原文地址:https://www.cnblogs.com/electricdream/p/13449760.html
Copyright © 2020-2023  润新知