1 |
8 |
unicore |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Multiplier by 0.7071 ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// Authors: Anatoliy Sergienko, Volodya Lepeha ////
|
6 |
|
|
//// Company: Unicore Systems http://unicore.co.ua ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Downloaded from: http://www.opencores.org ////
|
9 |
|
|
//// ////
|
10 |
|
|
/////////////////////////////////////////////////////////////////////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Copyright (C) 2006-2010 Unicore Systems LTD ////
|
13 |
|
|
//// www.unicore.co.ua ////
|
14 |
|
|
//// o.uzenkov@unicore.co.ua ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
20 |
|
|
//// ////
|
21 |
|
|
//// THIS SOFTWARE IS PROVIDED "AS IS" ////
|
22 |
|
|
//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, ////
|
23 |
|
|
//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ////
|
24 |
|
|
//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT ////
|
25 |
|
|
//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ////
|
26 |
|
|
//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS ////
|
27 |
|
|
//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
28 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ////
|
29 |
|
|
//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ////
|
30 |
|
|
//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ////
|
31 |
|
|
//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ////
|
32 |
|
|
//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ////
|
33 |
|
|
//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
34 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ////
|
35 |
|
|
//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ////
|
36 |
|
|
//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ////
|
37 |
|
|
//// ////
|
38 |
|
|
/////////////////////////////////////////////////////////////////////
|
39 |
|
|
// Design_Version : 1.0
|
40 |
|
|
// File name : MPU707.v
|
41 |
|
|
// File Revision :
|
42 |
|
|
// Last modification : Sun Sep 30 20:11:56 2007
|
43 |
|
|
/////////////////////////////////////////////////////////////////////
|
44 |
|
|
// FUNCTION: Constant multiplier
|
45 |
|
|
// PROPERTIES:1)Is based on shifts right and add
|
46 |
|
|
// 2)for short input bit width 0.7071 is approximated as
|
47 |
|
|
// 10110101 then rounding is not used
|
48 |
|
|
// 3)for long input bit width 0.7071 is approximated as
|
49 |
|
|
// 10110101000000101
|
50 |
|
|
// 4)hardware is 3 or 4 adders
|
51 |
|
|
/////////////////////////////////////////////////////////////////////
|
52 |
|
|
`include "FFT64_CONFIG.inc"
|
53 |
|
|
|
54 |
|
|
module MPU707 ( CLK ,DO ,DI ,EI );
|
55 |
|
|
`USFFT64paramnb
|
56 |
|
|
|
57 |
|
|
input CLK ;
|
58 |
|
|
wire CLK ;
|
59 |
|
|
input [nb+1:0] DI ;
|
60 |
|
|
wire signed [nb+1:0] DI ;
|
61 |
|
|
input EI ;
|
62 |
|
|
wire EI ;
|
63 |
|
|
|
64 |
|
|
output [nb+1:0] DO ;
|
65 |
|
|
reg [nb+1:0] DO ;
|
66 |
|
|
|
67 |
|
|
reg signed [nb+5 :0] dx5;
|
68 |
|
|
reg signed [nb+2 : 0] dt;
|
69 |
|
|
wire signed [nb+6 : 0] dx5p;
|
70 |
|
|
wire signed [nb+6 : 0] dot;
|
71 |
|
|
|
72 |
|
|
always @(posedge CLK)
|
73 |
|
|
begin
|
74 |
|
|
if (EI) begin
|
75 |
|
|
dx5<=DI+(DI <<2); //multiply by 5
|
76 |
|
|
dt<=DI;
|
77 |
|
|
DO<=dot >>>4;
|
78 |
|
|
end
|
79 |
|
|
end
|
80 |
|
|
|
81 |
|
|
`ifdef USFFT64bitwidth_0707_high
|
82 |
|
|
assign dot= (dx5p+(dt>>>4)+(dx5>>>12)); // multiply by 10110101000000101
|
83 |
|
|
`else
|
84 |
|
|
assign dot= (dx5p+(dt>>>4) ) ; // multiply by 10110101
|
85 |
|
|
`endif
|
86 |
|
|
|
87 |
|
|
assign dx5p=(dx5<<1)+(dx5>>>2); // multiply by 101101
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
endmodule
|