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

Subversion Repositories jpegencode

[/] [jpegencode/] [trunk/] [cb_quantizer.v] - Blame information for rev 3

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

Line No. Rev Author Line
1 2 davidklun
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  JPEG Encoder Core - Verilog                                ////
4
////                                                             ////
5
////  Author: David Lundgren                                     ////
6
////          davidklun@gmail.com                                ////
7
////                                                             ////
8
/////////////////////////////////////////////////////////////////////
9
////                                                             ////
10
//// Copyright (C) 2009 David Lundgren                           ////
11
////                  davidklun@gmail.com                        ////
12
////                                                             ////
13
//// This source file may be used and distributed without        ////
14
//// restriction provided that this copyright statement is not   ////
15
//// removed from the file and that any derivative work contains ////
16
//// the original copyright notice and the associated disclaimer.////
17
////                                                             ////
18
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
19
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
20
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
21
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
22
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
23
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
24
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
25
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
26
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
27
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
28
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
29
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
30
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
31
////                                                             ////
32
/////////////////////////////////////////////////////////////////////
33
 
34
/* This module comes after the dct module.  The 64 matrix entries calculated after
35
performing the 2D DCT are inputs to this quantization module.  This module quantizes
36
the entire 8x8 block of Cb values.  The outputs from this module
37
are the quantized Cb values for one 8x8 block. */
38
 
