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

Subversion Repositories dblclockfft

[/] [dblclockfft/] [trunk/] [rtl/] [bimpy.v] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    ../rtl/bimpy.v
4
//
5
// Project:     A General Purpose Pipelined FFT Implementation
6
//
7
// Purpose:     A simple 2-bit multiply based upon the fact that LUT's allow
8
//              6-bits of input.  In other words, I could build a 3-bit
9
//      multiply from 6 LUTs (5 actually, since the first could have two
10
//      outputs).  This would allow multiplication of three bit digits, save
11
//      only for the fact that you would need two bits of carry.  The bimpy
12
//      approach throttles back a bit and does a 2x2 bit multiply in a LUT,
13
//      guaranteeing that it will never carry more than one bit.  While this
14
//      multiply is hardware independent (and can still run under Verilator
15
//      therefore), it is really motivated by trying to optimize for a
16
//      specific piece of hardware (Xilinx-7 series ...) that has at least
17
//      4-input LUT's with carry chains.
18
//
19
//
20
//
21
// Creator:     Dan Gisselquist, Ph.D.
22
//              Gisselquist Technology, LLC
23
//
24
////////////////////////////////////////////////////////////////////////////////
25
//
26
// Copyright (C) 2015-2018, Gisselquist Technology, LLC
27
//
28
// This program is free software (firmware): you can redistribute it and/or
29
// modify it under the terms of  the GNU General Public License as published
30
// by the Free Software Foundation, either version 3 of the License, or (at
31
// your option) any later version.
32
//
33
// This program is distributed in the hope that it will be useful, but WITHOUT
34
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
35
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
36
// for more details.
37
//
38
// You should have received a copy of the GNU General Public License along
39
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
40
// target there if the PDF file isn't present.)  If not, see
41
// <http://www.gnu.org/licenses/> for a copy.
42
//
43
// License:     GPL, v3, as defined and found on www.gnu.org,
44
//              http://www.gnu.org/licenses/gpl.html
45
//
46
//
47
////////////////////////////////////////////////////////////////////////////////
48
//
49
//
50
`default_nettype        none
51
//
52
module  bimpy(i_clk, i_ce, i_a, i_b, o_r);
53
        parameter       BW=18, // Number of bits in i_b
54
                        LUTB=2; // Number of bits in i_a for our LUT multiply
55
        input                           i_clk, i_ce;
56
        input           [(LUTB-1):0]     i_a;
57
        input           [(BW-1):0]       i_b;
58
        output  reg     [(BW+LUTB-1):0]  o_r;
59
 
60
        wire    [(BW+LUTB-2):0]  w_r;
61
        wire    [(BW+LUTB-3):1] c;
62
 
63
        assign  w_r =  { ((i_a[1])?i_b:{(BW){1'b0}}), 1'b0 }
64
                                ^ { 1'b0, ((i_a[0])?i_b:{(BW){1'b0}}) };
65
        assign  c = { ((i_a[1])?i_b[(BW-2):0]:{(BW-1){1'b0}}) }
66
                        & ((i_a[0])?i_b[(BW-1):1]:{(BW-1){1'b0}});
67
 
68
        always @(posedge i_clk)
69
                if (i_ce)
70
                        o_r <= w_r + { c, 2'b0 };
71
 
72
endmodule

powered by: WebSVN 2.1.0

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