Quartus ii 调用除法器IP核

TOOLS->MEGA WIZARD->CREATE NEW MEGA FUNCTION-> 右邊 設定OUTPUT FILE ->左邊 選DIVIDE_LPM 或 ALTFP_DIV
然後設定參數, 就可以了

这里有很多ip核都可以调用,比较方便。节省了大量的时间和资源。

以下是 DIVIDE_LPM 範例 8BIT/8BIT 結果

// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module DIV (
    denom,
    numer,
    quotient,
    remain);

    input    [7:0]  denom;
    input    [7:0]  numer;
    output    [7:0]  quotient;
    output    [7:0]  remain;

    wire [7:0] sub_wire0;
    wire [7:0] sub_wire1;
    wire [7:0] quotient = sub_wire0[7:0];
    wire [7:0] remain = sub_wire1[7:0];

    lpm_divide    lpm_divide_component (
                .denom (denom),
                .numer (numer),
                .quotient (sub_wire0),
                .remain (sub_wire1),
                .aclr (1'b0),
                .clken (1'b1),
                .clock (1'b0));
    defparam
        lpm_divide_component.lpm_drepresentation = "UNSIGNED",
        lpm_divide_component.lpm_hint = "LPM_REMAINDERPOSITIVE=TRUE",
        lpm_divide_component.lpm_nrepresentation = "UNSIGNED",
        lpm_divide_component.lpm_type = "LPM_DIVIDE",
        lpm_divide_component.lpm_widthd = 8,
        lpm_divide_component.lpm_widthn = 8;


endmodule

一般从IP核中调用出来的都是需要在bdf中生成一个图的,这样就能够实现两个数的除法输出。但是我发现如果在.v文件中自己写’/’号,编译通过之后会自动生成一个lpm_devide,但是还没有在硬件上面实现,所以后续补充。

你可能感兴趣的:(verilog)