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

Subversion Repositories sbd_sqrt_fp

[/] [sbd_sqrt_fp/] [trunk/] [sbd_sqrt_fp_calc_mant.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sbdesign
/****************************************************************************
2
sbd_sqrt_fp_calc_mant
3
 
4
- mantissa calculation for sbd_sqrt_fp
5
 
6
Copyright (C) 2005 Samuel Brown
7
sam.brown@sbdesign.org
8
 
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
 
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
Lesser General Public License for more details.
18
 
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
 
23
****************************************************************************/
24
 
25
module sbd_sqrt_fp_calc_mant (MANT_IN,CLK,VAL_IN,MANT_OUT,VAL_OUT);
26
 
27
parameter mantlength = 24;
28
 
29
input [mantlength-1:0]         MANT_IN;
30
input                         CLK;
31
input                         VAL_IN;
32
output wire [mantlength-1:0]  MANT_OUT;
33
output                        VAL_OUT;
34
 
35
wire init, lsr, enr, enl, en_d, dleft;
36
 
37
wire [1:0] shiftLeft1SerialOut;
38
wire [(2*mantlength)-1:0] biPOUT, adsuOutput, shiftLeft2ParallelOut;
39
 
40
sbd_shifter_left2 shiftLeft1 (
41
        .SIN(2'b00),
42
        .PIN(MANT_IN),
43
        .LOAD(init),
44
        .RST(1'b0),
45
        .SHIFT(enl),
46
        .CLK(CLK),
47
        .SOUT(shiftLeft1SerialOut));
48
        defparam shiftLeft1.bitlength = mantlength;
49
 
50
sbd_adsu adsu_inst (
51
        .A(shiftLeft2ParallelOut),
52
        .B(biPOUT),
53
        .ADD(shiftLeft2ParallelOut[47]),
54
        .C_IN(~shiftLeft2ParallelOut[47]),
55
        .S(adsuOutput));
56
        defparam adsu_inst.bitlength = 2*mantlength;
57
 
58
sbd_shifter_left2 shiftLeft2 (
59
        .SIN(shiftLeft1SerialOut),
60
        .PIN(adsuOutput),
61
        .LOAD(lsr),
62
        .RST(init),
63
        .SHIFT(enr),
64
        .CLK(CLK),
65
        .POUT(shiftLeft2ParallelOut));
66
        defparam shiftLeft2.bitlength = 2*mantlength;
67
 
68
sbd_shifter_left3_right2 shiftBI (
69
        .SINLSB({~shiftLeft2ParallelOut[(2*mantlength)-1],shiftLeft2ParallelOut[(2*mantlength)-1],1'b1}),
70
        .SINMSB(2'b00),
71
        .PIN({ {2*mantlength-1{1'b0}}, 1'b1 }),
72
        .LOAD(init),
73
        .LR(~dleft),
74
        .RST(1'b0),
75
        .SHIFT(en_d),
76
        .CLK(CLK),
77
        .POUT(biPOUT));
78
        defparam shiftBI.bitlength = 2*mantlength;
79
 
80
assign MANT_OUT = biPOUT[mantlength-1:0];
81
 
82
sbd_sqrt_fp_state_mach state_mach (
83
        .CLK(CLK),
84
        .VAL_IN(VAL_IN),
85
        .INIT(init),
86
        .LSR(lsr),
87
        .ENR(enr),
88
        .ENL(enl),
89
        .EN_D(en_d),
90
        .DLEFT(dleft),
91
        .VAL_OUT(VAL_OUT));
92
        defparam state_mach.termval = mantlength + 1;
93
 
94
endmodule

powered by: WebSVN 2.1.0

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