UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
184 Views
Registered: ‎10-28-2019

Divider core precision problems

Jump to solution

I am trying to use the divider ip core. (v5.1 latest with vivado 2019.1.2)

Here are my exact configurations:

Algo type: radix 2

Operantd: signed

Dividend width: 16 Has Tuser, Tuser width: 1

Divisor width: 16

Fractional / Fractional width: 8

Optimize for performance, nonblocking

Latency automatic. 

When I try to divide 300 by 200, I get 1.25 in simulation (0140 hex). What's wrong? I've attached the test bench.

 

module top_level_tb();

    logic clk =0;
    logic signed [15:0] a;
    logic signed [15:0] b;
    logic signed [15:0] c; 
    logic dividend_valid = 0;
    logic divisor_valid = 0;
    logic result_valid;
    logic tuser_in = 0;
    logic tuser_out;

  // clk has 50% duty cycle, 10ns period
    
    always #5 clk = ~clk;
    
    initial begin
        #10;
//        a <= 16'b1111010100110110;
//        b <= 16'b1111100001100011;
        
//        a <= 16'b1111111110011100;
//        b <= 16'b1111111111111100;

        a <= 300;
        b <= 200;
        dividend_valid <= 1;
        divisor_valid <= 1;
        tuser_in <= 1;
    end
    
    div_gen_0 uut(
        .aclk(clk),
        .s_axis_dividend_tvalid(dividend_valid),
        .s_axis_dividend_tdata(a),
        .s_axis_dividend_tvalid(divisor_valid),
        .s_axis_dividend_tuser(tuser_in),
        .s_axis_divisor_tdata(b),
        .m_axis_dout_tdata(c),
        .m_axis_dout_tvalid(result_valid),
        .m_axis_dout_tuser(tuser_out)
    );
    
  

endmodule

 

0 Kudos
1 Solution

Accepted Solutions
Participant digitate
Participant
171 Views
Registered: ‎02-06-2018

Re: Divider core precision problems

Jump to solution

I have not used the divider core myself, but the documentation for it (pg151-div-gen) says that  both the quotient and fractional results have a sign bit. So 0x140 is correct.

View solution in original post

0 Kudos
1 Reply
Participant digitate
Participant
172 Views
Registered: ‎02-06-2018

Re: Divider core precision problems

Jump to solution

I have not used the divider core myself, but the documentation for it (pg151-div-gen) says that  both the quotient and fractional results have a sign bit. So 0x140 is correct.

View solution in original post

0 Kudos