-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtractAlphaCorrRange1234.vhd
executable file
·472 lines (444 loc) · 12.3 KB
/
ExtractAlphaCorrRange1234.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 14:27:40 02/06/2023
-- Design Name:
-- Module Name: ExtractAlphaCorrRange1234 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library ieee, ieee_proposed;
--library ieee;
USE ieee.std_logic_1164.ALL;
use ieee_proposed.fixed_pkg.all;
--use ieee_proposed.fixed_synth.all;
use work.p_fphdl_package1.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity ExtractAlphaCorrRange1234 is
port (
i_clock : in std_logic;
i_reset : in std_logic;
i_run : in std_logic;
i_ee0x243d : in slv16; -- ksto1ee,ksto2ee
i_ee0x243e : in slv16; -- ksto3ee,ksto4ee
i_ee0x243f : in slv16; -- kstoscale,ct34param
o_alphacorrrange1 : out fd2ft;
o_alphacorrrange2 : out fd2ft;
o_alphacorrrange3 : out fd2ft;
o_alphacorrrange4 : out fd2ft;
o_rdy : out std_logic
);
end ExtractAlphaCorrRange1234;
architecture Behavioral of ExtractAlphaCorrRange1234 is
COMPONENT ExtractCT34Parameter
PORT(
i_clock : IN std_logic;
i_reset : IN std_logic;
i_ee0x243f : IN slv16;
o_ct3 : OUT fd2ft;
o_ct4 : OUT fd2ft
);
END COMPONENT;
signal ExtractCT34Parameter_clock : std_logic;
signal ExtractCT34Parameter_reset : std_logic;
signal ExtractCT34Parameter_ee0x243f : slv16;
signal ExtractCT34Parameter_ct3 : fd2ft;
signal ExtractCT34Parameter_ct4 : fd2ft;
component ExtractKsTo1234Parameters is
port (
i_clock : in std_logic;
i_reset : in std_logic;
i_run : in std_logic;
i_ee0x243f : in slv16; -- kstoscale
i_ee0x243d : in slv16; -- ksto1ee,ksto2ee
i_ee0x243e : in slv16; -- ksto3ee,ksto4ee
o_ksto1 : out fd2ft;
o_ksto2 : out fd2ft;
o_ksto3 : out fd2ft;
o_ksto4 : out fd2ft;
o_rdy : out std_logic
);
end component ExtractKsTo1234Parameters;
signal ExtractKsTo1234Parameters_clock : std_logic;
signal ExtractKsTo1234Parameters_reset : std_logic;
signal ExtractKsTo1234Parameters_run : std_logic;
signal ExtractKsTo1234Parameters_ee0x243f : slv16; -- kstoscale
signal ExtractKsTo1234Parameters_ee0x243d : slv16; -- ksto1ee,ksto2ee
signal ExtractKsTo1234Parameters_ee0x243e : slv16; -- ksto3ee,ksto4ee
signal ExtractKsTo1234Parameters_ksto1 : fd2ft;
signal ExtractKsTo1234Parameters_ksto2 : fd2ft;
signal ExtractKsTo1234Parameters_ksto3 : fd2ft;
signal ExtractKsTo1234Parameters_ksto4 : fd2ft;
signal ExtractKsTo1234Parameters_rdy : std_logic;
COMPONENT divfp
PORT (
a : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
b : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
operation_nd : IN STD_LOGIC;
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
ce : IN STD_LOGIC;
result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
rdy : OUT STD_LOGIC
);
END COMPONENT;
signal divfpa : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal divfpb : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal divfpond : STD_LOGIC;
signal divfpclk : STD_LOGIC;
signal divfpsclr : STD_LOGIC;
signal divfpce : STD_LOGIC;
signal divfpr : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal divfprdy : STD_LOGIC;
COMPONENT mulfp
PORT (
a : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
b : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
operation_nd : IN STD_LOGIC;
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
ce : IN STD_LOGIC;
result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
rdy : OUT STD_LOGIC
);
END COMPONENT;
signal mulfpa : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal mulfpb : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal mulfpond : STD_LOGIC;
signal mulfpclk : STD_LOGIC;
signal mulfpsclr : STD_LOGIC;
signal mulfpce : STD_LOGIC;
signal mulfpr : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal mulfprdy : STD_LOGIC;
COMPONENT addfp
PORT (
a : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
b : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
operation_nd : IN STD_LOGIC;
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
ce : IN STD_LOGIC;
result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
rdy : OUT STD_LOGIC
);
END COMPONENT;
signal addfpa : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal addfpb : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal addfpond : STD_LOGIC;
signal addfpclk : STD_LOGIC;
signal addfpsclr : STD_LOGIC;
signal addfpce : STD_LOGIC;
signal addfpr : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal addfprdy : STD_LOGIC;
COMPONENT subfp
PORT (
a : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
b : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
operation_nd : IN STD_LOGIC;
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
ce : IN STD_LOGIC;
result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
rdy : OUT STD_LOGIC
);
END COMPONENT;
signal subfpa : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal subfpb : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal subfpond : STD_LOGIC;
signal subfpclk : STD_LOGIC;
signal subfpsclr : STD_LOGIC;
signal subfpce : STD_LOGIC;
signal subfpr : STD_LOGIC_VECTOR(31 DOWNTO 0);
signal subfprdy : STD_LOGIC;
begin
p0 : process (i_clock) is
variable const1 : fd2ft := x"3F800000";
variable const40 : fd2ft := x"42200000";
variable valphacorrrange1 : fd2ft;
variable valphacorrrange2 : fd2ft;
variable valphacorrrange3 : fd2ft;
variable valphacorrrange4 : fd2ft;
type states is (idle,
s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,
ending);
variable state : states;
begin
if (rising_edge (i_clock)) then
if (i_reset = '1') then
addfpa <= (others => '0');
addfpb <= (others => '0');
subfpa <= (others => '0');
subfpb <= (others => '0');
mulfpa <= (others => '0');
mulfpb <= (others => '0');
divfpa <= (others => '0');
divfpb <= (others => '0');
addfpond <= '0';
subfpond <= '0';
mulfpond <= '0';
divfpond <= '0';
addfpce <= '0';
subfpce <= '0';
mulfpce <= '0';
divfpce <= '0';
addfpsclr <= '1';
subfpsclr <= '1';
mulfpsclr <= '1';
divfpsclr <= '1';
ExtractKsTo1234Parameters_run <= '0';
ExtractCT34Parameter_ee0x243f <= (others => '0');
ExtractKsTo1234Parameters_ee0x243f <= (others => '0');
ExtractKsTo1234Parameters_ee0x243d <= (others => '0');
ExtractKsTo1234Parameters_ee0x243e <= (others => '0');
valphacorrrange1 := (others => '0');
valphacorrrange2 := (others => '0');
valphacorrrange3 := (others => '0');
valphacorrrange4 := (others => '0');
o_rdy <= '0';
o_alphacorrrange1 <= (others => '0');
o_alphacorrrange2 <= (others => '0');
o_alphacorrrange3 <= (others => '0');
o_alphacorrrange4 <= (others => '0');
state := idle;
else
case (state) is
when idle =>
if (i_run = '1') then
state := s1;
else
state := idle;
end if;
addfpsclr <= '0';
subfpsclr <= '0';
mulfpsclr <= '0';
divfpsclr <= '0';
ExtractCT34Parameter_ee0x243f <= i_ee0x243f;
ExtractKsTo1234Parameters_ee0x243f <= i_ee0x243f;
ExtractKsTo1234Parameters_ee0x243d <= i_ee0x243d;
ExtractKsTo1234Parameters_ee0x243e <= i_ee0x243e;
when s1 => state := s2;
ExtractKsTo1234Parameters_run <= '1';
when s2 =>
ExtractKsTo1234Parameters_run <= '0';
if (ExtractKsTo1234Parameters_rdy = '1') then
state := s3;
else
state := s2;
end if;
when s3 => state := s4;
mulfpce <= '1';
mulfpa <= const40;
mulfpb <= ExtractKsTo1234Parameters_ksto1;
mulfpond <= '1';
when s4 =>
if (mulfprdy = '1') then state := s5;
valphacorrrange1 := mulfpr;
mulfpce <= '0';
mulfpond <= '0';
mulfpsclr <= '1';
else state := s4; end if;
when s5 => state := s6;
mulfpsclr <= '0';
addfpce <= '1';
addfpa <= valphacorrrange1;
addfpb <= const1;
addfpond <= '1';
when s6 =>
if (addfprdy = '1') then state := s7;
valphacorrrange1 := addfpr;
addfpce <= '0';
addfpond <= '0';
addfpsclr <= '1';
else state := s6; end if;
when s7 => state := s8;
addfpsclr <= '0';
divfpce <= '1';
divfpa <= const1;
divfpb <= valphacorrrange1;
divfpond <= '1';
when s8 =>
if (divfprdy = '1') then state := s9;
valphacorrrange1 := divfpr;
divfpce <= '0';
divfpond <= '0';
divfpsclr <= '1';
else state := s8; end if;
when s9 => state := s10;
divfpsclr <= '0';
mulfpce <= '1';
mulfpa <= ExtractKsTo1234Parameters_ksto2;
mulfpb <= ExtractCT34Parameter_ct3;
mulfpond <= '1';
when s10 =>
if (mulfprdy = '1') then state := s11;
valphacorrrange3 := mulfpr;
mulfpce <= '0';
mulfpond <= '0';
mulfpsclr <= '1';
else state := s10; end if;
when s11 => state := s12;
mulfpsclr <= '0';
addfpce <= '1';
addfpa <= valphacorrrange3;
addfpb <= const1;
addfpond <= '1';
when s12 =>
if (addfprdy = '1') then state := s13;
valphacorrrange3 := addfpr;
addfpce <= '0';
addfpond <= '0';
addfpsclr <= '1';
else state := s12; end if;
when s13 => state := s14;
addfpsclr <= '0';
subfpce <= '1';
subfpa <= ExtractCT34Parameter_ct4;
subfpb <= ExtractCT34Parameter_ct3;
subfpond <= '1';
when s14 =>
if (subfprdy = '1') then state := s15;
valphacorrrange4 := subfpr;
subfpce <= '0';
subfpond <= '0';
subfpsclr <= '1';
else state := s14; end if;
when s15 => state := s16;
subfpsclr <= '0';
mulfpce <= '1';
mulfpa <= valphacorrrange4;
mulfpb <= ExtractKsTo1234Parameters_ksto3;
mulfpond <= '1';
when s16 =>
if (mulfprdy = '1') then state := s17;
valphacorrrange4 := mulfpr;
mulfpce <= '0';
mulfpond <= '0';
mulfpsclr <= '1';
else state := s16; end if;
when s17 => state := s18;
mulfpsclr <= '0';
addfpce <= '1';
addfpa <= valphacorrrange4;
addfpb <= const1;
addfpond <= '1';
when s18 =>
if (addfprdy = '1') then state := s19;
valphacorrrange4 := addfpr;
addfpce <= '0';
addfpond <= '0';
addfpsclr <= '1';
else state := s18; end if;
when s19 => state := s20;
addfpsclr <= '0';
mulfpce <= '1';
mulfpa <= valphacorrrange3;
mulfpb <= valphacorrrange4;
mulfpond <= '1';
when s20 =>
if (mulfprdy = '1') then state := s21;
valphacorrrange4 := mulfpr;
mulfpce <= '0';
mulfpond <= '0';
mulfpsclr <= '1';
else state := s20; end if;
when s21 => state := idle;
mulfpsclr <= '0';
o_alphacorrrange1 <= valphacorrrange1;
o_alphacorrrange2 <= const1; -- ds p.27 11.1.11
o_alphacorrrange3 <= valphacorrrange3;
o_alphacorrrange4 <= valphacorrrange4;
o_rdy <= '1';
when others => null;
end case;
end if;
end if;
end process p0;
ExtractCT34Parameter_clock <= i_clock;
ExtractCT34Parameter_reset <= i_reset;
inst_ExtractCT34Parameter : ExtractCT34Parameter port map (
i_clock => ExtractCT34Parameter_clock,
i_reset => ExtractCT34Parameter_reset,
i_ee0x243f => ExtractCT34Parameter_ee0x243f,
o_ct3 => ExtractCT34Parameter_ct3,
o_ct4 => ExtractCT34Parameter_ct4
);
ExtractKsTo1234Parameters_clock <= i_clock;
ExtractKsTo1234Parameters_reset <= i_reset;
inst_ExtractKsTo1234Parameters : ExtractKsTo1234Parameters port map (
i_clock => ExtractKsTo1234Parameters_clock,
i_reset => ExtractKsTo1234Parameters_reset,
i_run => ExtractKsTo1234Parameters_run,
i_ee0x243f => ExtractKsTo1234Parameters_ee0x243f,
i_ee0x243d => ExtractKsTo1234Parameters_ee0x243d,
i_ee0x243e => ExtractKsTo1234Parameters_ee0x243e,
o_ksto1 => ExtractKsTo1234Parameters_ksto1,
o_ksto2 => ExtractKsTo1234Parameters_ksto2,
o_ksto3 => ExtractKsTo1234Parameters_ksto3,
o_ksto4 => ExtractKsTo1234Parameters_ksto4,
o_rdy => ExtractKsTo1234Parameters_rdy
);
addfpclk <= i_clock;
subfpclk <= i_clock;
mulfpclk <= i_clock;
divfpclk <= i_clock;
inst_divfp : divfp
PORT MAP (
a => divfpa,
b => divfpb,
operation_nd => divfpond,
clk => divfpclk,
sclr => divfpsclr,
ce => divfpce,
result => divfpr,
rdy => divfprdy
);
inst_mulfp : mulfp
PORT MAP (
a => mulfpa,
b => mulfpb,
operation_nd => mulfpond,
clk => mulfpclk,
sclr => mulfpsclr,
ce => mulfpce,
result => mulfpr,
rdy => mulfprdy
);
inst_addfp : addfp
PORT MAP (
a => addfpa,
b => addfpb,
operation_nd => addfpond,
clk => addfpclk,
sclr => addfpsclr,
ce => addfpce,
result => addfpr,
rdy => addfprdy
);
inst_subfp : subfp
PORT MAP (
a => subfpa,
b => subfpb,
operation_nd => subfpond,
clk => subfpclk,
sclr => subfpsclr,
ce => subfpce,
result => subfpr,
rdy => subfprdy
);
end Behavioral;