1 |
8 |
unicore |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Normalization unit ////
|
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 : CNORM.v
|
41 |
|
|
// File Revision :
|
42 |
|
|
// Last modification : Sun Sep 30 20:11:56 2007
|
43 |
|
|
/////////////////////////////////////////////////////////////////////
|
44 |
|
|
// FUNCTION: shifting left up to 3 bits
|
45 |
|
|
// PROPERTIES: 1)shifting left up to 3 bits controlled by
|
46 |
|
|
// the 2-bit code SHIFT
|
47 |
|
|
// 2)Is registered
|
48 |
|
|
// 3)Overflow detector detects the overflow event
|
49 |
|
|
// by the given shift condition. The detector is
|
50 |
|
|
// zeroed by the START signal
|
51 |
|
|
// 4)RDY is the START signal delayed to a single
|
52 |
|
|
// clock cycle
|
53 |
|
|
/////////////////////////////////////////////////////////////////////
|
54 |
|
|
`timescale 1 ns / 1 ps
|
55 |
|
|
`include "FFT64_CONFIG.inc"
|
56 |
|
|
|
57 |
|
|
module CNORM ( CLK ,ED ,START ,DR ,DI ,SHIFT ,OVF ,RDY ,DOR ,DOI );
|
58 |
|
|
`USFFT64paramnb
|
59 |
|
|
|
60 |
|
|
output OVF ;
|
61 |
|
|
reg OVF ;
|
62 |
|
|
output RDY ;
|
63 |
|
|
reg RDY ;
|
64 |
|
|
output [nb+1:0] DOR ;
|
65 |
|
|
wire [nb+1:0] DOR ;
|
66 |
|
|
output [nb+1:0] DOI ;
|
67 |
|
|
wire [nb+1:0] DOI ;
|
68 |
|
|
|
69 |
|
|
input CLK ;
|
70 |
|
|
wire CLK ;
|
71 |
|
|
input ED ;
|
72 |
|
|
wire ED ;
|
73 |
|
|
input START ;
|
74 |
|
|
wire START ;
|
75 |
|
|
input [nb+2:0] DR ;
|
76 |
|
|
wire [nb+2:0] DR ;
|
77 |
|
|
input [nb+2:0] DI ;
|
78 |
|
|
wire [nb+2:0] DI ;
|
79 |
|
|
input [1:0] SHIFT ;
|
80 |
|
|
wire [1:0] SHIFT ;
|
81 |
|
|
|
82 |
|
|
wire[nb+2:0] diri,diii;
|
83 |
|
|
assign diri = DR << SHIFT;
|
84 |
|
|
assign diii = DI << SHIFT;
|
85 |
|
|
|
86 |
|
|
reg [nb+2:0] dir,dii;
|
87 |
|
|
always @( posedge CLK ) begin
|
88 |
|
|
if (ED) begin
|
89 |
|
|
dir<=diri[nb+2:1];
|
90 |
|
|
dii<=diii[nb+2:1];
|
91 |
|
|
end
|
92 |
|
|
end
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
always @( posedge CLK ) begin
|
96 |
|
|
if (ED) begin
|
97 |
|
|
RDY<=START;
|
98 |
|
|
if (START)
|
99 |
|
|
OVF<=0;
|
100 |
|
|
else
|
101 |
|
|
case (SHIFT)
|
102 |
|
|
2'b01 : OVF<= (DR[nb+2] != DR[nb+1]) || (DI[nb+2] != DI[nb+1]);
|
103 |
|
|
2'b10 : OVF<= (DR[nb+2] != DR[nb+1]) || (DI[nb+2] != DI[nb+1]) ||
|
104 |
|
|
(DR[nb+2] != DR[nb]) || (DI[nb+2] != DI[nb]);
|
105 |
|
|
2'b11 : OVF<= (DR[nb+2] != DR[nb+1]) || (DI[nb+2] != DI[nb+1])||
|
106 |
|
|
(DR[nb+2] != DR[nb]) || (DI[nb+2] != DI[nb]) ||
|
107 |
|
|
(DR[nb+2] != DR[nb+1]) || (DI[nb-1] != DI[nb-1]);
|
108 |
|
|
endcase
|
109 |
|
|
end
|
110 |
|
|
end
|
111 |
|
|
|
112 |
|
|
assign DOR= dir;
|
113 |
|
|
assign DOI= dii;
|
114 |
|
|
|
115 |
|
|
endmodule
|