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

Subversion Repositories two_dimensional_fast_hartley_transform

[/] [two_dimensional_fast_hartley_transform/] [trunk/] [fht_8x8_core.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 irezki
/**********************************************************************
2
 * File  : fht_8x8_core.v
3
 * Author: Ivan Rezki
4
 * email : irezki@gmail.com
5
 * Topic : RTL Core
6
 *                2-Dimensional Fast Hartley Transform
7
 *
8
 * Compilation Notes:
9 5 irezki
 *  1).Input Data
10
 *     - no min.negative value
11
 *  2).Memory
12 4 irezki
 *     - if you use Xilinx FPGA for prototyping
13
 *       compile this code along with
14
 *       USE_FPGA_SPSRAM definition and
15
 *       XilinxCoreLib library,
16
 *     - otherwise compile this code
17
 *       along with USE_ASIC_SPSRAM
18 5 irezki
 *     - max. bitwidth is 16bits
19
 *  3).Multiplier
20 4 irezki
 *     - if you use Xilinx FPGA for prototyping
21
 *       compile this code along with
22
 *       USE_FPGA_MULT definition
23
 *     - otherwise compile this code
24
 *       along with USE_ASIC_MULT
25
 *
26
 * TOP Level
27
 * 2D FHT 64 points -> ... clk delay
28
 *
29 5 irezki
 *     +-------------------------+
30
 *     |                         |
31
 * --->|    2D FHT/8x8 Points    |--->
32
 *     |                         |
33
 *     +-------------------------+
34
 *     |<---- ... clk delay ---->|
35 4 irezki
 *
36 5 irezki
 * Input Data  : [N-1:0] signed
37
 * Output Data : [N+5:0] signed
38 4 irezki
 *
39
 * Data is coming from somewhere (e.g. memory) with sclk one by one.
40
 * 1st step 1D FHT by rows:
41
 *                      - Shift Register for 8 points -> ... clk delay
42
 *                      - Alligner
43
 *                      - Calculate 1D FHT for 8 points. -> ... clk delay
44
 *                              - FF is used on the each input of the butterfly
45
 *                              - FF is used on the input of the multiplier
46
 * 2nd Step:
47
 * Matrix Transpose -> 64+1 clk delay
48
 *                      - Collecting data until 1st buffer is full as 64 points.
49
 *                      - Read 64 points right away after 1st buffer is full.
50
 *                      - At the same time 2nd buffer is ready to receive data.
51
 *                      - Collecting data until 2nd buffer is full as 64 points.
52
 *                      - Read 64 points right away after 2nd buffer is full.
53
 *                      - At the same time 1st buffer is ready to receive data once again.
54
 *                      - ...
55
 * 3rd Step 1D FHT by columns.
56
 *                      - Combine data to make 8 points in parallel. -> ... clk delay
57
 *                      - Calculate 1D FHT for 8 points. -> ... clk delay
58
 *
59
 * RIGHT TO USE: This code example, or any portion thereof, may be
60
 * used and distributed without restriction, provided that this entire
61
 * comment block is included with the example.
62
 *
63
 * DISCLAIMER: THIS CODE EXAMPLE IS PROVIDED "AS IS" WITHOUT WARRANTY
64
 * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
65
 * TO WARRANTIES OF MERCHANTABILITY, FITNESS OR CORRECTNESS. IN NO
66
 * EVENT SHALL THE AUTHOR OR AUTHORS BE LIABLE FOR ANY DAMAGES,
67
 * INCLUDING INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE
68
 * USE OF THIS CODE.
69
 **********************************************************************/
70 2 irezki
 
71
// ----->>> Define Multiplier Type
72 5 irezki
//`define USE_ASIC_MULT
73 2 irezki
//`define USE_FPGA_MULT
74
 
75
// ----->>>  Define Memory Type
76
//`define USE_FPGA_SPSRAM
77 5 irezki
//`define USE_ASIC_SPSRAM
78 2 irezki
 
79
module fht_8x8_core (
80
        rstn,
81
        sclk,
82
 
83
        x_valid,
84
        x_data,
85
 
86
        fht_2d_valid,
87
        fht_2d_data
88
);
89
// Number of input bits
90
parameter N = 8;
91
 
92
input   rstn;
93
input   sclk;
94
 
95
input                   x_valid;
96
input   [N-1:0] x_data;
97
 
98
output                  fht_2d_valid;
99
output  [N+5:0]  fht_2d_data;
100
 
101
// +++--->>> One-Dimensional Fast Hartley Transform - 1st Stage
102
// Data input [N-1:0] = N bits
103
// 
104
wire                    fht_1d_valid;
105
wire    [N+2:0]  fht_1d_data;
106
 
107
fht_1d_x8 #(N) u1_fht_1d_x8_1st(
108
        .rstn   (rstn),
109
        .sclk   (sclk),
110
 
111
        // input data
112
        .x_valid        (x_valid),
113
        .x_data         (x_data),
114
 
115
        // output data
116
        .fht_valid      (fht_1d_valid),
117
        .fht_data       (fht_1d_data)
118
);
119
 
120
// +++--->>> Matrix Transposition <<<---+++ \\
121
wire                    mem_valid;
122
wire    [N+2:0]  mem_data;
123
 
124
mtx_trps_8x8_dpsram #(N+3) u2_mtx_ts (
125
        .rstn           (rstn),
126
        .sclk           (sclk),
127
 
128
        .inp_valid      (fht_1d_valid),
129
        .inp_data       (fht_1d_data),
130
 
131
        .mem_data       (mem_data),
132
        .mem_valid      (mem_valid)
133
);
134
 
135
// +++--->>> One-Dimensional Fast Hartley Transform - 2nd Stage
136
fht_1d_x8 #(N+3) u3_fht_1d_x8_2nd(
137
        .rstn   (rstn),
138
        .sclk   (sclk),
139
 
140
        // input data
141
        .x_valid        (mem_valid),
142
        .x_data         (mem_data),
143
 
144
        // output data
145
        .fht_valid      (fht_2d_valid),
146
        .fht_data       (fht_2d_data)
147
);
148
 
149
endmodule

powered by: WebSVN 2.1.0

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