OpenCores
URL https://opencores.org/ocsvn/sbd_sqrt_fp/sbd_sqrt_fp/trunk

Subversion Repositories sbd_sqrt_fp

[/] [sbd_sqrt_fp/] [tags/] [start/] [sbd_sqrt_fp_calc_mant.v] - Diff between revs 2 and 3

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 3
/****************************************************************************
/****************************************************************************
sbd_sqrt_fp_calc_mant
sbd_sqrt_fp_calc_mant
 
 
- mantissa calculation for sbd_sqrt_fp
- mantissa calculation for sbd_sqrt_fp
 
 
Copyright (C) 2005 Samuel Brown
Copyright (C) 2005 Samuel Brown
sam.brown@sbdesign.org
sam.brown@sbdesign.org
 
 
This library is free software; you can redistribute it and/or
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
version 2.1 of the License, or (at your option) any later version.
 
 
This library is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
Lesser General Public License for more details.
 
 
You should have received a copy of the GNU Lesser General Public
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 
****************************************************************************/
****************************************************************************/
 
 
module sbd_sqrt_fp_calc_mant (MANT_IN,CLK,VAL_IN,MANT_OUT,VAL_OUT);
module sbd_sqrt_fp_calc_mant (MANT_IN,CLK,VAL_IN,MANT_OUT,VAL_OUT);
 
 
parameter mantlength = 24;
parameter mantlength = 24;
 
 
input [mantlength-1:0]         MANT_IN;
input [mantlength-1:0]         MANT_IN;
input                         CLK;
input                         CLK;
input                         VAL_IN;
input                         VAL_IN;
output wire [mantlength-1:0]  MANT_OUT;
output wire [mantlength-1:0]  MANT_OUT;
output                        VAL_OUT;
output                        VAL_OUT;
 
 
wire init, lsr, enr, enl, en_d, dleft;
wire init, lsr, enr, enl, en_d, dleft;
 
 
wire [1:0] shiftLeft1SerialOut;
wire [1:0] shiftLeft1SerialOut;
wire [(2*mantlength)-1:0] biPOUT, adsuOutput, shiftLeft2ParallelOut;
wire [(2*mantlength)-1:0] biPOUT, adsuOutput, shiftLeft2ParallelOut;
 
 
sbd_shifter_left2 shiftLeft1 (
sbd_shifter_left2 shiftLeft1 (
        .SIN(2'b00),
        .SIN(2'b00),
        .PIN(MANT_IN),
        .PIN(MANT_IN),
        .LOAD(init),
        .LOAD(init),
        .RST(1'b0),
        .RST(1'b0),
        .SHIFT(enl),
        .SHIFT(enl),
        .CLK(CLK),
        .CLK(CLK),
        .SOUT(shiftLeft1SerialOut));
        .SOUT(shiftLeft1SerialOut));
        defparam shiftLeft1.bitlength = mantlength;
        defparam shiftLeft1.bitlength = mantlength;
 
 
sbd_adsu adsu_inst (
sbd_adsu adsu_inst (
        .A(shiftLeft2ParallelOut),
        .A(shiftLeft2ParallelOut),
        .B(biPOUT),
        .B(biPOUT),
        .ADD(shiftLeft2ParallelOut[47]),
        .ADD(shiftLeft2ParallelOut[47]),
        .C_IN(~shiftLeft2ParallelOut[47]),
        .C_IN(~shiftLeft2ParallelOut[47]),
        .S(adsuOutput));
        .S(adsuOutput));
        defparam adsu_inst.bitlength = 2*mantlength;
        defparam adsu_inst.bitlength = 2*mantlength;
 
 
sbd_shifter_left2 shiftLeft2 (
sbd_shifter_left2 shiftLeft2 (
        .SIN(shiftLeft1SerialOut),
        .SIN(shiftLeft1SerialOut),
        .PIN(adsuOutput),
        .PIN(adsuOutput),
        .LOAD(lsr),
        .LOAD(lsr),
        .RST(init),
        .RST(init),
        .SHIFT(enr),
        .SHIFT(enr),
        .CLK(CLK),
        .CLK(CLK),
        .POUT(shiftLeft2ParallelOut));
        .POUT(shiftLeft2ParallelOut));
        defparam shiftLeft2.bitlength = 2*mantlength;
        defparam shiftLeft2.bitlength = 2*mantlength;
 
 
sbd_shifter_left3_right2 shiftBI (
sbd_shifter_left3_right2 shiftBI (
        .SINLSB({~shiftLeft2ParallelOut[(2*mantlength)-1],shiftLeft2ParallelOut[(2*mantlength)-1],1'b1}),
        .SINLSB({~shiftLeft2ParallelOut[(2*mantlength)-1],shiftLeft2ParallelOut[(2*mantlength)-1],1'b1}),
        .SINMSB(2'b00),
        .SINMSB(2'b00),
        .PIN({ {2*mantlength-1{1'b0}}, 1'b1 }),
        .PIN({ {2*mantlength-1{1'b0}}, 1'b1 }),
        .LOAD(init),
        .LOAD(init),
        .LR(~dleft),
        .LR(~dleft),
        .RST(1'b0),
        .RST(1'b0),
        .SHIFT(en_d),
        .SHIFT(en_d),
        .CLK(CLK),
        .CLK(CLK),
        .POUT(biPOUT));
        .POUT(biPOUT));
        defparam shiftBI.bitlength = 2*mantlength;
        defparam shiftBI.bitlength = 2*mantlength;
 
 
assign MANT_OUT = biPOUT[mantlength-1:0];
assign MANT_OUT = biPOUT[mantlength-1:0];
 
 
sbd_sqrt_fp_state_mach state_mach (
sbd_sqrt_fp_state_mach state_mach (
        .CLK(CLK),
        .CLK(CLK),
        .VAL_IN(VAL_IN),
        .VAL_IN(VAL_IN),
        .INIT(init),
        .INIT(init),
        .LSR(lsr),
        .LSR(lsr),
        .ENR(enr),
        .ENR(enr),
        .ENL(enl),
        .ENL(enl),
        .EN_D(en_d),
        .EN_D(en_d),
        .DLEFT(dleft),
        .DLEFT(dleft),
        .VAL_OUT(VAL_OUT));
        .VAL_OUT(VAL_OUT));
        defparam state_mach.termval = mantlength + 1;
        defparam state_mach.termval = mantlength + 1;
 
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.