Vivado IP核使用 Ln(x)函数计算

IP核设置

Ln(x)函数计算IP核设置为一个组合电路模块,不需要时钟

这里写图片描述

1529464334487
这里写图片描述

1529464353429
这里写图片描述

测试代码

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2018/06/19 15:45:55
// Design Name: 
// Module Name: MS
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//


module MS(
    input clk,
    input rst,
    input [31:0] din
    );
    //reg clk;
    //Ln函数寄存器,浮点数输入
   reg in_valid;
   reg [31:0] Ln_indata;
   wire out_valid;
   wire [31:0] Ln_outdata;
    Ln Ln (
      .s_axis_a_tvalid(in_valid),            // input wire s_axis_a_tvalid
      .s_axis_a_tdata(Ln_indata),              // input wire [31 : 0] s_axis_a_tdata
      .m_axis_result_tvalid(out_valid),  // output wire m_axis_result_tvalid
      .m_axis_result_tdata(Ln_outdata)    // output wire [31 : 0] m_axis_result_tdata
    );
    always@(clk)
    if(!rst)
        begin
           Ln_indata<=32'b0; 
           in_valid<=1'b0;
        end
    else
        begin
            Ln_indata<=din; 
            in_valid<=1'b1;
        end

endmodule

testbench

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2018/06/19 16:53:43
// Design Name: 
// Module Name: MS_tb
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//


module MS_tb(

    );
    reg clk;
    reg rst;
    reg[31:0] din;
    MS ms(
        .clk(clk),
        .rst(rst),
        .din(din)
        );
    initial
        begin
            clk =1'b0;
            rst =1'b0;
            din=32'b0;
          #100
            rst=1'b1;
            din=32'h40000000;
        end
    always #10 clk=~clk;
endmodule

前Simulation结果

1529464585929

输入为Ln(2)
这里写图片描述
输出满足要求

备注:数据是单精度的浮点数

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值