39
`timescale 1ns / 100ps
40
 
41
module cb_quantizer(clk, rst, enable,
42
Z11, Z12, Z13, Z14, Z15, Z16, Z17, Z18, Z21, Z22, Z23, Z24, Z25, Z26, Z27, Z28,
43
Z31, Z32, Z33, Z34, Z35, Z36, Z37, Z38, Z41, Z42, Z43, Z44, Z45, Z46, Z47, Z48,
44
Z51, Z52, Z53, Z54, Z55, Z56, Z57, Z58, Z61, Z62, Z63, Z64, Z65, Z66, Z67, Z68,
45
Z71, Z72, Z73, Z74, Z75, Z76, Z77, Z78, Z81, Z82, Z83, Z84, Z85, Z86, Z87, Z88,
46
Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q21, Q22, Q23, Q24, Q25, Q26, Q27, Q28,
47
Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, Q41, Q42, Q43, Q44, Q45, Q46, Q47, Q48,
48
Q51, Q52, Q53, Q54, Q55, Q56, Q57, Q58, Q61, Q62, Q63, Q64, Q65, Q66, Q67, Q68,
49
Q71, Q72, Q73, Q74, Q75, Q76, Q77, Q78, Q81, Q82, Q83, Q84, Q85, Q86, Q87, Q88,
50
out_enable);
51
input           clk;
52
input           rst;
53
input           enable;
54
input  [10:0]  Z11, Z12, Z13, Z14, Z15, Z16, Z17, Z18, Z21, Z22, Z23, Z24;
55
input  [10:0]  Z25, Z26, Z27, Z28, Z31, Z32, Z33, Z34, Z35, Z36, Z37, Z38;
56
input  [10:0]  Z41, Z42, Z43, Z44, Z45, Z46, Z47, Z48, Z51, Z52, Z53, Z54;
57
input  [10:0]  Z55, Z56, Z57, Z58, Z61, Z62, Z63, Z64, Z65, Z66, Z67, Z68;
58
input  [10:0]  Z71, Z72, Z73, Z74, Z75, Z76, Z77, Z78, Z81, Z82, Z83, Z84;
59
input  [10:0]  Z85, Z86, Z87, Z88;
60
output  [10:0]  Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q21, Q22, Q23, Q24;
61
output  [10:0]  Q25, Q26, Q27, Q28, Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38;
62
output  [10:0]  Q41, Q42, Q43, Q44, Q45, Q46, Q47, Q48, Q51, Q52, Q53, Q54;
63
output  [10:0]  Q55, Q56, Q57, Q58, Q61, Q62, Q63, Q64, Q65, Q66, Q67, Q68;
64
output  [10:0]  Q71, Q72, Q73, Q74, Q75, Q76, Q77, Q78, Q81, Q82, Q83, Q84;
65
output  [10:0]  Q85, Q86, Q87, Q88;
66
output          out_enable;
67
 
68
/* Below are the quantization values, these can be changed for different
69
quantization levels. */
70
 
71
 
72
parameter Q1_1  = 1;
73
parameter Q1_2  = 1;
74
parameter Q1_3  = 1;
75
parameter Q1_4  = 1;
76
parameter Q1_5  = 1;
77
parameter Q1_6  = 1;
78
parameter Q1_7  = 1;
79
parameter Q1_8  = 1;
80
parameter Q2_1  = 1;
81
parameter Q2_2  = 1;
82
parameter Q2_3  = 1;
83
parameter Q2_4  = 1;
84
parameter Q2_5  = 1;
85
parameter Q2_6  = 1;
86
parameter Q2_7  = 1;
87
parameter Q2_8  = 1;
88
parameter Q3_1  = 1;
89
parameter Q3_2  = 1;
90
parameter Q3_3  = 1;
91
parameter Q3_4  = 1;
92
parameter Q3_5  = 1;
93
parameter Q3_6  = 1;
94
parameter Q3_7  = 1;
95
parameter Q3_8  = 1;
96
parameter Q4_1  = 1;
97
parameter Q4_2  = 1;
98
parameter Q4_3  = 1;
99
parameter Q4_4  = 1;
100
parameter Q4_5  = 1;
101
parameter Q4_6  = 1;
102
parameter Q4_7  = 1;
103
parameter Q4_8  = 1;
104
parameter Q5_1  = 1;
105
parameter Q5_2  = 1;
106
parameter Q5_3  = 1;
107
parameter Q5_4  = 1;
108
parameter Q5_5  = 1;
109
parameter Q5_6  = 1;
110
parameter Q5_7  = 1;
111
parameter Q5_8  = 1;
112
parameter Q6_1  = 1;
113
parameter Q6_2  = 1;
114
parameter Q6_3  = 1;
115
parameter Q6_4  = 1;
116
parameter Q6_5  = 1;
117
parameter Q6_6  = 1;
118
parameter Q6_7  = 1;
119
parameter Q6_8  = 1;
120
parameter Q7_1  = 1;
121
parameter Q7_2  = 1;
122
parameter Q7_3  = 1;
123
parameter Q7_4  = 1;
124
parameter Q7_5  = 1;
125
parameter Q7_6  = 1;
126
parameter Q7_7  = 1;
127
parameter Q7_8  = 1;
128
parameter Q8_1  = 1;
129
parameter Q8_2  = 1;
130
parameter Q8_3  = 1;
131
parameter Q8_4  = 1;
132
parameter Q8_5  = 1;
133
parameter Q8_6  = 1;
134
parameter Q8_7  = 1;
135
parameter Q8_8  = 1;
136
 
137
// End of Quantization Values
138
 
139
/* The following parameters hold the values of 4096 divided by the corresponding
140
individual quantization values.  These values are needed to get around
141
actually dividing the Y, Cb, and Cr values by the quantization values.
142
Instead, you can multiply by the values below, and then divide by 4096
143
to get the same result.  And 4096 = 2^12, so instead of dividing, you can
144
just shift the bottom 12 bits out.  This is a lossy process, as 4096/Q divided
145
by 4096 doesn't always equal the same value as if you were just dividing by Q.  But
146
the quantization process is also lossy, so the additional loss of precision is
147
negligible.  To decrease the loss, you could use a larger number than 4096 to
148
get around the actual use of division.  Like take 8192/Q and then divide by 8192.*/
149
 
150
parameter QQ1_1 = 4096/Q1_1;
151
parameter QQ1_2 = 4096/Q1_2;
152
parameter QQ1_3 = 4096/Q1_3;
153
parameter QQ1_4 = 4096/Q1_4;
154
parameter QQ1_5 = 4096/Q1_5;
155
parameter QQ1_6 = 4096/Q1_6;
156
parameter QQ1_7 = 4096/Q1_7;
157
parameter QQ1_8 = 4096/Q1_8;
158
parameter QQ2_1 = 4096/Q2_1;
159
parameter QQ2_2 = 4096/Q2_2;
160
parameter QQ2_3 = 4096/Q2_3;
161
parameter QQ2_4 = 4096/Q2_4;
162
parameter QQ2_5 = 4096/Q2_5;
163
parameter QQ2_6 = 4096/Q2_6;
164
parameter QQ2_7 = 4096/Q2_7;
165
parameter QQ2_8 = 4096/Q2_8;
166
parameter QQ3_1 = 4096/Q3_1;
167
parameter QQ3_2 = 4096/Q3_2;
168
parameter QQ3_3 = 4096/Q3_3;
169
parameter QQ3_4 = 4096/Q3_4;
170
parameter QQ3_5 = 4096/Q3_5;
171
parameter QQ3_6 = 4096/Q3_6;
172
parameter QQ3_7 = 4096/Q3_7;
173
parameter QQ3_8 = 4096/Q3_8;
174
parameter QQ4_1 = 4096/Q4_1;
175
parameter QQ4_2 = 4096/Q4_2;
176
parameter QQ4_3 = 4096/Q4_3;
177
parameter QQ4_4 = 4096/Q4_4;
178
parameter QQ4_5 = 4096/Q4_5;
179
parameter QQ4_6 = 4096/Q4_6;
180
parameter QQ4_7 = 4096/Q4_7;
181
parameter QQ4_8 = 4096/Q4_8;
182
parameter QQ5_1 = 4096/Q5_1;
183
parameter QQ5_2 = 4096/Q5_2;
184
parameter QQ5_3 = 4096/Q5_3;
185
parameter QQ5_4 = 4096/Q5_4;
186
parameter QQ5_5 = 4096/Q5_5;
187
parameter QQ5_6 = 4096/Q5_6;
188
parameter QQ5_7 = 4096/Q5_7;
189
parameter QQ5_8 = 4096/Q5_8;
190
parameter QQ6_1 = 4096/Q6_1;
191
parameter QQ6_2 = 4096/Q6_2;
192
parameter QQ6_3 = 4096/Q6_3;
193
parameter QQ6_4 = 4096/Q6_4;
194
parameter QQ6_5 = 4096/Q6_5;
195
parameter QQ6_6 = 4096/Q6_6;
196
parameter QQ6_7 = 4096/Q6_7;
197
parameter QQ6_8 = 4096/Q6_8;
198
parameter QQ7_1 = 4096/Q7_1;
199
parameter QQ7_2 = 4096/Q7_2;
200
parameter QQ7_3 = 4096/Q7_3;
201
parameter QQ7_4 = 4096/Q7_4;
202
parameter QQ7_5 = 4096/Q7_5;
203
parameter QQ7_6 = 4096/Q7_6;
204
parameter QQ7_7 = 4096/Q7_7;
205
parameter QQ7_8 = 4096/Q7_8;
206
parameter QQ8_1 = 4096/Q8_1;
207
parameter QQ8_2 = 4096/Q8_2;
208
parameter QQ8_3 = 4096/Q8_3;
209
parameter QQ8_4 = 4096/Q8_4;
210
parameter QQ8_5 = 4096/Q8_5;
211
parameter QQ8_6 = 4096/Q8_6;
212
parameter QQ8_7 = 4096/Q8_7;
213
parameter QQ8_8 = 4096/Q8_8;
214
 
215
wire [12:0] QM1_1 = QQ1_1;
216
wire [12:0] QM1_2 = QQ1_2;
217
wire [12:0] QM1_3 = QQ1_3;
218
wire [12:0] QM1_4 = QQ1_4;
219
wire [12:0] QM1_5 = QQ1_5;
220
wire [12:0] QM1_6 = QQ1_6;
221
wire [12:0] QM1_7 = QQ1_7;
222
wire [12:0] QM1_8 = QQ1_8;
223
wire [12:0] QM2_1 = QQ2_1;
224
wire [12:0] QM2_2 = QQ2_2;
225
wire [12:0] QM2_3 = QQ2_3;
226
wire [12:0] QM2_4 = QQ2_4;
227
wire [12:0] QM2_5 = QQ2_5;
228
wire [12:0] QM2_6 = QQ2_6;
229
wire [12:0] QM2_7 = QQ2_7;
230
wire [12:0] QM2_8 = QQ2_8;
231
wire [12:0] QM3_1 = QQ3_1;
232
wire [12:0] QM3_2 = QQ3_2;
233
wire [12:0] QM3_3 = QQ3_3;
234
wire [12:0] QM3_4 = QQ3_4;
235
wire [12:0] QM3_5 = QQ3_5;
236
wire [12:0] QM3_6 = QQ3_6;
237
wire [12:0] QM3_7 = QQ3_7;
238
wire [12:0] QM3_8 = QQ3_8;
239
wire [12:0] QM4_1 = QQ4_1;
240
wire [12:0] QM4_2 = QQ4_2;
241
wire [12:0] QM4_3 = QQ4_3;
242
wire [12:0] QM4_4 = QQ4_4;
243
wire [12:0] QM4_5 = QQ4_5;
244
wire [12:0] QM4_6 = QQ4_6;
245
wire [12:0] QM4_7 = QQ4_7;
246
wire [12:0] QM4_8 = QQ4_8;
247
wire [12:0] QM5_1 = QQ5_1;
248
wire [12:0] QM5_2 = QQ5_2;
249
wire [12:0] QM5_3 = QQ5_3;
250
wire [12:0] QM5_4 = QQ5_4;
251
wire [12:0] QM5_5 = QQ5_5;
252
wire [12:0] QM5_6 = QQ5_6;
253
wire [12:0] QM5_7 = QQ5_7;
254
wire [12:0] QM5_8 = QQ5_8;
255
wire [12:0] QM6_1 = QQ6_1;
256
wire [12:0] QM6_2 = QQ6_2;
257
wire [12:0] QM6_3 = QQ6_3;
258
wire [12:0] QM6_4 = QQ6_4;
259
wire [12:0] QM6_5 = QQ6_5;
260
wire [12:0] QM6_6 = QQ6_6;
261
wire [12:0] QM6_7 = QQ6_7;
262
wire [12:0] QM6_8 = QQ6_8;
263
wire [12:0] QM7_1 = QQ7_1;
264
wire [12:0] QM7_2 = QQ7_2;
265
wire [12:0] QM7_3 = QQ7_3;
266
wire [12:0] QM7_4 = QQ7_4;
267
wire [12:0] QM7_5 = QQ7_5;
268
wire [12:0] QM7_6 = QQ7_6;
269
wire [12:0] QM7_7 = QQ7_7;
270
wire [12:0] QM7_8 = QQ7_8;
271
wire [12:0] QM8_1 = QQ8_1;
272
wire [12:0] QM8_2 = QQ8_2;
273
wire [12:0] QM8_3 = QQ8_3;
274
wire [12:0] QM8_4 = QQ8_4;
275
wire [12:0] QM8_5 = QQ8_5;
276
wire [12:0] QM8_6 = QQ8_6;
277
wire [12:0] QM8_7 = QQ8_7;
278
wire [12:0] QM8_8 = QQ8_8;
279
reg [22:0] Z11_temp, Z12_temp, Z13_temp, Z14_temp, Z15_temp, Z16_temp, Z17_temp, Z18_temp;
280
reg [22:0] Z21_temp, Z22_temp, Z23_temp, Z24_temp, Z25_temp, Z26_temp, Z27_temp, Z28_temp;
281
reg [22:0] Z31_temp, Z32_temp, Z33_temp, Z34_temp, Z35_temp, Z36_temp, Z37_temp, Z38_temp;
282
reg [22:0] Z41_temp, Z42_temp, Z43_temp, Z44_temp, Z45_temp, Z46_temp, Z47_temp, Z48_temp;
283
reg [22:0] Z51_temp, Z52_temp, Z53_temp, Z54_temp, Z55_temp, Z56_temp, Z57_temp, Z58_temp;
284
reg [22:0] Z61_temp, Z62_temp, Z63_temp, Z64_temp, Z65_temp, Z66_temp, Z67_temp, Z68_temp;
285
reg [22:0] Z71_temp, Z72_temp, Z73_temp, Z74_temp, Z75_temp, Z76_temp, Z77_temp, Z78_temp;
286
reg [22:0] Z81_temp, Z82_temp, Z83_temp, Z84_temp, Z85_temp, Z86_temp, Z87_temp, Z88_temp;
287
reg [22:0] Z11_temp_1, Z12_temp_1, Z13_temp_1, Z14_temp_1, Z15_temp_1, Z16_temp_1, Z17_temp_1, Z18_temp_1;
288
reg [22:0] Z21_temp_1, Z22_temp_1, Z23_temp_1, Z24_temp_1, Z25_temp_1, Z26_temp_1, Z27_temp_1, Z28_temp_1;
289
reg [22:0] Z31_temp_1, Z32_temp_1, Z33_temp_1, Z34_temp_1, Z35_temp_1, Z36_temp_1, Z37_temp_1, Z38_temp_1;
290
reg [22:0] Z41_temp_1, Z42_temp_1, Z43_temp_1, Z44_temp_1, Z45_temp_1, Z46_temp_1, Z47_temp_1, Z48_temp_1;
291
reg [22:0] Z51_temp_1, Z52_temp_1, Z53_temp_1, Z54_temp_1, Z55_temp_1, Z56_temp_1, Z57_temp_1, Z58_temp_1;
292
reg [22:0] Z61_temp_1, Z62_temp_1, Z63_temp_1, Z64_temp_1, Z65_temp_1, Z66_temp_1, Z67_temp_1, Z68_temp_1;
293
reg [22:0] Z71_temp_1, Z72_temp_1, Z73_temp_1, Z74_temp_1, Z75_temp_1, Z76_temp_1, Z77_temp_1, Z78_temp_1;
294
reg [22:0] Z81_temp_1, Z82_temp_1, Z83_temp_1, Z84_temp_1, Z85_temp_1, Z86_temp_1, Z87_temp_1, Z88_temp_1;
295
reg [10:0] Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18;
296
reg [10:0] Q21, Q22, Q23, Q24, Q25, Q26, Q27, Q28;
297
reg [10:0] Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38;
298
reg [10:0] Q41, Q42, Q43, Q44, Q45, Q46, Q47, Q48;
299
reg [10:0] Q51, Q52, Q53, Q54, Q55, Q56, Q57, Q58;
300
reg [10:0] Q61, Q62, Q63, Q64, Q65, Q66, Q67, Q68;
301
reg [10:0] Q71, Q72, Q73, Q74, Q75, Q76, Q77, Q78;
302
reg [10:0] Q81, Q82, Q83, Q84, Q85, Q86, Q87, Q88;
303
reg out_enable, enable_1, enable_2, enable_3;
304
integer Z11_int, Z12_int, Z13_int, Z14_int, Z15_int, Z16_int, Z17_int, Z18_int;
305
integer Z21_int, Z22_int, Z23_int, Z24_int, Z25_int, Z26_int, Z27_int, Z28_int;
306
integer Z31_int, Z32_int, Z33_int, Z34_int, Z35_int, Z36_int, Z37_int, Z38_int;
307
integer Z41_int, Z42_int, Z43_int, Z44_int, Z45_int, Z46_int, Z47_int, Z48_int;
308
integer Z51_int, Z52_int, Z53_int, Z54_int, Z55_int, Z56_int, Z57_int, Z58_int;
309
integer Z61_int, Z62_int, Z63_int, Z64_int, Z65_int, Z66_int, Z67_int, Z68_int;
310
integer Z71_int, Z72_int, Z73_int, Z74_int, Z75_int, Z76_int, Z77_int, Z78_int;
311
integer Z81_int, Z82_int, Z83_int, Z84_int, Z85_int, Z86_int, Z87_int, Z88_int;
312
 
313
always @(posedge clk)
314
begin
315
        if (rst) begin
316
                Z11_int <= 0; Z12_int <= 0; Z13_int <= 0; Z14_int <= 0;
317
                Z15_int <= 0; Z16_int <= 0; Z17_int <= 0; Z18_int <= 0;
318
                Z21_int <= 0; Z22_int <= 0; Z23_int <= 0; Z24_int <= 0;
319
                Z25_int <= 0; Z26_int <= 0; Z27_int <= 0; Z28_int <= 0;
320
                Z31_int <= 0; Z32_int <= 0; Z33_int <= 0; Z34_int <= 0;
321
                Z35_int <= 0; Z36_int <= 0; Z37_int <= 0; Z38_int <= 0;
322
                Z41_int <= 0; Z42_int <= 0; Z43_int <= 0; Z44_int <= 0;
323
                Z45_int <= 0; Z46_int <= 0; Z47_int <= 0; Z48_int <= 0;
324
                Z51_int <= 0; Z52_int <= 0; Z53_int <= 0; Z54_int <= 0;
325
                Z55_int <= 0; Z56_int <= 0; Z57_int <= 0; Z58_int <= 0;
326
                Z61_int <= 0; Z62_int <= 0; Z63_int <= 0; Z64_int <= 0;
327
                Z65_int <= 0; Z66_int <= 0; Z67_int <= 0; Z68_int <= 0;
328
                Z71_int <= 0; Z72_int <= 0; Z73_int <= 0; Z74_int <= 0;
329
                Z75_int <= 0; Z76_int <= 0; Z77_int <= 0; Z78_int <= 0;
330
                Z81_int <= 0; Z82_int <= 0; Z83_int <= 0; Z84_int <= 0;
331
                Z85_int <= 0; Z86_int <= 0; Z87_int <= 0; Z88_int <= 0;
332
                end
333
        else if (enable) begin
334
                Z11_int[10:0] <= Z11; Z12_int[10:0] <= Z12; Z13_int[10:0] <= Z13; Z14_int[10:0] <= Z14;
335
                Z15_int[10:0] <= Z15; Z16_int[10:0] <= Z16; Z17_int[10:0] <= Z17; Z18_int[10:0] <= Z18;
336
                Z21_int[10:0] <= Z21; Z22_int[10:0] <= Z22; Z23_int[10:0] <= Z23; Z24_int[10:0] <= Z24;
337
                Z25_int[10:0] <= Z25; Z26_int[10:0] <= Z26; Z27_int[10:0] <= Z27; Z28_int[10:0] <= Z28;
338
                Z31_int[10:0] <= Z31; Z32_int[10:0] <= Z32; Z33_int[10:0] <= Z33; Z34_int[10:0] <= Z34;
339
                Z35_int[10:0] <= Z35; Z36_int[10:0] <= Z36; Z37_int[10:0] <= Z37; Z38_int[10:0] <= Z38;
340
                Z41_int[10:0] <= Z41; Z42_int[10:0] <= Z42; Z43_int[10:0] <= Z43; Z44_int[10:0] <= Z44;
341
                Z45_int[10:0] <= Z45; Z46_int[10:0] <= Z46; Z47_int[10:0] <= Z47; Z48_int[10:0] <= Z48;
342
                Z51_int[10:0] <= Z51; Z52_int[10:0] <= Z52; Z53_int[10:0] <= Z53; Z54_int[10:0] <= Z54;
343
                Z55_int[10:0] <= Z55; Z56_int[10:0] <= Z56; Z57_int[10:0] <= Z57; Z58_int[10:0] <= Z58;
344
                Z61_int[10:0] <= Z61; Z62_int[10:0] <= Z62; Z63_int[10:0] <= Z63; Z64_int[10:0] <= Z64;
345
                Z65_int[10:0] <= Z65; Z66_int[10:0] <= Z66; Z67_int[10:0] <= Z67; Z68_int[10:0] <= Z68;
346
                Z71_int[10:0] <= Z71; Z72_int[10:0] <= Z72; Z73_int[10:0] <= Z73; Z74_int[10:0] <= Z74;
347
                Z75_int[10:0] <= Z75; Z76_int[10:0] <= Z76; Z77_int[10:0] <= Z77; Z78_int[10:0] <= Z78;
348
                Z81_int[10:0] <= Z81; Z82_int[10:0] <= Z82; Z83_int[10:0] <= Z83; Z84_int[10:0] <= Z84;
349
                Z85_int[10:0] <= Z85; Z86_int[10:0] <= Z86; Z87_int[10:0] <= Z87; Z88_int[10:0] <= Z88;
350
                // sign extend to make Z11_int a twos complement representation of Z11
351
                Z11_int[31:11] <= Z11[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
352
                Z12_int[31:11] <= Z12[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
353
                Z13_int[31:11] <= Z13[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
354
                Z14_int[31:11] <= Z14[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
355
                Z15_int[31:11] <= Z15[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
356
                Z16_int[31:11] <= Z16[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
357
                Z17_int[31:11] <= Z17[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
358
                Z18_int[31:11] <= Z18[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
359
                Z21_int[31:11] <= Z21[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
360
                Z22_int[31:11] <= Z22[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
361
                Z23_int[31:11] <= Z23[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
362
                Z24_int[31:11] <= Z24[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
363
                Z25_int[31:11] <= Z25[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
364
                Z26_int[31:11] <= Z26[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
365
                Z27_int[31:11] <= Z27[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
366
                Z28_int[31:11] <= Z28[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
367
                Z31_int[31:11] <= Z31[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
368
                Z32_int[31:11] <= Z32[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
369
                Z33_int[31:11] <= Z33[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
370
                Z34_int[31:11] <= Z34[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
371
                Z35_int[31:11] <= Z35[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
372
                Z36_int[31:11] <= Z36[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
373
                Z37_int[31:11] <= Z37[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
374
                Z38_int[31:11] <= Z38[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
375
                Z41_int[31:11] <= Z41[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
376
                Z42_int[31:11] <= Z42[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
377
                Z43_int[31:11] <= Z43[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
378
                Z44_int[31:11] <= Z44[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
379
                Z45_int[31:11] <= Z45[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
380
                Z46_int[31:11] <= Z46[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
381
                Z47_int[31:11] <= Z47[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
382
                Z48_int[31:11] <= Z48[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
383
                Z51_int[31:11] <= Z51[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
384
                Z52_int[31:11] <= Z52[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
385
                Z53_int[31:11] <= Z53[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
386
                Z54_int[31:11] <= Z54[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
387
                Z55_int[31:11] <= Z55[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
388
                Z56_int[31:11] <= Z56[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
389
                Z57_int[31:11] <= Z57[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
390
                Z58_int[31:11] <= Z58[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
391
                Z61_int[31:11] <= Z61[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
392
                Z62_int[31:11] <= Z62[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
393
                Z63_int[31:11] <= Z63[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
394
                Z64_int[31:11] <= Z64[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
395
                Z65_int[31:11] <= Z65[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
396
                Z66_int[31:11] <= Z66[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
397
                Z67_int[31:11] <= Z67[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
398
                Z68_int[31:11] <= Z68[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
399
                Z71_int[31:11] <= Z71[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
400
                Z72_int[31:11] <= Z72[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
401
                Z73_int[31:11] <= Z73[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
402
                Z74_int[31:11] <= Z74[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
403
                Z75_int[31:11] <= Z75[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
404
                Z76_int[31:11] <= Z76[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
405
                Z77_int[31:11] <= Z77[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
406
                Z78_int[31:11] <= Z78[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
407
                Z81_int[31:11] <= Z81[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
408
                Z82_int[31:11] <= Z82[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
409
                Z83_int[31:11] <= Z83[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
410
                Z84_int[31:11] <= Z84[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
411
                Z85_int[31:11] <= Z85[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
412
                Z86_int[31:11] <= Z86[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
413
                Z87_int[31:11] <= Z87[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
414
                Z88_int[31:11] <= Z88[10] ? 21'b111111111111111111111 : 21'b000000000000000000000;
415
                end
416
end
417
 
418
always @(posedge clk)
419
begin
420
        if (rst) begin
421
                Z11_temp <= 0; Z12_temp <= 0; Z13_temp <= 0; Z14_temp <= 0;
422
                Z12_temp <= 0; Z16_temp <= 0; Z17_temp <= 0; Z18_temp <= 0;
423
                Z21_temp <= 0; Z22_temp <= 0; Z23_temp <= 0; Z24_temp <= 0;
424
                Z22_temp <= 0; Z26_temp <= 0; Z27_temp <= 0; Z28_temp <= 0;
425
                Z31_temp <= 0; Z32_temp <= 0; Z33_temp <= 0; Z34_temp <= 0;
426
                Z32_temp <= 0; Z36_temp <= 0; Z37_temp <= 0; Z38_temp <= 0;
427
                Z41_temp <= 0; Z42_temp <= 0; Z43_temp <= 0; Z44_temp <= 0;
428
                Z42_temp <= 0; Z46_temp <= 0; Z47_temp <= 0; Z48_temp <= 0;
429
                Z51_temp <= 0; Z52_temp <= 0; Z53_temp <= 0; Z54_temp <= 0;
430
                Z52_temp <= 0; Z56_temp <= 0; Z57_temp <= 0; Z58_temp <= 0;
431
                Z61_temp <= 0; Z62_temp <= 0; Z63_temp <= 0; Z64_temp <= 0;
432
                Z62_temp <= 0; Z66_temp <= 0; Z67_temp <= 0; Z68_temp <= 0;
433
                Z71_temp <= 0; Z72_temp <= 0; Z73_temp <= 0; Z74_temp <= 0;
434
                Z72_temp <= 0; Z76_temp <= 0; Z77_temp <= 0; Z78_temp <= 0;
435
                Z81_temp <= 0; Z82_temp <= 0; Z83_temp <= 0; Z84_temp <= 0;
436
                Z82_temp <= 0; Z86_temp <= 0; Z87_temp <= 0; Z88_temp <= 0;
437
                end
438
        else if (enable_1) begin
439
                Z11_temp <= Z11_int * QM1_1; Z12_temp <= Z12_int * QM1_2;
440
                Z13_temp <= Z13_int * QM1_3; Z14_temp <= Z14_int * QM1_4;
441
                Z15_temp <= Z15_int * QM1_5; Z16_temp <= Z16_int * QM1_6;
442
                Z17_temp <= Z17_int * QM1_7; Z18_temp <= Z18_int * QM1_8;
443
                Z21_temp <= Z21_int * QM2_1; Z22_temp <= Z22_int * QM2_2;
444
                Z23_temp <= Z23_int * QM2_3; Z24_temp <= Z24_int * QM2_4;
445
                Z25_temp <= Z25_int * QM2_5; Z26_temp <= Z26_int * QM2_6;
446
                Z27_temp <= Z27_int * QM2_7; Z28_temp <= Z28_int * QM2_8;
447
                Z31_temp <= Z31_int * QM3_1; Z32_temp <= Z32_int * QM3_2;
448
                Z33_temp <= Z33_int * QM3_3; Z34_temp <= Z34_int * QM3_4;
449
                Z35_temp <= Z35_int * QM3_5; Z36_temp <= Z36_int * QM3_6;
450
                Z37_temp <= Z37_int * QM3_7; Z38_temp <= Z38_int * QM3_8;
451
                Z41_temp <= Z41_int * QM4_1; Z42_temp <= Z42_int * QM4_2;
452
                Z43_temp <= Z43_int * QM4_3; Z44_temp <= Z44_int * QM4_4;
453
                Z45_temp <= Z45_int * QM4_5; Z46_temp <= Z46_int * QM4_6;
454
                Z47_temp <= Z47_int * QM4_7; Z48_temp <= Z48_int * QM4_8;
455
                Z51_temp <= Z51_int * QM5_1; Z52_temp <= Z52_int * QM5_2;
456
                Z53_temp <= Z53_int * QM5_3; Z54_temp <= Z54_int * QM5_4;
457
                Z55_temp <= Z55_int * QM5_5; Z56_temp <= Z56_int * QM5_6;
458
                Z57_temp <= Z57_int * QM5_7; Z58_temp <= Z58_int * QM5_8;
459
                Z61_temp <= Z61_int * QM6_1; Z62_temp <= Z62_int * QM6_2;
460
                Z63_temp <= Z63_int * QM6_3; Z64_temp <= Z64_int * QM6_4;
461
                Z65_temp <= Z65_int * QM6_5; Z66_temp <= Z66_int * QM6_6;
462
                Z67_temp <= Z67_int * QM6_7; Z68_temp <= Z68_int * QM6_8;
463
                Z71_temp <= Z71_int * QM7_1; Z72_temp <= Z72_int * QM7_2;
464
                Z73_temp <= Z73_int * QM7_3; Z74_temp <= Z74_int * QM7_4;
465
                Z75_temp <= Z75_int * QM7_5; Z76_temp <= Z76_int * QM7_6;
466
                Z77_temp <= Z77_int * QM7_7; Z78_temp <= Z78_int * QM7_8;
467
                Z81_temp <= Z81_int * QM8_1; Z82_temp <= Z82_int * QM8_2;
468
                Z83_temp <= Z83_int * QM8_3; Z84_temp <= Z84_int * QM8_4;
469
                Z85_temp <= Z85_int * QM8_5; Z86_temp <= Z86_int * QM8_6;
470
                Z87_temp <= Z87_int * QM8_7; Z88_temp <= Z88_int * QM8_8;
471
                end
472
end
473
 
474
 
475
always @(posedge clk)
476
begin
477
        if (rst) begin
478
                Z11_temp_1 <= 0; Z12_temp_1 <= 0; Z13_temp_1 <= 0; Z14_temp_1 <= 0;
479
                Z12_temp_1 <= 0; Z16_temp_1 <= 0; Z17_temp_1 <= 0; Z18_temp_1 <= 0;
480
                Z21_temp_1 <= 0; Z22_temp_1 <= 0; Z23_temp_1 <= 0; Z24_temp_1 <= 0;
481
                Z22_temp_1 <= 0; Z26_temp_1 <= 0; Z27_temp_1 <= 0; Z28_temp_1 <= 0;
482
                Z31_temp_1 <= 0; Z32_temp_1 <= 0; Z33_temp_1 <= 0; Z34_temp_1 <= 0;
483
                Z32_temp_1 <= 0; Z36_temp_1 <= 0; Z37_temp_1 <= 0; Z38_temp_1 <= 0;
484
                Z41_temp_1 <= 0; Z42_temp_1 <= 0; Z43_temp_1 <= 0; Z44_temp_1 <= 0;
485
                Z42_temp_1 <= 0; Z46_temp_1 <= 0; Z47_temp_1 <= 0; Z48_temp_1 <= 0;
486
                Z51_temp_1 <= 0; Z52_temp_1 <= 0; Z53_temp_1 <= 0; Z54_temp_1 <= 0;
487
                Z52_temp_1 <= 0; Z56_temp_1 <= 0; Z57_temp_1 <= 0; Z58_temp_1 <= 0;
488
                Z61_temp_1 <= 0; Z62_temp_1 <= 0; Z63_temp_1 <= 0; Z64_temp_1 <= 0;
489
                Z62_temp_1 <= 0; Z66_temp_1 <= 0; Z67_temp_1 <= 0; Z68_temp_1 <= 0;
490
                Z71_temp_1 <= 0; Z72_temp_1 <= 0; Z73_temp_1 <= 0; Z74_temp_1 <= 0;
491
                Z72_temp_1 <= 0; Z76_temp_1 <= 0; Z77_temp_1 <= 0; Z78_temp_1 <= 0;
492
                Z81_temp_1 <= 0; Z82_temp_1 <= 0; Z83_temp_1 <= 0; Z84_temp_1 <= 0;
493
                Z82_temp_1 <= 0; Z86_temp_1 <= 0; Z87_temp_1 <= 0; Z88_temp_1 <= 0;
494
                end
495
        else if (enable_2) begin
496
                Z11_temp_1 <= Z11_temp; Z12_temp_1 <= Z12_temp;
497
                Z13_temp_1 <= Z13_temp; Z14_temp_1 <= Z14_temp;
498
                Z15_temp_1 <= Z15_temp; Z16_temp_1 <= Z16_temp;
499
                Z17_temp_1 <= Z17_temp; Z18_temp_1 <= Z18_temp;
500
                Z21_temp_1 <= Z21_temp; Z22_temp_1 <= Z22_temp;
501
                Z23_temp_1 <= Z23_temp; Z24_temp_1 <= Z24_temp;
502
                Z25_temp_1 <= Z25_temp; Z26_temp_1 <= Z26_temp;
503
                Z27_temp_1 <= Z27_temp; Z28_temp_1 <= Z28_temp;
504
                Z31_temp_1 <= Z31_temp; Z32_temp_1 <= Z32_temp;
505
                Z33_temp_1 <= Z33_temp; Z34_temp_1 <= Z34_temp;
506
                Z35_temp_1 <= Z35_temp; Z36_temp_1 <= Z36_temp;
507
                Z37_temp_1 <= Z37_temp; Z38_temp_1 <= Z38_temp;
508
                Z41_temp_1 <= Z41_temp; Z42_temp_1 <= Z42_temp;
509
                Z43_temp_1 <= Z43_temp; Z44_temp_1 <= Z44_temp;
510
                Z45_temp_1 <= Z45_temp; Z46_temp_1 <= Z46_temp;
511
                Z47_temp_1 <= Z47_temp; Z48_temp_1 <= Z48_temp;
512
                Z51_temp_1 <= Z51_temp; Z52_temp_1 <= Z52_temp;
513
                Z53_temp_1 <= Z53_temp; Z54_temp_1 <= Z54_temp;
514
                Z55_temp_1 <= Z55_temp; Z56_temp_1 <= Z56_temp;
515
                Z57_temp_1 <= Z57_temp; Z58_temp_1 <= Z58_temp;
516
                Z61_temp_1 <= Z61_temp; Z62_temp_1 <= Z62_temp;
517
                Z63_temp_1 <= Z63_temp; Z64_temp_1 <= Z64_temp;
518
                Z65_temp_1 <= Z65_temp; Z66_temp_1 <= Z66_temp;
519
                Z67_temp_1 <= Z67_temp; Z68_temp_1 <= Z68_temp;
520
                Z71_temp_1 <= Z71_temp; Z72_temp_1 <= Z72_temp;
521
                Z73_temp_1 <= Z73_temp; Z74_temp_1 <= Z74_temp;
522
                Z75_temp_1 <= Z75_temp; Z76_temp_1 <= Z76_temp;
523
                Z77_temp_1 <= Z77_temp; Z78_temp_1 <= Z78_temp;
524
                Z81_temp_1 <= Z81_temp; Z82_temp_1 <= Z82_temp;
525
                Z83_temp_1 <= Z83_temp; Z84_temp_1 <= Z84_temp;
526
                Z85_temp_1 <= Z85_temp; Z86_temp_1 <= Z86_temp;
527
                Z87_temp_1 <= Z87_temp; Z88_temp_1 <= Z88_temp;
528
                end
529
end
530
 
531
always @(posedge clk)
532
begin
533
        if (rst) begin
534
                Q11 <= 0; Q12 <= 0; Q13 <= 0; Q14 <= 0; Q15 <= 0; Q16 <= 0; Q17 <= 0; Q18 <= 0;
535
                Q21 <= 0; Q22 <= 0; Q23 <= 0; Q24 <= 0; Q25 <= 0; Q26 <= 0; Q27 <= 0; Q28 <= 0;
536
                Q31 <= 0; Q32 <= 0; Q33 <= 0; Q34 <= 0; Q35 <= 0; Q36 <= 0; Q37 <= 0; Q38 <= 0;
537
                Q41 <= 0; Q42 <= 0; Q43 <= 0; Q44 <= 0; Q45 <= 0; Q46 <= 0; Q47 <= 0; Q48 <= 0;
538
                Q51 <= 0; Q52 <= 0; Q53 <= 0; Q54 <= 0; Q55 <= 0; Q56 <= 0; Q57 <= 0; Q58 <= 0;
539
                Q61 <= 0; Q62 <= 0; Q63 <= 0; Q64 <= 0; Q65 <= 0; Q66 <= 0; Q67 <= 0; Q68 <= 0;
540
                Q71 <= 0; Q72 <= 0; Q73 <= 0; Q74 <= 0; Q75 <= 0; Q76 <= 0; Q77 <= 0; Q78 <= 0;
541
                Q81 <= 0; Q82 <= 0; Q83 <= 0; Q84 <= 0; Q85 <= 0; Q86 <= 0; Q87 <= 0; Q88 <= 0;
542
                end
543
        else if (enable_3) begin
544
                // rounding Q11 based on the bit in the 11th place of Z11_temp  
545
                Q11 <= Z11_temp_1[11] ? Z11_temp_1[22:12] + 1 : Z11_temp_1[22:12];
546
                Q12 <= Z12_temp_1[11] ? Z12_temp_1[22:12] + 1 : Z12_temp_1[22:12];
547
                Q13 <= Z13_temp_1[11] ? Z13_temp_1[22:12] + 1 : Z13_temp_1[22:12];
548
                Q14 <= Z14_temp_1[11] ? Z14_temp_1[22:12] + 1 : Z14_temp_1[22:12];
549
                Q15 <= Z15_temp_1[11] ? Z15_temp_1[22:12] + 1 : Z15_temp_1[22:12];
550
                Q16 <= Z16_temp_1[11] ? Z16_temp_1[22:12] + 1 : Z16_temp_1[22:12];
551
                Q17 <= Z17_temp_1[11] ? Z17_temp_1[22:12] + 1 : Z17_temp_1[22:12];
552
                Q18 <= Z18_temp_1[11] ? Z18_temp_1[22:12] + 1 : Z18_temp_1[22:12];
553
                Q21 <= Z21_temp_1[11] ? Z21_temp_1[22:12] + 1 : Z21_temp_1[22:12];
554
                Q22 <= Z22_temp_1[11] ? Z22_temp_1[22:12] + 1 : Z22_temp_1[22:12];
555
                Q23 <= Z23_temp_1[11] ? Z23_temp_1[22:12] + 1 : Z23_temp_1[22:12];
556
                Q24 <= Z24_temp_1[11] ? Z24_temp_1[22:12] + 1 : Z24_temp_1[22:12];
557
                Q25 <= Z25_temp_1[11] ? Z25_temp_1[22:12] + 1 : Z25_temp_1[22:12];
558
                Q26 <= Z26_temp_1[11] ? Z26_temp_1[22:12] + 1 : Z26_temp_1[22:12];
559
                Q27 <= Z27_temp_1[11] ? Z27_temp_1[22:12] + 1 : Z27_temp_1[22:12];
560
                Q28 <= Z28_temp_1[11] ? Z28_temp_1[22:12] + 1 : Z28_temp_1[22:12];
561
                Q31 <= Z31_temp_1[11] ? Z31_temp_1[22:12] + 1 : Z31_temp_1[22:12];
562
                Q32 <= Z32_temp_1[11] ? Z32_temp_1[22:12] + 1 : Z32_temp_1[22:12];
563
                Q33 <= Z33_temp_1[11] ? Z33_temp_1[22:12] + 1 : Z33_temp_1[22:12];
564
                Q34 <= Z34_temp_1[11] ? Z34_temp_1[22:12] + 1 : Z34_temp_1[22:12];
565
                Q35 <= Z35_temp_1[11] ? Z35_temp_1[22:12] + 1 : Z35_temp_1[22:12];
566
                Q36 <= Z36_temp_1[11] ? Z36_temp_1[22:12] + 1 : Z36_temp_1[22:12];
567
                Q37 <= Z37_temp_1[11] ? Z37_temp_1[22:12] + 1 : Z37_temp_1[22:12];
568
                Q38 <= Z38_temp_1[11] ? Z38_temp_1[22:12] + 1 : Z38_temp_1[22:12];
569
                Q41 <= Z41_temp_1[11] ? Z41_temp_1[22:12] + 1 : Z41_temp_1[22:12];
570
                Q42 <= Z42_temp_1[11] ? Z42_temp_1[22:12] + 1 : Z42_temp_1[22:12];
571
                Q43 <= Z43_temp_1[11] ? Z43_temp_1[22:12] + 1 : Z43_temp_1[22:12];
572
                Q44 <= Z44_temp_1[11] ? Z44_temp_1[22:12] + 1 : Z44_temp_1[22:12];
573
                Q45 <= Z45_temp_1[11] ? Z45_temp_1[22:12] + 1 : Z45_temp_1[22:12];
574
                Q46 <= Z46_temp_1[11] ? Z46_temp_1[22:12] + 1 : Z46_temp_1[22:12];
575
                Q47 <= Z47_temp_1[11] ? Z47_temp_1[22:12] + 1 : Z47_temp_1[22:12];
576
                Q48 <= Z48_temp_1[11] ? Z48_temp_1[22:12] + 1 : Z48_temp_1[22:12];
577
                Q51 <= Z51_temp_1[11] ? Z51_temp_1[22:12] + 1 : Z51_temp_1[22:12];
578
                Q52 <= Z52_temp_1[11] ? Z52_temp_1[22:12] + 1 : Z52_temp_1[22:12];
579
                Q53 <= Z53_temp_1[11] ? Z53_temp_1[22:12] + 1 : Z53_temp_1[22:12];
580
                Q54 <= Z54_temp_1[11] ? Z54_temp_1[22:12] + 1 : Z54_temp_1[22:12];
581
                Q55 <= Z55_temp_1[11] ? Z55_temp_1[22:12] + 1 : Z55_temp_1[22:12];
582
                Q56 <= Z56_temp_1[11] ? Z56_temp_1[22:12] + 1 : Z56_temp_1[22:12];
583
                Q57 <= Z57_temp_1[11] ? Z57_temp_1[22:12] + 1 : Z57_temp_1[22:12];
584
                Q58 <= Z58_temp_1[11] ? Z58_temp_1[22:12] + 1 : Z58_temp_1[22:12];
585
                Q61 <= Z61_temp_1[11] ? Z61_temp_1[22:12] + 1 : Z61_temp_1[22:12];
586
                Q62 <= Z62_temp_1[11] ? Z62_temp_1[22:12] + 1 : Z62_temp_1[22:12];
587
                Q63 <= Z63_temp_1[11] ? Z63_temp_1[22:12] + 1 : Z63_temp_1[22:12];
588
                Q64 <= Z64_temp_1[11] ? Z64_temp_1[22:12] + 1 : Z64_temp_1[22:12];
589
                Q65 <= Z65_temp_1[11] ? Z65_temp_1[22:12] + 1 : Z65_temp_1[22:12];
590
                Q66 <= Z66_temp_1[11] ? Z66_temp_1[22:12] + 1 : Z66_temp_1[22:12];
591
                Q67 <= Z67_temp_1[11] ? Z67_temp_1[22:12] + 1 : Z67_temp_1[22:12];
592
                Q68 <= Z68_temp_1[11] ? Z68_temp_1[22:12] + 1 : Z68_temp_1[22:12];
593
                Q71 <= Z71_temp_1[11] ? Z71_temp_1[22:12] + 1 : Z71_temp_1[22:12];
594
                Q72 <= Z72_temp_1[11] ? Z72_temp_1[22:12] + 1 : Z72_temp_1[22:12];
595
                Q73 <= Z73_temp_1[11] ? Z73_temp_1[22:12] + 1 : Z73_temp_1[22:12];
596
                Q74 <= Z74_temp_1[11] ? Z74_temp_1[22:12] + 1 : Z74_temp_1[22:12];
597
                Q75 <= Z75_temp_1[11] ? Z75_temp_1[22:12] + 1 : Z75_temp_1[22:12];
598
                Q76 <= Z76_temp_1[11] ? Z76_temp_1[22:12] + 1 : Z76_temp_1[22:12];
599
                Q77 <= Z77_temp_1[11] ? Z77_temp_1[22:12] + 1 : Z77_temp_1[22:12];
600
                Q78 <= Z78_temp_1[11] ? Z78_temp_1[22:12] + 1 : Z78_temp_1[22:12];
601
                Q81 <= Z81_temp_1[11] ? Z81_temp_1[22:12] + 1 : Z81_temp_1[22:12];
602
                Q82 <= Z82_temp_1[11] ? Z82_temp_1[22:12] + 1 : Z82_temp_1[22:12];
603
                Q83 <= Z83_temp_1[11] ? Z83_temp_1[22:12] + 1 : Z83_temp_1[22:12];
604
                Q84 <= Z84_temp_1[11] ? Z84_temp_1[22:12] + 1 : Z84_temp_1[22:12];
605
                Q85 <= Z85_temp_1[11] ? Z85_temp_1[22:12] + 1 : Z85_temp_1[22:12];
606
                Q86 <= Z86_temp_1[11] ? Z86_temp_1[22:12] + 1 : Z86_temp_1[22:12];
607
                Q87 <= Z87_temp_1[11] ? Z87_temp_1[22:12] + 1 : Z87_temp_1[22:12];
608
                Q88 <= Z88_temp_1[11] ? Z88_temp_1[22:12] + 1 : Z88_temp_1[22:12];
609
                end
610
end
611
 
612
 
613
/* enable_1 is delayed one clock cycle from enable, and it's used to
614
enable the logic that needs to execute on the clock cycle after enable goes high
615
enable_2 is delayed two clock cycles, and out_enable signals the next module
616
that its input data is ready*/
617
 
618
always @(posedge clk)
619
begin
620
        if (rst) begin
621
                enable_1 <= 0; enable_2 <= 0; enable_3 <= 0;
622
                out_enable <= 0;
623
                end
624
        else begin
625
                enable_1 <= enable; enable_2 <= enable_1;
626
                enable_3 <= enable_2;
627
                out_enable <= enable_3;
628
                end
629
end
630
 
631
endmodule

powered by: WebSVN 2.1.0

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