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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE12.3/] [MyUserLogic/] [top_level_0_PCIe_UserLogic_00_INOUT_LOGIC/] [inout_logic.vhd] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 barabba
 
2
-------------------------------------------------------------------
3
-- System Generator version 12.3 VHDL source file.
4
--
5
-- Copyright(C) 2010 by Xilinx, Inc.  All rights reserved.  This
6
-- text/file contains proprietary, confidential information of Xilinx,
7
-- Inc., is distributed under license from Xilinx, Inc., and may be used,
8
-- copied and/or disclosed only pursuant to the terms of a valid license
9
-- agreement with Xilinx, Inc.  Xilinx hereby grants you a license to use
10
-- this text/file solely for design, simulation, implementation and
11
-- creation of design files limited to Xilinx devices or technologies.
12
-- Use with non-Xilinx devices or technologies is expressly prohibited
13
-- and immediately terminates your license unless covered by a separate
14
-- agreement.
15
--
16
-- Xilinx is providing this design, code, or information "as is" solely
17
-- for use in developing programs and solutions for Xilinx devices.  By
18
-- providing this design, code, or information as one possible
19
-- implementation of this feature, application or standard, Xilinx is
20
-- making no representation that this implementation is free from any
21
-- claims of infringement.  You are responsible for obtaining any rights
22
-- you may require for your implementation.  Xilinx expressly disclaims
23
-- any warranty whatsoever with respect to the adequacy of the
24
-- implementation, including but not limited to warranties of
25
-- merchantability or fitness for a particular purpose.
26
--
27
-- Xilinx products are not intended for use in life support appliances,
28
-- devices, or systems.  Use in such applications is expressly prohibited.
29
--
30
-- Any modifications that are made to the source code are done at the user's
31
-- sole risk and will be unsupported.
32
--
33
-- This copyright and support notice must be retained as part of this
34
-- text at all times.  (c) Copyright 1995-2010 Xilinx, Inc.  All rights
35
-- reserved.
36
-------------------------------------------------------------------
37
library IEEE;
38
use IEEE.std_logic_1164.all;
39
use IEEE.numeric_std.all;
40
package conv_pkg is
41
    constant simulating : boolean := false
42
      -- synopsys translate_off
43
        or true
44
      -- synopsys translate_on
45
    ;
46
    constant xlUnsigned : integer := 1;
47
    constant xlSigned : integer := 2;
48
    constant xlWrap : integer := 1;
49
    constant xlSaturate : integer := 2;
50
    constant xlTruncate : integer := 1;
51
    constant xlRound : integer := 2;
52
    constant xlRoundBanker : integer := 3;
53
    constant xlAddMode : integer := 1;
54
    constant xlSubMode : integer := 2;
55
    attribute black_box : boolean;
56
    attribute syn_black_box : boolean;
57
    attribute fpga_dont_touch: string;
58
    attribute box_type :  string;
59
    attribute keep : string;
60
    attribute syn_keep : boolean;
61
    function std_logic_vector_to_unsigned(inp : std_logic_vector) return unsigned;
62
    function unsigned_to_std_logic_vector(inp : unsigned) return std_logic_vector;
63
    function std_logic_vector_to_signed(inp : std_logic_vector) return signed;
64
    function signed_to_std_logic_vector(inp : signed) return std_logic_vector;
65
    function unsigned_to_signed(inp : unsigned) return signed;
66
    function signed_to_unsigned(inp : signed) return unsigned;
67
    function pos(inp : std_logic_vector; arith : INTEGER) return boolean;
68
    function all_same(inp: std_logic_vector) return boolean;
69
    function all_zeros(inp: std_logic_vector) return boolean;
70
    function is_point_five(inp: std_logic_vector) return boolean;
71
    function all_ones(inp: std_logic_vector) return boolean;
72
    function convert_type (inp : std_logic_vector; old_width, old_bin_pt,
73
                           old_arith, new_width, new_bin_pt, new_arith,
74
                           quantization, overflow : INTEGER)
75
        return std_logic_vector;
76
    function cast (inp : std_logic_vector; old_bin_pt,
77
                   new_width, new_bin_pt, new_arith : INTEGER)
78
        return std_logic_vector;
79
    function vec_slice (inp : std_logic_vector; upper, lower : INTEGER)
80
        return std_logic_vector;
81
    function s2u_slice (inp : signed; upper, lower : INTEGER)
82
        return unsigned;
83
    function u2u_slice (inp : unsigned; upper, lower : INTEGER)
84
        return unsigned;
85
    function s2s_cast (inp : signed; old_bin_pt,
86
                   new_width, new_bin_pt : INTEGER)
87
        return signed;
88
    function u2s_cast (inp : unsigned; old_bin_pt,
89
                   new_width, new_bin_pt : INTEGER)
90
        return signed;
91
    function s2u_cast (inp : signed; old_bin_pt,
92
                   new_width, new_bin_pt : INTEGER)
93
        return unsigned;
94
    function u2u_cast (inp : unsigned; old_bin_pt,
95
                   new_width, new_bin_pt : INTEGER)
96
        return unsigned;
97
    function u2v_cast (inp : unsigned; old_bin_pt,
98
                   new_width, new_bin_pt : INTEGER)
99
        return std_logic_vector;
100
    function s2v_cast (inp : signed; old_bin_pt,
101
                   new_width, new_bin_pt : INTEGER)
102
        return std_logic_vector;
103
    function trunc (inp : std_logic_vector; old_width, old_bin_pt, old_arith,
104
                    new_width, new_bin_pt, new_arith : INTEGER)
105
        return std_logic_vector;
106
    function round_towards_inf (inp : std_logic_vector; old_width, old_bin_pt,
107
                                old_arith, new_width, new_bin_pt,
108
                                new_arith : INTEGER) return std_logic_vector;
109
    function round_towards_even (inp : std_logic_vector; old_width, old_bin_pt,
110
                                old_arith, new_width, new_bin_pt,
111
                                new_arith : INTEGER) return std_logic_vector;
112
    function max_signed(width : INTEGER) return std_logic_vector;
113
    function min_signed(width : INTEGER) return std_logic_vector;
114
    function saturation_arith(inp:  std_logic_vector;  old_width, old_bin_pt,
115
                              old_arith, new_width, new_bin_pt, new_arith
116
                              : INTEGER) return std_logic_vector;
117
    function wrap_arith(inp:  std_logic_vector;  old_width, old_bin_pt,
118
                        old_arith, new_width, new_bin_pt, new_arith : INTEGER)
119
                        return std_logic_vector;
120
    function fractional_bits(a_bin_pt, b_bin_pt: INTEGER) return INTEGER;
121
    function integer_bits(a_width, a_bin_pt, b_width, b_bin_pt: INTEGER)
122
        return INTEGER;
123
    function sign_ext(inp : std_logic_vector; new_width : INTEGER)
124
        return std_logic_vector;
125
    function zero_ext(inp : std_logic_vector; new_width : INTEGER)
126
        return std_logic_vector;
127
    function zero_ext(inp : std_logic; new_width : INTEGER)
128
        return std_logic_vector;
129
    function extend_MSB(inp : std_logic_vector; new_width, arith : INTEGER)
130
        return std_logic_vector;
131
    function align_input(inp : std_logic_vector; old_width, delta, new_arith,
132
                          new_width: INTEGER)
133
        return std_logic_vector;
134
    function pad_LSB(inp : std_logic_vector; new_width: integer)
135
        return std_logic_vector;
136
    function pad_LSB(inp : std_logic_vector; new_width, arith : integer)
137
        return std_logic_vector;
138
    function max(L, R: INTEGER) return INTEGER;
139
    function min(L, R: INTEGER) return INTEGER;
140
    function "="(left,right: STRING) return boolean;
141
    function boolean_to_signed (inp : boolean; width: integer)
142
        return signed;
143
    function boolean_to_unsigned (inp : boolean; width: integer)
144
        return unsigned;
145
    function boolean_to_vector (inp : boolean)
146
        return std_logic_vector;
147
    function std_logic_to_vector (inp : std_logic)
148
        return std_logic_vector;
149
    function integer_to_std_logic_vector (inp : integer;  width, arith : integer)
150
        return std_logic_vector;
151
    function std_logic_vector_to_integer (inp : std_logic_vector;  arith : integer)
152
        return integer;
153
    function std_logic_to_integer(constant inp : std_logic := '0')
154
        return integer;
155
    function bin_string_element_to_std_logic_vector (inp : string;  width, index : integer)
156
        return std_logic_vector;
157
    function bin_string_to_std_logic_vector (inp : string)
158
        return std_logic_vector;
159
    function hex_string_to_std_logic_vector (inp : string; width : integer)
160
        return std_logic_vector;
161
    function makeZeroBinStr (width : integer) return STRING;
162
    function and_reduce(inp: std_logic_vector) return std_logic;
163
    -- synopsys translate_off
164
    function is_binary_string_invalid (inp : string)
165
        return boolean;
166
    function is_binary_string_undefined (inp : string)
167
        return boolean;
168
    function is_XorU(inp : std_logic_vector)
169
        return boolean;
170
    function to_real(inp : std_logic_vector; bin_pt : integer; arith : integer)
171
        return real;
172
    function std_logic_to_real(inp : std_logic; bin_pt : integer; arith : integer)
173
        return real;
174
    function real_to_std_logic_vector (inp : real;  width, bin_pt, arith : integer)
175
        return std_logic_vector;
176
    function real_string_to_std_logic_vector (inp : string;  width, bin_pt, arith : integer)
177
        return std_logic_vector;
178
    constant display_precision : integer := 20;
179
    function real_to_string (inp : real) return string;
180
    function valid_bin_string(inp : string) return boolean;
181
    function std_logic_vector_to_bin_string(inp : std_logic_vector) return string;
182
    function std_logic_to_bin_string(inp : std_logic) return string;
183
    function std_logic_vector_to_bin_string_w_point(inp : std_logic_vector; bin_pt : integer)
184
        return string;
185
    function real_to_bin_string(inp : real;  width, bin_pt, arith : integer)
186
        return string;
187
    type stdlogic_to_char_t is array(std_logic) of character;
188
    constant to_char : stdlogic_to_char_t := (
189
        'U' => 'U',
190
        'X' => 'X',
191
        '0' => '0',
192
        '1' => '1',
193
        'Z' => 'Z',
194
        'W' => 'W',
195
        'L' => 'L',
196
        'H' => 'H',
197
        '-' => '-');
198
    -- synopsys translate_on
199
end conv_pkg;
200
package body conv_pkg is
201
    function std_logic_vector_to_unsigned(inp : std_logic_vector)
202
        return unsigned
203
    is
204
    begin
205
        return unsigned (inp);
206
    end;
207
    function unsigned_to_std_logic_vector(inp : unsigned)
208
        return std_logic_vector
209
    is
210
    begin
211
        return std_logic_vector(inp);
212
    end;
213
    function std_logic_vector_to_signed(inp : std_logic_vector)
214
        return signed
215
    is
216
    begin
217
        return  signed (inp);
218
    end;
219
    function signed_to_std_logic_vector(inp : signed)
220
        return std_logic_vector
221
    is
222
    begin
223
        return std_logic_vector(inp);
224
    end;
225
    function unsigned_to_signed (inp : unsigned)
226
        return signed
227
    is
228
    begin
229
        return signed(std_logic_vector(inp));
230
    end;
231
    function signed_to_unsigned (inp : signed)
232
        return unsigned
233
    is
234
    begin
235
        return unsigned(std_logic_vector(inp));
236
    end;
237
    function pos(inp : std_logic_vector; arith : INTEGER)
238
        return boolean
239
    is
240
        constant width : integer := inp'length;
241
        variable vec : std_logic_vector(width-1 downto 0);
242
    begin
243
        vec := inp;
244
        if arith = xlUnsigned then
245
            return true;
246
        else
247
            if vec(width-1) = '0' then
248
                return true;
249
            else
250
                return false;
251
            end if;
252
        end if;
253
        return true;
254
    end;
255
    function max_signed(width : INTEGER)
256
        return std_logic_vector
257
    is
258
        variable ones : std_logic_vector(width-2 downto 0);
259
        variable result : std_logic_vector(width-1 downto 0);
260
    begin
261
        ones := (others => '1');
262
        result(width-1) := '0';
263
        result(width-2 downto 0) := ones;
264
        return result;
265
    end;
266
    function min_signed(width : INTEGER)
267
        return std_logic_vector
268
    is
269
        variable zeros : std_logic_vector(width-2 downto 0);
270
        variable result : std_logic_vector(width-1 downto 0);
271
    begin
272
        zeros := (others => '0');
273
        result(width-1) := '1';
274
        result(width-2 downto 0) := zeros;
275
        return result;
276
    end;
277
    function and_reduce(inp: std_logic_vector) return std_logic
278
    is
279
        variable result: std_logic;
280
        constant width : integer := inp'length;
281
        variable vec : std_logic_vector(width-1 downto 0);
282
    begin
283
        vec := inp;
284
        result := vec(0);
285
        if width > 1 then
286
            for i in 1 to width-1 loop
287
                result := result and vec(i);
288
            end loop;
289
        end if;
290
        return result;
291
    end;
292
    function all_same(inp: std_logic_vector) return boolean
293
    is
294
        variable result: boolean;
295
        constant width : integer := inp'length;
296
        variable vec : std_logic_vector(width-1 downto 0);
297
    begin
298
        vec := inp;
299
        result := true;
300
        if width > 0 then
301
            for i in 1 to width-1 loop
302
                if vec(i) /= vec(0) then
303
                    result := false;
304
                end if;
305
            end loop;
306
        end if;
307
        return result;
308
    end;
309
    function all_zeros(inp: std_logic_vector)
310
        return boolean
311
    is
312
        constant width : integer := inp'length;
313
        variable vec : std_logic_vector(width-1 downto 0);
314
        variable zero : std_logic_vector(width-1 downto 0);
315
        variable result : boolean;
316
    begin
317
        zero := (others => '0');
318
        vec := inp;
319
        -- synopsys translate_off
320
        if (is_XorU(vec)) then
321
            return false;
322
        end if;
323
         -- synopsys translate_on
324
        if (std_logic_vector_to_unsigned(vec) = std_logic_vector_to_unsigned(zero)) then
325
            result := true;
326
        else
327
            result := false;
328
        end if;
329
        return result;
330
    end;
331
    function is_point_five(inp: std_logic_vector)
332
        return boolean
333
    is
334
        constant width : integer := inp'length;
335
        variable vec : std_logic_vector(width-1 downto 0);
336
        variable result : boolean;
337
    begin
338
        vec := inp;
339
        -- synopsys translate_off
340
        if (is_XorU(vec)) then
341
            return false;
342
        end if;
343
         -- synopsys translate_on
344
        if (width > 1) then
345
           if ((vec(width-1) = '1') and (all_zeros(vec(width-2 downto 0)) = true)) then
346
               result := true;
347
           else
348
               result := false;
349
           end if;
350
        else
351
           if (vec(width-1) = '1') then
352
               result := true;
353
           else
354
               result := false;
355
           end if;
356
        end if;
357
        return result;
358
    end;
359
    function all_ones(inp: std_logic_vector)
360
        return boolean
361
    is
362
        constant width : integer := inp'length;
363
        variable vec : std_logic_vector(width-1 downto 0);
364
        variable one : std_logic_vector(width-1 downto 0);
365
        variable result : boolean;
366
    begin
367
        one := (others => '1');
368
        vec := inp;
369
        -- synopsys translate_off
370
        if (is_XorU(vec)) then
371
            return false;
372
        end if;
373
         -- synopsys translate_on
374
        if (std_logic_vector_to_unsigned(vec) = std_logic_vector_to_unsigned(one)) then
375
            result := true;
376
        else
377
            result := false;
378
        end if;
379
        return result;
380
    end;
381
    function full_precision_num_width(quantization, overflow, old_width,
382
                                      old_bin_pt, old_arith,
383
                                      new_width, new_bin_pt, new_arith : INTEGER)
384
        return integer
385
    is
386
        variable result : integer;
387
    begin
388
        result := old_width + 2;
389
        return result;
390
    end;
391
    function quantized_num_width(quantization, overflow, old_width, old_bin_pt,
392
                                 old_arith, new_width, new_bin_pt, new_arith
393
                                 : INTEGER)
394
        return integer
395
    is
396
        variable right_of_dp, left_of_dp, result : integer;
397
    begin
398
        right_of_dp := max(new_bin_pt, old_bin_pt);
399
        left_of_dp := max((new_width - new_bin_pt), (old_width - old_bin_pt));
400
        result := (old_width + 2) + (new_bin_pt - old_bin_pt);
401
        return result;
402
    end;
403
    function convert_type (inp : std_logic_vector; old_width, old_bin_pt,
404
                           old_arith, new_width, new_bin_pt, new_arith,
405
                           quantization, overflow : INTEGER)
406
        return std_logic_vector
407
    is
408
        constant fp_width : integer :=
409
            full_precision_num_width(quantization, overflow, old_width,
410
                                     old_bin_pt, old_arith, new_width,
411
                                     new_bin_pt, new_arith);
412
        constant fp_bin_pt : integer := old_bin_pt;
413
        constant fp_arith : integer := old_arith;
414
        variable full_precision_result : std_logic_vector(fp_width-1 downto 0);
415
        constant q_width : integer :=
416
            quantized_num_width(quantization, overflow, old_width, old_bin_pt,
417
                                old_arith, new_width, new_bin_pt, new_arith);
418
        constant q_bin_pt : integer := new_bin_pt;
419
        constant q_arith : integer := old_arith;
420
        variable quantized_result : std_logic_vector(q_width-1 downto 0);
421
        variable result : std_logic_vector(new_width-1 downto 0);
422
    begin
423
        result := (others => '0');
424
        full_precision_result := cast(inp, old_bin_pt, fp_width, fp_bin_pt,
425
                                      fp_arith);
426
        if (quantization = xlRound) then
427
            quantized_result := round_towards_inf(full_precision_result,
428
                                                  fp_width, fp_bin_pt,
429
                                                  fp_arith, q_width, q_bin_pt,
430
                                                  q_arith);
431
        elsif (quantization = xlRoundBanker) then
432
            quantized_result := round_towards_even(full_precision_result,
433
                                                  fp_width, fp_bin_pt,
434
                                                  fp_arith, q_width, q_bin_pt,
435
                                                  q_arith);
436
        else
437
            quantized_result := trunc(full_precision_result, fp_width, fp_bin_pt,
438
                                      fp_arith, q_width, q_bin_pt, q_arith);
439
        end if;
440
        if (overflow = xlSaturate) then
441
            result := saturation_arith(quantized_result, q_width, q_bin_pt,
442
                                       q_arith, new_width, new_bin_pt, new_arith);
443
        else
444
             result := wrap_arith(quantized_result, q_width, q_bin_pt, q_arith,
445
                                  new_width, new_bin_pt, new_arith);
446
        end if;
447
        return result;
448
    end;
449
    function cast (inp : std_logic_vector; old_bin_pt, new_width,
450
                   new_bin_pt, new_arith : INTEGER)
451
        return std_logic_vector
452
    is
453
        constant old_width : integer := inp'length;
454
        constant left_of_dp : integer := (new_width - new_bin_pt)
455
                                         - (old_width - old_bin_pt);
456
        constant right_of_dp : integer := (new_bin_pt - old_bin_pt);
457
        variable vec : std_logic_vector(old_width-1 downto 0);
458
        variable result : std_logic_vector(new_width-1 downto 0);
459
        variable j   : integer;
460
    begin
461
        vec := inp;
462
        for i in new_width-1 downto 0 loop
463
            j := i - right_of_dp;
464
            if ( j > old_width-1) then
465
                if (new_arith = xlUnsigned) then
466
                    result(i) := '0';
467
                else
468
                    result(i) := vec(old_width-1);
469
                end if;
470
            elsif ( j >= 0) then
471
                result(i) := vec(j);
472
            else
473
                result(i) := '0';
474
            end if;
475
        end loop;
476
        return result;
477
    end;
478
    function vec_slice (inp : std_logic_vector; upper, lower : INTEGER)
479
      return std_logic_vector
480
    is
481
    begin
482
        return inp(upper downto lower);
483
    end;
484
    function s2u_slice (inp : signed; upper, lower : INTEGER)
485
      return unsigned
486
    is
487
    begin
488
        return unsigned(vec_slice(std_logic_vector(inp), upper, lower));
489
    end;
490
    function u2u_slice (inp : unsigned; upper, lower : INTEGER)
491
      return unsigned
492
    is
493
    begin
494
        return unsigned(vec_slice(std_logic_vector(inp), upper, lower));
495
    end;
496
    function s2s_cast (inp : signed; old_bin_pt, new_width, new_bin_pt : INTEGER)
497
        return signed
498
    is
499
    begin
500
        return signed(cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlSigned));
501
    end;
502
    function s2u_cast (inp : signed; old_bin_pt, new_width,
503
                   new_bin_pt : INTEGER)
504
        return unsigned
505
    is
506
    begin
507
        return unsigned(cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlSigned));
508
    end;
509
    function u2s_cast (inp : unsigned; old_bin_pt, new_width,
510
                   new_bin_pt : INTEGER)
511
        return signed
512
    is
513
    begin
514
        return signed(cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlUnsigned));
515
    end;
516
    function u2u_cast (inp : unsigned; old_bin_pt, new_width,
517
                   new_bin_pt : INTEGER)
518
        return unsigned
519
    is
520
    begin
521
        return unsigned(cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlUnsigned));
522
    end;
523
    function u2v_cast (inp : unsigned; old_bin_pt, new_width,
524
                   new_bin_pt : INTEGER)
525
        return std_logic_vector
526
    is
527
    begin
528
        return cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlUnsigned);
529
    end;
530
    function s2v_cast (inp : signed; old_bin_pt, new_width,
531
                   new_bin_pt : INTEGER)
532
        return std_logic_vector
533
    is
534
    begin
535
        return cast(std_logic_vector(inp), old_bin_pt, new_width, new_bin_pt, xlSigned);
536
    end;
537
    function boolean_to_signed (inp : boolean; width : integer)
538
        return signed
539
    is
540
        variable result : signed(width - 1 downto 0);
541
    begin
542
        result := (others => '0');
543
        if inp then
544
          result(0) := '1';
545
        else
546
          result(0) := '0';
547
        end if;
548
        return result;
549
    end;
550
    function boolean_to_unsigned (inp : boolean; width : integer)
551
        return unsigned
552
    is
553
        variable result : unsigned(width - 1 downto 0);
554
    begin
555
        result := (others => '0');
556
        if inp then
557
          result(0) := '1';
558
        else
559
          result(0) := '0';
560
        end if;
561
        return result;
562
    end;
563
    function boolean_to_vector (inp : boolean)
564
        return std_logic_vector
565
    is
566
        variable result : std_logic_vector(1 - 1 downto 0);
567
    begin
568
        result := (others => '0');
569
        if inp then
570
          result(0) := '1';
571
        else
572
          result(0) := '0';
573
        end if;
574
        return result;
575
    end;
576
    function std_logic_to_vector (inp : std_logic)
577
        return std_logic_vector
578
    is
579
        variable result : std_logic_vector(1 - 1 downto 0);
580
    begin
581
        result(0) := inp;
582
        return result;
583
    end;
584
    function trunc (inp : std_logic_vector; old_width, old_bin_pt, old_arith,
585
                                new_width, new_bin_pt, new_arith : INTEGER)
586
        return std_logic_vector
587
    is
588
        constant right_of_dp : integer := (old_bin_pt - new_bin_pt);
589
        variable vec : std_logic_vector(old_width-1 downto 0);
590
        variable result : std_logic_vector(new_width-1 downto 0);
591
    begin
592
        vec := inp;
593
        if right_of_dp >= 0 then
594
            if new_arith = xlUnsigned then
595
                result := zero_ext(vec(old_width-1 downto right_of_dp), new_width);
596
            else
597
                result := sign_ext(vec(old_width-1 downto right_of_dp), new_width);
598
            end if;
599
        else
600
            if new_arith = xlUnsigned then
601
                result := zero_ext(pad_LSB(vec, old_width +
602
                                           abs(right_of_dp)), new_width);
603
            else
604
                result := sign_ext(pad_LSB(vec, old_width +
605
                                           abs(right_of_dp)), new_width);
606
            end if;
607
        end if;
608
        return result;
609
    end;
610
    function round_towards_inf (inp : std_logic_vector; old_width, old_bin_pt,
611
                                old_arith, new_width, new_bin_pt, new_arith
612
                                : INTEGER)
613
        return std_logic_vector
614
    is
615
        constant right_of_dp : integer := (old_bin_pt - new_bin_pt);
616
        constant expected_new_width : integer :=  old_width - right_of_dp  + 1;
617
        variable vec : std_logic_vector(old_width-1 downto 0);
618
        variable one_or_zero : std_logic_vector(new_width-1 downto 0);
619
        variable truncated_val : std_logic_vector(new_width-1 downto 0);
620
        variable result : std_logic_vector(new_width-1 downto 0);
621
    begin
622
        vec := inp;
623
        if right_of_dp >= 0 then
624
            if new_arith = xlUnsigned then
625
                truncated_val := zero_ext(vec(old_width-1 downto right_of_dp),
626
                                          new_width);
627
            else
628
                truncated_val := sign_ext(vec(old_width-1 downto right_of_dp),
629
                                          new_width);
630
            end if;
631
        else
632
            if new_arith = xlUnsigned then
633
                truncated_val := zero_ext(pad_LSB(vec, old_width +
634
                                                  abs(right_of_dp)), new_width);
635
            else
636
                truncated_val := sign_ext(pad_LSB(vec, old_width +
637
                                                  abs(right_of_dp)), new_width);
638
            end if;
639
        end if;
640
        one_or_zero := (others => '0');
641
        if (new_arith = xlSigned) then
642
            if (vec(old_width-1) = '0') then
643
                one_or_zero(0) := '1';
644
            end if;
645
            if (right_of_dp >= 2) and (right_of_dp <= old_width) then
646
                if (all_zeros(vec(right_of_dp-2 downto 0)) = false) then
647
                    one_or_zero(0) := '1';
648
                end if;
649
            end if;
650
            if (right_of_dp >= 1) and (right_of_dp <= old_width) then
651
                if vec(right_of_dp-1) = '0' then
652
                    one_or_zero(0) := '0';
653
                end if;
654
            else
655
                one_or_zero(0) := '0';
656
            end if;
657
        else
658
            if (right_of_dp >= 1) and (right_of_dp <= old_width) then
659
                one_or_zero(0) :=  vec(right_of_dp-1);
660
            end if;
661
        end if;
662
        if new_arith = xlSigned then
663
            result := signed_to_std_logic_vector(std_logic_vector_to_signed(truncated_val) +
664
                                                 std_logic_vector_to_signed(one_or_zero));
665
        else
666
            result := unsigned_to_std_logic_vector(std_logic_vector_to_unsigned(truncated_val) +
667
                                                  std_logic_vector_to_unsigned(one_or_zero));
668
        end if;
669
        return result;
670
    end;
671
    function round_towards_even (inp : std_logic_vector; old_width, old_bin_pt,
672
                                old_arith, new_width, new_bin_pt, new_arith
673
                                : INTEGER)
674
        return std_logic_vector
675
    is
676
        constant right_of_dp : integer := (old_bin_pt - new_bin_pt);
677
        constant expected_new_width : integer :=  old_width - right_of_dp  + 1;
678
        variable vec : std_logic_vector(old_width-1 downto 0);
679
        variable one_or_zero : std_logic_vector(new_width-1 downto 0);
680
        variable truncated_val : std_logic_vector(new_width-1 downto 0);
681
        variable result : std_logic_vector(new_width-1 downto 0);
682
    begin
683
        vec := inp;
684
        if right_of_dp >= 0 then
685
            if new_arith = xlUnsigned then
686
                truncated_val := zero_ext(vec(old_width-1 downto right_of_dp),
687
                                          new_width);
688
            else
689
                truncated_val := sign_ext(vec(old_width-1 downto right_of_dp),
690
                                          new_width);
691
            end if;
692
        else
693
            if new_arith = xlUnsigned then
694
                truncated_val := zero_ext(pad_LSB(vec, old_width +
695
                                                  abs(right_of_dp)), new_width);
696
            else
697
                truncated_val := sign_ext(pad_LSB(vec, old_width +
698
                                                  abs(right_of_dp)), new_width);
699
            end if;
700
        end if;
701
        one_or_zero := (others => '0');
702
        if (right_of_dp >= 1) and (right_of_dp <= old_width) then
703
            if (is_point_five(vec(right_of_dp-1 downto 0)) = false) then
704
                one_or_zero(0) :=  vec(right_of_dp-1);
705
            else
706
                one_or_zero(0) :=  vec(right_of_dp);
707
            end if;
708
        end if;
709
        if new_arith = xlSigned then
710
            result := signed_to_std_logic_vector(std_logic_vector_to_signed(truncated_val) +
711
                                                 std_logic_vector_to_signed(one_or_zero));
712
        else
713
            result := unsigned_to_std_logic_vector(std_logic_vector_to_unsigned(truncated_val) +
714
                                                  std_logic_vector_to_unsigned(one_or_zero));
715
        end if;
716
        return result;
717
    end;
718
    function saturation_arith(inp:  std_logic_vector;  old_width, old_bin_pt,
719
                              old_arith, new_width, new_bin_pt, new_arith
720
                              : INTEGER)
721
        return std_logic_vector
722
    is
723
        constant left_of_dp : integer := (old_width - old_bin_pt) -
724
                                         (new_width - new_bin_pt);
725
        variable vec : std_logic_vector(old_width-1 downto 0);
726
        variable result : std_logic_vector(new_width-1 downto 0);
727
        variable overflow : boolean;
728
    begin
729
        vec := inp;
730
        overflow := true;
731
        result := (others => '0');
732
        if (new_width >= old_width) then
733
            overflow := false;
734
        end if;
735
        if ((old_arith = xlSigned and new_arith = xlSigned) and (old_width > new_width)) then
736
            if all_same(vec(old_width-1 downto new_width-1)) then
737
                overflow := false;
738
            end if;
739
        end if;
740
        if (old_arith = xlSigned and new_arith = xlUnsigned) then
741
            if (old_width > new_width) then
742
                if all_zeros(vec(old_width-1 downto new_width)) then
743
                    overflow := false;
744
                end if;
745
            else
746
                if (old_width = new_width) then
747
                    if (vec(new_width-1) = '0') then
748
                        overflow := false;
749
                    end if;
750
                end if;
751
            end if;
752
        end if;
753
        if (old_arith = xlUnsigned and new_arith = xlUnsigned) then
754
            if (old_width > new_width) then
755
                if all_zeros(vec(old_width-1 downto new_width)) then
756
                    overflow := false;
757
                end if;
758
            else
759
                if (old_width = new_width) then
760
                    overflow := false;
761
                end if;
762
            end if;
763
        end if;
764
        if ((old_arith = xlUnsigned and new_arith = xlSigned) and (old_width > new_width)) then
765
            if all_same(vec(old_width-1 downto new_width-1)) then
766
                overflow := false;
767
            end if;
768
        end if;
769
        if overflow then
770
            if new_arith = xlSigned then
771
                if vec(old_width-1) = '0' then
772
                    result := max_signed(new_width);
773
                else
774
                    result := min_signed(new_width);
775
                end if;
776
            else
777
                if ((old_arith = xlSigned) and vec(old_width-1) = '1') then
778
                    result := (others => '0');
779
                else
780
                    result := (others => '1');
781
                end if;
782
            end if;
783
        else
784
            if (old_arith = xlSigned) and (new_arith = xlUnsigned) then
785
                if (vec(old_width-1) = '1') then
786
                    vec := (others => '0');
787
                end if;
788
            end if;
789
            if new_width <= old_width then
790
                result := vec(new_width-1 downto 0);
791
            else
792
                if new_arith = xlUnsigned then
793
                    result := zero_ext(vec, new_width);
794
                else
795
                    result := sign_ext(vec, new_width);
796
                end if;
797
            end if;
798
        end if;
799
        return result;
800
    end;
801
   function wrap_arith(inp:  std_logic_vector;  old_width, old_bin_pt,
802
                       old_arith, new_width, new_bin_pt, new_arith : INTEGER)
803
        return std_logic_vector
804
    is
805
        variable result : std_logic_vector(new_width-1 downto 0);
806
        variable result_arith : integer;
807
    begin
808
        if (old_arith = xlSigned) and (new_arith = xlUnsigned) then
809
            result_arith := xlSigned;
810
        end if;
811
        result := cast(inp, old_bin_pt, new_width, new_bin_pt, result_arith);
812
        return result;
813
    end;
814
    function fractional_bits(a_bin_pt, b_bin_pt: INTEGER) return INTEGER is
815
    begin
816
        return max(a_bin_pt, b_bin_pt);
817
    end;
818
    function integer_bits(a_width, a_bin_pt, b_width, b_bin_pt: INTEGER)
819
        return INTEGER is
820
    begin
821
        return  max(a_width - a_bin_pt, b_width - b_bin_pt);
822
    end;
823
    function pad_LSB(inp : std_logic_vector; new_width: integer)
824
        return STD_LOGIC_VECTOR
825
    is
826
        constant orig_width : integer := inp'length;
827
        variable vec : std_logic_vector(orig_width-1 downto 0);
828
        variable result : std_logic_vector(new_width-1 downto 0);
829
        variable pos : integer;
830
        constant pad_pos : integer := new_width - orig_width - 1;
831
    begin
832
        vec := inp;
833
        pos := new_width-1;
834
        if (new_width >= orig_width) then
835
            for i in orig_width-1 downto 0 loop
836
                result(pos) := vec(i);
837
                pos := pos - 1;
838
            end loop;
839
            if pad_pos >= 0 then
840
                for i in pad_pos downto 0 loop
841
                    result(i) := '0';
842
                end loop;
843
            end if;
844
        end if;
845
        return result;
846
    end;
847
    function sign_ext(inp : std_logic_vector; new_width : INTEGER)
848
        return std_logic_vector
849
    is
850
        constant old_width : integer := inp'length;
851
        variable vec : std_logic_vector(old_width-1 downto 0);
852
        variable result : std_logic_vector(new_width-1 downto 0);
853
    begin
854
        vec := inp;
855
        if new_width >= old_width then
856
            result(old_width-1 downto 0) := vec;
857
            if new_width-1 >= old_width then
858
                for i in new_width-1 downto old_width loop
859
                    result(i) := vec(old_width-1);
860
                end loop;
861
            end if;
862
        else
863
            result(new_width-1 downto 0) := vec(new_width-1 downto 0);
864
        end if;
865
        return result;
866
    end;
867
    function zero_ext(inp : std_logic_vector; new_width : INTEGER)
868
        return std_logic_vector
869
    is
870
        constant old_width : integer := inp'length;
871
        variable vec : std_logic_vector(old_width-1 downto 0);
872
        variable result : std_logic_vector(new_width-1 downto 0);
873
    begin
874
        vec := inp;
875
        if new_width >= old_width then
876
            result(old_width-1 downto 0) := vec;
877
            if new_width-1 >= old_width then
878
                for i in new_width-1 downto old_width loop
879
                    result(i) := '0';
880
                end loop;
881
            end if;
882
        else
883
            result(new_width-1 downto 0) := vec(new_width-1 downto 0);
884
        end if;
885
        return result;
886
    end;
887
    function zero_ext(inp : std_logic; new_width : INTEGER)
888
        return std_logic_vector
889
    is
890
        variable result : std_logic_vector(new_width-1 downto 0);
891
    begin
892
        result(0) := inp;
893
        for i in new_width-1 downto 1 loop
894
            result(i) := '0';
895
        end loop;
896
        return result;
897
    end;
898
    function extend_MSB(inp : std_logic_vector; new_width, arith : INTEGER)
899
        return std_logic_vector
900
    is
901
        constant orig_width : integer := inp'length;
902
        variable vec : std_logic_vector(orig_width-1 downto 0);
903
        variable result : std_logic_vector(new_width-1 downto 0);
904
    begin
905
        vec := inp;
906
        if arith = xlUnsigned then
907
            result := zero_ext(vec, new_width);
908
        else
909
            result := sign_ext(vec, new_width);
910
        end if;
911
        return result;
912
    end;
913
    function pad_LSB(inp : std_logic_vector; new_width, arith: integer)
914
        return STD_LOGIC_VECTOR
915
    is
916
        constant orig_width : integer := inp'length;
917
        variable vec : std_logic_vector(orig_width-1 downto 0);
918
        variable result : std_logic_vector(new_width-1 downto 0);
919
        variable pos : integer;
920
    begin
921
        vec := inp;
922
        pos := new_width-1;
923
        if (arith = xlUnsigned) then
924
            result(pos) := '0';
925
            pos := pos - 1;
926
        else
927
            result(pos) := vec(orig_width-1);
928
            pos := pos - 1;
929
        end if;
930
        if (new_width >= orig_width) then
931
            for i in orig_width-1 downto 0 loop
932
                result(pos) := vec(i);
933
                pos := pos - 1;
934
            end loop;
935
            if pos >= 0 then
936
                for i in pos downto 0 loop
937
                    result(i) := '0';
938
                end loop;
939
            end if;
940
        end if;
941
        return result;
942
    end;
943
    function align_input(inp : std_logic_vector; old_width, delta, new_arith,
944
                         new_width: INTEGER)
945
        return std_logic_vector
946
    is
947
        variable vec : std_logic_vector(old_width-1 downto 0);
948
        variable padded_inp : std_logic_vector((old_width + delta)-1  downto 0);
949
        variable result : std_logic_vector(new_width-1 downto 0);
950
    begin
951
        vec := inp;
952
        if delta > 0 then
953
            padded_inp := pad_LSB(vec, old_width+delta);
954
            result := extend_MSB(padded_inp, new_width, new_arith);
955
        else
956
            result := extend_MSB(vec, new_width, new_arith);
957
        end if;
958
        return result;
959
    end;
960
    function max(L, R: INTEGER) return INTEGER is
961
    begin
962
        if L > R then
963
            return L;
964
        else
965
            return R;
966
        end if;
967
    end;
968
    function min(L, R: INTEGER) return INTEGER is
969
    begin
970
        if L < R then
971
            return L;
972
        else
973
            return R;
974
        end if;
975
    end;
976
    function "="(left,right: STRING) return boolean is
977
    begin
978
        if (left'length /= right'length) then
979
            return false;
980
        else
981
            test : for i in 1 to left'length loop
982
                if left(i) /= right(i) then
983
                    return false;
984
                end if;
985
            end loop test;
986
            return true;
987
        end if;
988
    end;
989
    -- synopsys translate_off
990
    function is_binary_string_invalid (inp : string)
991
        return boolean
992
    is
993
        variable vec : string(1 to inp'length);
994
        variable result : boolean;
995
    begin
996
        vec := inp;
997
        result := false;
998
        for i in 1 to vec'length loop
999
            if ( vec(i) = 'X' ) then
1000
                result := true;
1001
            end if;
1002
        end loop;
1003
        return result;
1004
    end;
1005
    function is_binary_string_undefined (inp : string)
1006
        return boolean
1007
    is
1008
        variable vec : string(1 to inp'length);
1009
        variable result : boolean;
1010
    begin
1011
        vec := inp;
1012
        result := false;
1013
        for i in 1 to vec'length loop
1014
            if ( vec(i) = 'U' ) then
1015
                result := true;
1016
            end if;
1017
        end loop;
1018
        return result;
1019
    end;
1020
    function is_XorU(inp : std_logic_vector)
1021
        return boolean
1022
    is
1023
        constant width : integer := inp'length;
1024
        variable vec : std_logic_vector(width-1 downto 0);
1025
        variable result : boolean;
1026
    begin
1027
        vec := inp;
1028
        result := false;
1029
        for i in 0 to width-1 loop
1030
            if (vec(i) = 'U') or (vec(i) = 'X') then
1031
                result := true;
1032
            end if;
1033
        end loop;
1034
        return result;
1035
    end;
1036
    function to_real(inp : std_logic_vector; bin_pt : integer; arith : integer)
1037
        return real
1038
    is
1039
        variable  vec : std_logic_vector(inp'length-1 downto 0);
1040
        variable result, shift_val, undefined_real : real;
1041
        variable neg_num : boolean;
1042
    begin
1043
        vec := inp;
1044
        result := 0.0;
1045
        neg_num := false;
1046
        if vec(inp'length-1) = '1' then
1047
            neg_num := true;
1048
        end if;
1049
        for i in 0 to inp'length-1 loop
1050
            if  vec(i) = 'U' or vec(i) = 'X' then
1051
                return undefined_real;
1052
            end if;
1053
            if arith = xlSigned then
1054
                if neg_num then
1055
                    if vec(i) = '0' then
1056
                        result := result + 2.0**i;
1057
                    end if;
1058
                else
1059
                    if vec(i) = '1' then
1060
                        result := result + 2.0**i;
1061
                    end if;
1062
                end if;
1063
            else
1064
                if vec(i) = '1' then
1065
                    result := result + 2.0**i;
1066
                end if;
1067
            end if;
1068
        end loop;
1069
        if arith = xlSigned then
1070
            if neg_num then
1071
                result := result + 1.0;
1072
                result := result * (-1.0);
1073
            end if;
1074
        end if;
1075
        shift_val := 2.0**(-1*bin_pt);
1076
        result := result * shift_val;
1077
        return result;
1078
    end;
1079
    function std_logic_to_real(inp : std_logic; bin_pt : integer; arith : integer)
1080
        return real
1081
    is
1082
        variable result : real := 0.0;
1083
    begin
1084
        if inp = '1' then
1085
            result := 1.0;
1086
        end if;
1087
        if arith = xlSigned then
1088
            assert false
1089
                report "It doesn't make sense to convert a 1 bit number to a signed real.";
1090
        end if;
1091
        return result;
1092
    end;
1093
    -- synopsys translate_on
1094
    function integer_to_std_logic_vector (inp : integer;  width, arith : integer)
1095
        return std_logic_vector
1096
    is
1097
        variable result : std_logic_vector(width-1 downto 0);
1098
        variable unsigned_val : unsigned(width-1 downto 0);
1099
        variable signed_val : signed(width-1 downto 0);
1100
    begin
1101
        if (arith = xlSigned) then
1102
            signed_val := to_signed(inp, width);
1103
            result := signed_to_std_logic_vector(signed_val);
1104
        else
1105
            unsigned_val := to_unsigned(inp, width);
1106
            result := unsigned_to_std_logic_vector(unsigned_val);
1107
        end if;
1108
        return result;
1109
    end;
1110
    function std_logic_vector_to_integer (inp : std_logic_vector;  arith : integer)
1111
        return integer
1112
    is
1113
        constant width : integer := inp'length;
1114
        variable unsigned_val : unsigned(width-1 downto 0);
1115
        variable signed_val : signed(width-1 downto 0);
1116
        variable result : integer;
1117
    begin
1118
        if (arith = xlSigned) then
1119
            signed_val := std_logic_vector_to_signed(inp);
1120
            result := to_integer(signed_val);
1121
        else
1122
            unsigned_val := std_logic_vector_to_unsigned(inp);
1123
            result := to_integer(unsigned_val);
1124
        end if;
1125
        return result;
1126
    end;
1127
    function std_logic_to_integer(constant inp : std_logic := '0')
1128
        return integer
1129
    is
1130
    begin
1131
        if inp = '1' then
1132
            return 1;
1133
        else
1134
            return 0;
1135
        end if;
1136
    end;
1137
    function makeZeroBinStr (width : integer) return STRING is
1138
        variable result : string(1 to width+3);
1139
    begin
1140
        result(1) := '0';
1141
        result(2) := 'b';
1142
        for i in 3 to width+2 loop
1143
            result(i) := '0';
1144
        end loop;
1145
        result(width+3) := '.';
1146
        return result;
1147
    end;
1148
    -- synopsys translate_off
1149
    function real_string_to_std_logic_vector (inp : string;  width, bin_pt, arith : integer)
1150
        return std_logic_vector
1151
    is
1152
        variable result : std_logic_vector(width-1 downto 0);
1153
    begin
1154
        result := (others => '0');
1155
        return result;
1156
    end;
1157
    function real_to_std_logic_vector (inp : real;  width, bin_pt, arith : integer)
1158
        return std_logic_vector
1159
    is
1160
        variable real_val : real;
1161
        variable int_val : integer;
1162
        variable result : std_logic_vector(width-1 downto 0) := (others => '0');
1163
        variable unsigned_val : unsigned(width-1 downto 0) := (others => '0');
1164
        variable signed_val : signed(width-1 downto 0) := (others => '0');
1165
    begin
1166
        real_val := inp;
1167
        int_val := integer(real_val * 2.0**(bin_pt));
1168
        if (arith = xlSigned) then
1169
            signed_val := to_signed(int_val, width);
1170
            result := signed_to_std_logic_vector(signed_val);
1171
        else
1172
            unsigned_val := to_unsigned(int_val, width);
1173
            result := unsigned_to_std_logic_vector(unsigned_val);
1174
        end if;
1175
        return result;
1176
    end;
1177
    -- synopsys translate_on
1178
    function valid_bin_string (inp : string)
1179
        return boolean
1180
    is
1181
        variable vec : string(1 to inp'length);
1182
    begin
1183
        vec := inp;
1184
        if (vec(1) = '0' and vec(2) = 'b') then
1185
            return true;
1186
        else
1187
            return false;
1188
        end if;
1189
    end;
1190
    function hex_string_to_std_logic_vector(inp: string; width : integer)
1191
        return std_logic_vector is
1192
        constant strlen       : integer := inp'LENGTH;
1193
        variable result       : std_logic_vector(width-1 downto 0);
1194
        variable bitval       : std_logic_vector((strlen*4)-1 downto 0);
1195
        variable posn         : integer;
1196
        variable ch           : character;
1197
        variable vec          : string(1 to strlen);
1198
    begin
1199
        vec := inp;
1200
        result := (others => '0');
1201
        posn := (strlen*4)-1;
1202
        for i in 1 to strlen loop
1203
            ch := vec(i);
1204
            case ch is
1205
                when '0' => bitval(posn downto posn-3) := "0000";
1206
                when '1' => bitval(posn downto posn-3) := "0001";
1207
                when '2' => bitval(posn downto posn-3) := "0010";
1208
                when '3' => bitval(posn downto posn-3) := "0011";
1209
                when '4' => bitval(posn downto posn-3) := "0100";
1210
                when '5' => bitval(posn downto posn-3) := "0101";
1211
                when '6' => bitval(posn downto posn-3) := "0110";
1212
                when '7' => bitval(posn downto posn-3) := "0111";
1213
                when '8' => bitval(posn downto posn-3) := "1000";
1214
                when '9' => bitval(posn downto posn-3) := "1001";
1215
                when 'A' | 'a' => bitval(posn downto posn-3) := "1010";
1216
                when 'B' | 'b' => bitval(posn downto posn-3) := "1011";
1217
                when 'C' | 'c' => bitval(posn downto posn-3) := "1100";
1218
                when 'D' | 'd' => bitval(posn downto posn-3) := "1101";
1219
                when 'E' | 'e' => bitval(posn downto posn-3) := "1110";
1220
                when 'F' | 'f' => bitval(posn downto posn-3) := "1111";
1221
                when others => bitval(posn downto posn-3) := "XXXX";
1222
                               -- synopsys translate_off
1223
                               ASSERT false
1224
                                   REPORT "Invalid hex value" SEVERITY ERROR;
1225
                               -- synopsys translate_on
1226
            end case;
1227
            posn := posn - 4;
1228
        end loop;
1229
        if (width <= strlen*4) then
1230
            result :=  bitval(width-1 downto 0);
1231
        else
1232
            result((strlen*4)-1 downto 0) := bitval;
1233
        end if;
1234
        return result;
1235
    end;
1236
    function bin_string_to_std_logic_vector (inp : string)
1237
        return std_logic_vector
1238
    is
1239
        variable pos : integer;
1240
        variable vec : string(1 to inp'length);
1241
        variable result : std_logic_vector(inp'length-1 downto 0);
1242
    begin
1243
        vec := inp;
1244
        pos := inp'length-1;
1245
        result := (others => '0');
1246
        for i in 1 to vec'length loop
1247
            -- synopsys translate_off
1248
            if (pos < 0) and (vec(i) = '0' or vec(i) = '1' or vec(i) = 'X' or vec(i) = 'U')  then
1249
                assert false
1250
                    report "Input string is larger than output std_logic_vector. Truncating output.";
1251
                return result;
1252
            end if;
1253
            -- synopsys translate_on
1254
            if vec(i) = '0' then
1255
                result(pos) := '0';
1256
                pos := pos - 1;
1257
            end if;
1258
            if vec(i) = '1' then
1259
                result(pos) := '1';
1260
                pos := pos - 1;
1261
            end if;
1262
            -- synopsys translate_off
1263
            if (vec(i) = 'X' or vec(i) = 'U') then
1264
                result(pos) := 'U';
1265
                pos := pos - 1;
1266
            end if;
1267
            -- synopsys translate_on
1268
        end loop;
1269
        return result;
1270
    end;
1271
    function bin_string_element_to_std_logic_vector (inp : string;  width, index : integer)
1272
        return std_logic_vector
1273
    is
1274
        constant str_width : integer := width + 4;
1275
        constant inp_len : integer := inp'length;
1276
        constant num_elements : integer := (inp_len + 1)/str_width;
1277
        constant reverse_index : integer := (num_elements-1) - index;
1278
        variable left_pos : integer;
1279
        variable right_pos : integer;
1280
        variable vec : string(1 to inp'length);
1281
        variable result : std_logic_vector(width-1 downto 0);
1282
    begin
1283
        vec := inp;
1284
        result := (others => '0');
1285
        if (reverse_index = 0) and (reverse_index < num_elements) and (inp_len-3 >= width) then
1286
            left_pos := 1;
1287
            right_pos := width + 3;
1288
            result := bin_string_to_std_logic_vector(vec(left_pos to right_pos));
1289
        end if;
1290
        if (reverse_index > 0) and (reverse_index < num_elements) and (inp_len-3 >= width) then
1291
            left_pos := (reverse_index * str_width) + 1;
1292
            right_pos := left_pos + width + 2;
1293
            result := bin_string_to_std_logic_vector(vec(left_pos to right_pos));
1294
        end if;
1295
        return result;
1296
    end;
1297
   -- synopsys translate_off
1298
    function std_logic_vector_to_bin_string(inp : std_logic_vector)
1299
        return string
1300
    is
1301
        variable vec : std_logic_vector(1 to inp'length);
1302
        variable result : string(vec'range);
1303
    begin
1304
        vec := inp;
1305
        for i in vec'range loop
1306
            result(i) := to_char(vec(i));
1307
        end loop;
1308
        return result;
1309
    end;
1310
    function std_logic_to_bin_string(inp : std_logic)
1311
        return string
1312
    is
1313
        variable result : string(1 to 3);
1314
    begin
1315
        result(1) := '0';
1316
        result(2) := 'b';
1317
        result(3) := to_char(inp);
1318
        return result;
1319
    end;
1320
    function std_logic_vector_to_bin_string_w_point(inp : std_logic_vector; bin_pt : integer)
1321
        return string
1322
    is
1323
        variable width : integer := inp'length;
1324
        variable vec : std_logic_vector(width-1 downto 0);
1325
        variable str_pos : integer;
1326
        variable result : string(1 to width+3);
1327
    begin
1328
        vec := inp;
1329
        str_pos := 1;
1330
        result(str_pos) := '0';
1331
        str_pos := 2;
1332
        result(str_pos) := 'b';
1333
        str_pos := 3;
1334
        for i in width-1 downto 0  loop
1335
            if (((width+3) - bin_pt) = str_pos) then
1336
                result(str_pos) := '.';
1337
                str_pos := str_pos + 1;
1338
            end if;
1339
            result(str_pos) := to_char(vec(i));
1340
            str_pos := str_pos + 1;
1341
        end loop;
1342
        if (bin_pt = 0) then
1343
            result(str_pos) := '.';
1344
        end if;
1345
        return result;
1346
    end;
1347
    function real_to_bin_string(inp : real;  width, bin_pt, arith : integer)
1348
        return string
1349
    is
1350
        variable result : string(1 to width);
1351
        variable vec : std_logic_vector(width-1 downto 0);
1352
    begin
1353
        vec := real_to_std_logic_vector(inp, width, bin_pt, arith);
1354
        result := std_logic_vector_to_bin_string(vec);
1355
        return result;
1356
    end;
1357
    function real_to_string (inp : real) return string
1358
    is
1359
        variable result : string(1 to display_precision) := (others => ' ');
1360
    begin
1361
        result(real'image(inp)'range) := real'image(inp);
1362
        return result;
1363
    end;
1364
    -- synopsys translate_on
1365
end conv_pkg;
1366
 
1367
-------------------------------------------------------------------
1368
-- System Generator version 12.3 VHDL source file.
1369
--
1370
-- Copyright(C) 2010 by Xilinx, Inc.  All rights reserved.  This
1371
-- text/file contains proprietary, confidential information of Xilinx,
1372
-- Inc., is distributed under license from Xilinx, Inc., and may be used,
1373
-- copied and/or disclosed only pursuant to the terms of a valid license
1374
-- agreement with Xilinx, Inc.  Xilinx hereby grants you a license to use
1375
-- this text/file solely for design, simulation, implementation and
1376
-- creation of design files limited to Xilinx devices or technologies.
1377
-- Use with non-Xilinx devices or technologies is expressly prohibited
1378
-- and immediately terminates your license unless covered by a separate
1379
-- agreement.
1380
--
1381
-- Xilinx is providing this design, code, or information "as is" solely
1382
-- for use in developing programs and solutions for Xilinx devices.  By
1383
-- providing this design, code, or information as one possible
1384
-- implementation of this feature, application or standard, Xilinx is
1385
-- making no representation that this implementation is free from any
1386
-- claims of infringement.  You are responsible for obtaining any rights
1387
-- you may require for your implementation.  Xilinx expressly disclaims
1388
-- any warranty whatsoever with respect to the adequacy of the
1389
-- implementation, including but not limited to warranties of
1390
-- merchantability or fitness for a particular purpose.
1391
--
1392
-- Xilinx products are not intended for use in life support appliances,
1393
-- devices, or systems.  Use in such applications is expressly prohibited.
1394
--
1395
-- Any modifications that are made to the source code are done at the user's
1396
-- sole risk and will be unsupported.
1397
--
1398
-- This copyright and support notice must be retained as part of this
1399
-- text at all times.  (c) Copyright 1995-2010 Xilinx, Inc.  All rights
1400
-- reserved.
1401
-------------------------------------------------------------------
1402
-- synopsys translate_off
1403
library unisim;
1404
use unisim.vcomponents.all;
1405
-- synopsys translate_on
1406
library IEEE;
1407
use IEEE.std_logic_1164.all;
1408
use work.conv_pkg.all;
1409
entity srl17e is
1410
    generic (width : integer:=16;
1411
             latency : integer :=8);
1412
    port (clk   : in std_logic;
1413
          ce    : in std_logic;
1414
          d     : in std_logic_vector(width-1 downto 0);
1415
          q     : out std_logic_vector(width-1 downto 0));
1416
end srl17e;
1417
architecture structural of srl17e is
1418
    component SRL16E
1419
        port (D   : in STD_ULOGIC;
1420
              CE  : in STD_ULOGIC;
1421
              CLK : in STD_ULOGIC;
1422
              A0  : in STD_ULOGIC;
1423
              A1  : in STD_ULOGIC;
1424
              A2  : in STD_ULOGIC;
1425
              A3  : in STD_ULOGIC;
1426
              Q   : out STD_ULOGIC);
1427
    end component;
1428
    attribute syn_black_box of SRL16E : component is true;
1429
    attribute fpga_dont_touch of SRL16E : component is "true";
1430
    component FDE
1431
        port(
1432
            Q  :        out   STD_ULOGIC;
1433
            D  :        in    STD_ULOGIC;
1434
            C  :        in    STD_ULOGIC;
1435
            CE :        in    STD_ULOGIC);
1436
    end component;
1437
    attribute syn_black_box of FDE : component is true;
1438
    attribute fpga_dont_touch of FDE : component is "true";
1439
    constant a : std_logic_vector(4 downto 0) :=
1440
        integer_to_std_logic_vector(latency-2,5,xlSigned);
1441
    signal d_delayed : std_logic_vector(width-1 downto 0);
1442
    signal srl16_out : std_logic_vector(width-1 downto 0);
1443
begin
1444
    d_delayed <= d after 200 ps;
1445
    reg_array : for i in 0 to width-1 generate
1446
        srl16_used: if latency > 1 generate
1447
            u1 : srl16e port map(clk => clk,
1448
                                 d => d_delayed(i),
1449
                                 q => srl16_out(i),
1450
                                 ce => ce,
1451
                                 a0 => a(0),
1452
                                 a1 => a(1),
1453
                                 a2 => a(2),
1454
                                 a3 => a(3));
1455
        end generate;
1456
        srl16_not_used: if latency <= 1 generate
1457
            srl16_out(i) <= d_delayed(i);
1458
        end generate;
1459
        fde_used: if latency /= 0  generate
1460
            u2 : fde port map(c => clk,
1461
                              d => srl16_out(i),
1462
                              q => q(i),
1463
                              ce => ce);
1464
        end generate;
1465
        fde_not_used: if latency = 0  generate
1466
            q(i) <= srl16_out(i);
1467
        end generate;
1468
    end generate;
1469
 end structural;
1470
library IEEE;
1471
use IEEE.std_logic_1164.all;
1472
use work.conv_pkg.all;
1473
entity synth_reg is
1474
    generic (width           : integer := 8;
1475
             latency         : integer := 1);
1476
    port (i       : in std_logic_vector(width-1 downto 0);
1477
          ce      : in std_logic;
1478
          clr     : in std_logic;
1479
          clk     : in std_logic;
1480
          o       : out std_logic_vector(width-1 downto 0));
1481
end synth_reg;
1482
architecture structural of synth_reg is
1483
    component srl17e
1484
        generic (width : integer:=16;
1485
                 latency : integer :=8);
1486
        port (clk : in std_logic;
1487
              ce  : in std_logic;
1488
              d   : in std_logic_vector(width-1 downto 0);
1489
              q   : out std_logic_vector(width-1 downto 0));
1490
    end component;
1491
    function calc_num_srl17es (latency : integer)
1492
        return integer
1493
    is
1494
        variable remaining_latency : integer;
1495
        variable result : integer;
1496
    begin
1497
        result := latency / 17;
1498
        remaining_latency := latency - (result * 17);
1499
        if (remaining_latency /= 0) then
1500
            result := result + 1;
1501
        end if;
1502
        return result;
1503
    end;
1504
    constant complete_num_srl17es : integer := latency / 17;
1505
    constant num_srl17es : integer := calc_num_srl17es(latency);
1506
    constant remaining_latency : integer := latency - (complete_num_srl17es * 17);
1507
    type register_array is array (num_srl17es downto 0) of
1508
        std_logic_vector(width-1 downto 0);
1509
    signal z : register_array;
1510
begin
1511
    z(0) <= i;
1512
    complete_ones : if complete_num_srl17es > 0 generate
1513
        srl17e_array: for i in 0 to complete_num_srl17es-1 generate
1514
            delay_comp : srl17e
1515
                generic map (width => width,
1516
                             latency => 17)
1517
                port map (clk => clk,
1518
                          ce  => ce,
1519
                          d       => z(i),
1520
                          q       => z(i+1));
1521
        end generate;
1522
    end generate;
1523
    partial_one : if remaining_latency > 0 generate
1524
        last_srl17e : srl17e
1525
            generic map (width => width,
1526
                         latency => remaining_latency)
1527
            port map (clk => clk,
1528
                      ce  => ce,
1529
                      d   => z(num_srl17es-1),
1530
                      q   => z(num_srl17es));
1531
    end generate;
1532
    o <= z(num_srl17es);
1533
end structural;
1534
library IEEE;
1535
use IEEE.std_logic_1164.all;
1536
use work.conv_pkg.all;
1537
entity synth_reg_reg is
1538
    generic (width           : integer := 8;
1539
             latency         : integer := 1);
1540
    port (i       : in std_logic_vector(width-1 downto 0);
1541
          ce      : in std_logic;
1542
          clr     : in std_logic;
1543
          clk     : in std_logic;
1544
          o       : out std_logic_vector(width-1 downto 0));
1545
end synth_reg_reg;
1546
architecture behav of synth_reg_reg is
1547
  type reg_array_type is array (latency-1 downto 0) of std_logic_vector(width -1 downto 0);
1548
  signal reg_bank : reg_array_type := (others => (others => '0'));
1549
  signal reg_bank_in : reg_array_type := (others => (others => '0'));
1550
  attribute syn_allow_retiming : boolean;
1551
  attribute syn_srlstyle : string;
1552
  attribute syn_allow_retiming of reg_bank : signal is true;
1553
  attribute syn_allow_retiming of reg_bank_in : signal is true;
1554
  attribute syn_srlstyle of reg_bank : signal is "registers";
1555
  attribute syn_srlstyle of reg_bank_in : signal is "registers";
1556
begin
1557
  latency_eq_0: if latency = 0 generate
1558
    o <= i;
1559
  end generate latency_eq_0;
1560
  latency_gt_0: if latency >= 1 generate
1561
    o <= reg_bank(latency-1);
1562
    reg_bank_in(0) <= i;
1563
    loop_gen: for idx in latency-2 downto 0 generate
1564
      reg_bank_in(idx+1) <= reg_bank(idx);
1565
    end generate loop_gen;
1566
    sync_loop: for sync_idx in latency-1 downto 0 generate
1567
      sync_proc: process (clk)
1568
      begin
1569
        if clk'event and clk = '1' then
1570
          if ce = '1'  then
1571
            reg_bank(sync_idx) <= reg_bank_in(sync_idx);
1572
          end if;
1573
        end if;
1574
      end process sync_proc;
1575
    end generate sync_loop;
1576
  end generate latency_gt_0;
1577
end behav;
1578
 
1579
-------------------------------------------------------------------
1580
-- System Generator version 12.3 VHDL source file.
1581
--
1582
-- Copyright(C) 2010 by Xilinx, Inc.  All rights reserved.  This
1583
-- text/file contains proprietary, confidential information of Xilinx,
1584
-- Inc., is distributed under license from Xilinx, Inc., and may be used,
1585
-- copied and/or disclosed only pursuant to the terms of a valid license
1586
-- agreement with Xilinx, Inc.  Xilinx hereby grants you a license to use
1587
-- this text/file solely for design, simulation, implementation and
1588
-- creation of design files limited to Xilinx devices or technologies.
1589
-- Use with non-Xilinx devices or technologies is expressly prohibited
1590
-- and immediately terminates your license unless covered by a separate
1591
-- agreement.
1592
--
1593
-- Xilinx is providing this design, code, or information "as is" solely
1594
-- for use in developing programs and solutions for Xilinx devices.  By
1595
-- providing this design, code, or information as one possible
1596
-- implementation of this feature, application or standard, Xilinx is
1597
-- making no representation that this implementation is free from any
1598
-- claims of infringement.  You are responsible for obtaining any rights
1599
-- you may require for your implementation.  Xilinx expressly disclaims
1600
-- any warranty whatsoever with respect to the adequacy of the
1601
-- implementation, including but not limited to warranties of
1602
-- merchantability or fitness for a particular purpose.
1603
--
1604
-- Xilinx products are not intended for use in life support appliances,
1605
-- devices, or systems.  Use in such applications is expressly prohibited.
1606
--
1607
-- Any modifications that are made to the source code are done at the user's
1608
-- sole risk and will be unsupported.
1609
--
1610
-- This copyright and support notice must be retained as part of this
1611
-- text at all times.  (c) Copyright 1995-2010 Xilinx, Inc.  All rights
1612
-- reserved.
1613
-------------------------------------------------------------------
1614
-- synopsys translate_off
1615
library unisim;
1616
use unisim.vcomponents.all;
1617
-- synopsys translate_on
1618
library IEEE;
1619
use IEEE.std_logic_1164.all;
1620
use work.conv_pkg.all;
1621
entity single_reg_w_init is
1622
  generic (
1623
    width: integer := 8;
1624
    init_index: integer := 0;
1625
    init_value: bit_vector := b"0000"
1626
  );
1627
  port (
1628
    i: in std_logic_vector(width - 1 downto 0);
1629
    ce: in std_logic;
1630
    clr: in std_logic;
1631
    clk: in std_logic;
1632
    o: out std_logic_vector(width - 1 downto 0)
1633
  );
1634
end single_reg_w_init;
1635
architecture structural of single_reg_w_init is
1636
  function build_init_const(width: integer;
1637
                            init_index: integer;
1638
                            init_value: bit_vector)
1639
    return std_logic_vector
1640
  is
1641
    variable result: std_logic_vector(width - 1 downto 0);
1642
  begin
1643
    if init_index = 0 then
1644
      result := (others => '0');
1645
    elsif init_index = 1 then
1646
      result := (others => '0');
1647
      result(0) := '1';
1648
    else
1649
      result := to_stdlogicvector(init_value);
1650
    end if;
1651
    return result;
1652
  end;
1653
  component fdre
1654
    port (
1655
      q: out std_ulogic;
1656
      d: in  std_ulogic;
1657
      c: in  std_ulogic;
1658
      ce: in  std_ulogic;
1659
      r: in  std_ulogic
1660
    );
1661
  end component;
1662
  attribute syn_black_box of fdre: component is true;
1663
  attribute fpga_dont_touch of fdre: component is "true";
1664
  component fdse
1665
    port (
1666
      q: out std_ulogic;
1667
      d: in  std_ulogic;
1668
      c: in  std_ulogic;
1669
      ce: in  std_ulogic;
1670
      s: in  std_ulogic
1671
    );
1672
  end component;
1673
  attribute syn_black_box of fdse: component is true;
1674
  attribute fpga_dont_touch of fdse: component is "true";
1675
  constant init_const: std_logic_vector(width - 1 downto 0)
1676
    := build_init_const(width, init_index, init_value);
1677
begin
1678
  fd_prim_array: for index in 0 to width - 1 generate
1679
    bit_is_0: if (init_const(index) = '0') generate
1680
      fdre_comp: fdre
1681
        port map (
1682
          c => clk,
1683
          d => i(index),
1684
          q => o(index),
1685
          ce => ce,
1686
          r => clr
1687
        );
1688
    end generate;
1689
    bit_is_1: if (init_const(index) = '1') generate
1690
      fdse_comp: fdse
1691
        port map (
1692
          c => clk,
1693
          d => i(index),
1694
          q => o(index),
1695
          ce => ce,
1696
          s => clr
1697
        );
1698
    end generate;
1699
  end generate;
1700
end architecture structural;
1701
-- synopsys translate_off
1702
library unisim;
1703
use unisim.vcomponents.all;
1704
-- synopsys translate_on
1705
library IEEE;
1706
use IEEE.std_logic_1164.all;
1707
use work.conv_pkg.all;
1708
entity synth_reg_w_init is
1709
  generic (
1710
    width: integer := 8;
1711
    init_index: integer := 0;
1712
    init_value: bit_vector := b"0000";
1713
    latency: integer := 1
1714
  );
1715
  port (
1716
    i: in std_logic_vector(width - 1 downto 0);
1717
    ce: in std_logic;
1718
    clr: in std_logic;
1719
    clk: in std_logic;
1720
    o: out std_logic_vector(width - 1 downto 0)
1721
  );
1722
end synth_reg_w_init;
1723
architecture structural of synth_reg_w_init is
1724
  component single_reg_w_init
1725
    generic (
1726
      width: integer := 8;
1727
      init_index: integer := 0;
1728
      init_value: bit_vector := b"0000"
1729
    );
1730
    port (
1731
      i: in std_logic_vector(width - 1 downto 0);
1732
      ce: in std_logic;
1733
      clr: in std_logic;
1734
      clk: in std_logic;
1735
      o: out std_logic_vector(width - 1 downto 0)
1736
    );
1737
  end component;
1738
  signal dly_i: std_logic_vector((latency + 1) * width - 1 downto 0);
1739
  signal dly_clr: std_logic;
1740
begin
1741
  latency_eq_0: if (latency = 0) generate
1742
    o <= i;
1743
  end generate;
1744
  latency_gt_0: if (latency >= 1) generate
1745
    dly_i((latency + 1) * width - 1 downto latency * width) <= i
1746
      after 200 ps;
1747
    dly_clr <= clr after 200 ps;
1748
    fd_array: for index in latency downto 1 generate
1749
       reg_comp: single_reg_w_init
1750
          generic map (
1751
            width => width,
1752
            init_index => init_index,
1753
            init_value => init_value
1754
          )
1755
          port map (
1756
            clk => clk,
1757
            i => dly_i((index + 1) * width - 1 downto index * width),
1758
            o => dly_i(index * width - 1 downto (index - 1) * width),
1759
            ce => ce,
1760
            clr => dly_clr
1761
          );
1762
    end generate;
1763
    o <= dly_i(width - 1 downto 0);
1764
  end generate;
1765
end structural;
1766
library IEEE;
1767
use IEEE.std_logic_1164.all;
1768
use IEEE.numeric_std.all;
1769
use work.conv_pkg.all;
1770
 
1771
entity constant_6293007044 is
1772
  port (
1773
    op : out std_logic_vector((1 - 1) downto 0);
1774
    clk : in std_logic;
1775
    ce : in std_logic;
1776
    clr : in std_logic);
1777
end constant_6293007044;
1778
 
1779
 
1780
architecture behavior of constant_6293007044 is
1781
begin
1782
  op <= "1";
1783
end behavior;
1784
 
1785
library IEEE;
1786
use IEEE.std_logic_1164.all;
1787
use work.conv_pkg.all;
1788
 
1789
-- Generated from Simulink block "INOUT_LOGIC"
1790
 
1791
entity inout_logic is
1792
  port (
1793
    data_out: in std_logic;
1794
    data_out_x0: in std_logic_vector(31 downto 0);
1795
    data_out_x1: in std_logic_vector(31 downto 0);
1796
    data_out_x10: in std_logic;
1797
    data_out_x11: in std_logic;
1798
    data_out_x12: in std_logic_vector(31 downto 0);
1799
    data_out_x13: in std_logic;
1800
    data_out_x14: in std_logic_vector(31 downto 0);
1801
    data_out_x15: in std_logic;
1802
    data_out_x16: in std_logic_vector(31 downto 0);
1803
    data_out_x17: in std_logic;
1804
    data_out_x18: in std_logic_vector(31 downto 0);
1805
    data_out_x19: in std_logic;
1806
    data_out_x2: in std_logic;
1807
    data_out_x20: in std_logic_vector(31 downto 0);
1808
    data_out_x21: in std_logic;
1809
    data_out_x22: in std_logic_vector(31 downto 0);
1810
    data_out_x23: in std_logic;
1811
    data_out_x24: in std_logic_vector(31 downto 0);
1812
    data_out_x25: in std_logic_vector(31 downto 0);
1813
    data_out_x26: in std_logic;
1814
    data_out_x3: in std_logic_vector(31 downto 0);
1815
    data_out_x4: in std_logic;
1816
    data_out_x5: in std_logic_vector(31 downto 0);
1817
    data_out_x6: in std_logic;
1818
    data_out_x7: in std_logic_vector(31 downto 0);
1819
    data_out_x8: in std_logic;
1820
    data_out_x9: in std_logic_vector(31 downto 0);
1821
    debug_in_1i: in std_logic_vector(31 downto 0);
1822
    debug_in_2i: in std_logic_vector(31 downto 0);
1823
    debug_in_3i: in std_logic_vector(31 downto 0);
1824
    debug_in_4i: in std_logic_vector(31 downto 0);
1825
    dma_host2board_busy: in std_logic;
1826
    dma_host2board_done: in std_logic;
1827
    reg01_td: in std_logic_vector(31 downto 0);
1828
    reg01_tv: in std_logic;
1829
    reg02_td: in std_logic_vector(31 downto 0);
1830
    reg02_tv: in std_logic;
1831
    reg03_td: in std_logic_vector(31 downto 0);
1832
    reg03_tv: in std_logic;
1833
    reg04_td: in std_logic_vector(31 downto 0);
1834
    reg04_tv: in std_logic;
1835
    reg05_td: in std_logic_vector(31 downto 0);
1836
    reg05_tv: in std_logic;
1837
    reg06_td: in std_logic_vector(31 downto 0);
1838
    reg06_tv: in std_logic;
1839
    reg07_td: in std_logic_vector(31 downto 0);
1840
    reg07_tv: in std_logic;
1841
    reg08_td: in std_logic_vector(31 downto 0);
1842
    reg08_tv: in std_logic;
1843
    reg09_td: in std_logic_vector(31 downto 0);
1844
    reg09_tv: in std_logic;
1845
    reg10_td: in std_logic_vector(31 downto 0);
1846
    reg10_tv: in std_logic;
1847
    reg11_td: in std_logic_vector(31 downto 0);
1848
    reg11_tv: in std_logic;
1849
    reg12_td: in std_logic_vector(31 downto 0);
1850
    reg12_tv: in std_logic;
1851
    reg13_td: in std_logic_vector(31 downto 0);
1852
    reg13_tv: in std_logic;
1853
    reg14_td: in std_logic_vector(31 downto 0);
1854
    reg14_tv: in std_logic;
1855
    data_in: out std_logic_vector(31 downto 0);
1856
    data_in_x0: out std_logic;
1857
    data_in_x1: out std_logic_vector(31 downto 0);
1858
    data_in_x10: out std_logic_vector(31 downto 0);
1859
    data_in_x11: out std_logic_vector(31 downto 0);
1860
    data_in_x12: out std_logic;
1861
    data_in_x13: out std_logic_vector(31 downto 0);
1862
    data_in_x14: out std_logic;
1863
    data_in_x15: out std_logic_vector(31 downto 0);
1864
    data_in_x16: out std_logic;
1865
    data_in_x17: out std_logic_vector(31 downto 0);
1866
    data_in_x18: out std_logic;
1867
    data_in_x19: out std_logic_vector(31 downto 0);
1868
    data_in_x2: out std_logic;
1869
    data_in_x20: out std_logic;
1870
    data_in_x21: out std_logic;
1871
    data_in_x22: out std_logic_vector(31 downto 0);
1872
    data_in_x23: out std_logic;
1873
    data_in_x24: out std_logic_vector(31 downto 0);
1874
    data_in_x25: out std_logic;
1875
    data_in_x26: out std_logic_vector(31 downto 0);
1876
    data_in_x27: out std_logic;
1877
    data_in_x28: out std_logic_vector(31 downto 0);
1878
    data_in_x29: out std_logic_vector(31 downto 0);
1879
    data_in_x3: out std_logic_vector(31 downto 0);
1880
    data_in_x30: out std_logic_vector(31 downto 0);
1881
    data_in_x31: out std_logic;
1882
    data_in_x32: out std_logic_vector(31 downto 0);
1883
    data_in_x4: out std_logic;
1884
    data_in_x5: out std_logic_vector(31 downto 0);
1885
    data_in_x6: out std_logic;
1886
    data_in_x7: out std_logic_vector(31 downto 0);
1887
    data_in_x8: out std_logic;
1888
    data_in_x9: out std_logic;
1889
    en: out std_logic;
1890
    en_x0: out std_logic;
1891
    en_x1: out std_logic;
1892
    en_x10: out std_logic;
1893
    en_x11: out std_logic;
1894
    en_x12: out std_logic;
1895
    en_x13: out std_logic;
1896
    en_x14: out std_logic;
1897
    en_x15: out std_logic;
1898
    en_x16: out std_logic;
1899
    en_x17: out std_logic;
1900
    en_x18: out std_logic;
1901
    en_x19: out std_logic;
1902
    en_x2: out std_logic;
1903
    en_x20: out std_logic;
1904
    en_x21: out std_logic;
1905
    en_x22: out std_logic;
1906
    en_x23: out std_logic;
1907
    en_x24: out std_logic;
1908
    en_x25: out std_logic;
1909
    en_x26: out std_logic;
1910
    en_x27: out std_logic;
1911
    en_x28: out std_logic;
1912
    en_x29: out std_logic;
1913
    en_x3: out std_logic;
1914
    en_x30: out std_logic;
1915
    en_x31: out std_logic;
1916
    en_x32: out std_logic;
1917
    en_x4: out std_logic;
1918
    en_x5: out std_logic;
1919
    en_x6: out std_logic;
1920
    en_x7: out std_logic;
1921
    en_x8: out std_logic;
1922
    en_x9: out std_logic;
1923
    reg01_rd: out std_logic_vector(31 downto 0);
1924
    reg01_rv: out std_logic;
1925
    reg02_rd: out std_logic_vector(31 downto 0);
1926
    reg02_rv: out std_logic;
1927
    reg03_rd: out std_logic_vector(31 downto 0);
1928
    reg03_rv: out std_logic;
1929
    reg04_rd: out std_logic_vector(31 downto 0);
1930
    reg04_rv: out std_logic;
1931
    reg05_rd: out std_logic_vector(31 downto 0);
1932
    reg05_rv: out std_logic;
1933
    reg06_rd: out std_logic_vector(31 downto 0);
1934
    reg06_rv: out std_logic;
1935
    reg07_rd: out std_logic_vector(31 downto 0);
1936
    reg07_rv: out std_logic;
1937
    reg08_rd: out std_logic_vector(31 downto 0);
1938
    reg08_rv: out std_logic;
1939
    reg09_rd: out std_logic_vector(31 downto 0);
1940
    reg09_rv: out std_logic;
1941
    reg10_rd: out std_logic_vector(31 downto 0);
1942
    reg10_rv: out std_logic;
1943
    reg11_rd: out std_logic_vector(31 downto 0);
1944
    reg11_rv: out std_logic;
1945
    reg12_rd: out std_logic_vector(31 downto 0);
1946
    reg12_rv: out std_logic;
1947
    reg13_rd: out std_logic_vector(31 downto 0);
1948
    reg13_rv: out std_logic;
1949
    reg14_rd: out std_logic_vector(31 downto 0);
1950
    reg14_rv: out std_logic
1951
  );
1952
end inout_logic;
1953
 
1954
architecture structural of inout_logic is
1955
  attribute core_generation_info: string;
1956
  attribute core_generation_info of structural : architecture is "PCIe_UserLogic_00,sysgen_core,{clock_period=5.00000000,clocking=Clock_Enables,compilation=NGC_Netlist,sample_periods=1.00000000000,testbench=0,total_blocks=339,xilinx_constant_block_block=23,xilinx_counter_block=1,xilinx_gateway_in_block=44,xilinx_gateway_out_block=39,xilinx_inverter_block=2,xilinx_logical_block_block=1,xilinx_register_block=78,xilinx_shared_memory_based_from_register_block=62,xilinx_shared_memory_based_to_register_block=62,xilinx_subsystem_generator_block=1,xilinx_system_generator_block=2,xilinx_type_converter_block=14,}";
1957
 
1958
  signal constant1_op_net_x0: std_logic;
1959
  signal constant5_op_net_x0: std_logic;
1960
  signal debug_in_1i_net: std_logic_vector(31 downto 0);
1961
  signal debug_in_2i_net: std_logic_vector(31 downto 0);
1962
  signal debug_in_3i_net: std_logic_vector(31 downto 0);
1963
  signal debug_in_4i_net: std_logic_vector(31 downto 0);
1964
  signal dma_host2board_busy_net: std_logic;
1965
  signal dma_host2board_done_net: std_logic;
1966
  signal from_register10_data_out_net: std_logic_vector(31 downto 0);
1967
  signal from_register11_data_out_net: std_logic_vector(31 downto 0);
1968
  signal from_register12_data_out_net: std_logic;
1969
  signal from_register13_data_out_net: std_logic_vector(31 downto 0);
1970
  signal from_register14_data_out_net: std_logic;
1971
  signal from_register15_data_out_net: std_logic_vector(31 downto 0);
1972
  signal from_register16_data_out_net: std_logic;
1973
  signal from_register17_data_out_net: std_logic_vector(31 downto 0);
1974
  signal from_register18_data_out_net: std_logic;
1975
  signal from_register19_data_out_net: std_logic_vector(31 downto 0);
1976
  signal from_register1_data_out_net: std_logic;
1977
  signal from_register20_data_out_net: std_logic;
1978
  signal from_register21_data_out_net: std_logic_vector(31 downto 0);
1979
  signal from_register22_data_out_net: std_logic;
1980
  signal from_register23_data_out_net: std_logic_vector(31 downto 0);
1981
  signal from_register24_data_out_net: std_logic;
1982
  signal from_register25_data_out_net: std_logic_vector(31 downto 0);
1983
  signal from_register26_data_out_net: std_logic;
1984
  signal from_register27_data_out_net: std_logic_vector(31 downto 0);
1985
  signal from_register28_data_out_net: std_logic;
1986
  signal from_register2_data_out_net: std_logic;
1987
  signal from_register3_data_out_net: std_logic_vector(31 downto 0);
1988
  signal from_register4_data_out_net: std_logic;
1989
  signal from_register5_data_out_net: std_logic_vector(31 downto 0);
1990
  signal from_register6_data_out_net: std_logic;
1991
  signal from_register7_data_out_net: std_logic_vector(31 downto 0);
1992
  signal from_register8_data_out_net: std_logic_vector(31 downto 0);
1993
  signal from_register9_data_out_net: std_logic;
1994
  signal reg01_td_net: std_logic_vector(31 downto 0);
1995
  signal reg01_tv_net: std_logic;
1996
  signal reg02_td_net: std_logic_vector(31 downto 0);
1997
  signal reg02_tv_net: std_logic;
1998
  signal reg03_td_net: std_logic_vector(31 downto 0);
1999
  signal reg03_tv_net: std_logic;
2000
  signal reg04_td_net: std_logic_vector(31 downto 0);
2001
  signal reg04_tv_net: std_logic;
2002
  signal reg05_td_net: std_logic_vector(31 downto 0);
2003
  signal reg05_tv_net: std_logic;
2004
  signal reg06_td_net: std_logic_vector(31 downto 0);
2005
  signal reg06_tv_net: std_logic;
2006
  signal reg07_td_net: std_logic_vector(31 downto 0);
2007
  signal reg07_tv_net: std_logic;
2008
  signal reg08_td_net: std_logic_vector(31 downto 0);
2009
  signal reg08_tv_net: std_logic;
2010
  signal reg09_td_net: std_logic_vector(31 downto 0);
2011
  signal reg09_tv_net: std_logic;
2012
  signal reg10_td_net: std_logic_vector(31 downto 0);
2013
  signal reg10_tv_net: std_logic;
2014
  signal reg11_td_net: std_logic_vector(31 downto 0);
2015
  signal reg11_tv_net: std_logic;
2016
  signal reg12_td_net: std_logic_vector(31 downto 0);
2017
  signal reg12_tv_net: std_logic;
2018
  signal reg13_td_net: std_logic_vector(31 downto 0);
2019
  signal reg13_tv_net: std_logic;
2020
  signal reg14_td_net: std_logic_vector(31 downto 0);
2021
  signal reg14_tv_net: std_logic;
2022
 
2023
begin
2024
  from_register1_data_out_net <= data_out;
2025
  from_register10_data_out_net <= data_out_x0;
2026
  from_register11_data_out_net <= data_out_x1;
2027
  from_register2_data_out_net <= data_out_x10;
2028
  from_register20_data_out_net <= data_out_x11;
2029
  from_register21_data_out_net <= data_out_x12;
2030
  from_register22_data_out_net <= data_out_x13;
2031
  from_register23_data_out_net <= data_out_x14;
2032
  from_register24_data_out_net <= data_out_x15;
2033
  from_register25_data_out_net <= data_out_x16;
2034
  from_register26_data_out_net <= data_out_x17;
2035
  from_register27_data_out_net <= data_out_x18;
2036
  from_register28_data_out_net <= data_out_x19;
2037
  from_register12_data_out_net <= data_out_x2;
2038
  from_register3_data_out_net <= data_out_x20;
2039
  from_register4_data_out_net <= data_out_x21;
2040
  from_register5_data_out_net <= data_out_x22;
2041
  from_register6_data_out_net <= data_out_x23;
2042
  from_register7_data_out_net <= data_out_x24;
2043
  from_register8_data_out_net <= data_out_x25;
2044
  from_register9_data_out_net <= data_out_x26;
2045
  from_register13_data_out_net <= data_out_x3;
2046
  from_register14_data_out_net <= data_out_x4;
2047
  from_register15_data_out_net <= data_out_x5;
2048
  from_register16_data_out_net <= data_out_x6;
2049
  from_register17_data_out_net <= data_out_x7;
2050
  from_register18_data_out_net <= data_out_x8;
2051
  from_register19_data_out_net <= data_out_x9;
2052
  debug_in_1i_net <= debug_in_1i;
2053
  debug_in_2i_net <= debug_in_2i;
2054
  debug_in_3i_net <= debug_in_3i;
2055
  debug_in_4i_net <= debug_in_4i;
2056
  dma_host2board_busy_net <= dma_host2board_busy;
2057
  dma_host2board_done_net <= dma_host2board_done;
2058
  reg01_td_net <= reg01_td;
2059
  reg01_tv_net <= reg01_tv;
2060
  reg02_td_net <= reg02_td;
2061
  reg02_tv_net <= reg02_tv;
2062
  reg03_td_net <= reg03_td;
2063
  reg03_tv_net <= reg03_tv;
2064
  reg04_td_net <= reg04_td;
2065
  reg04_tv_net <= reg04_tv;
2066
  reg05_td_net <= reg05_td;
2067
  reg05_tv_net <= reg05_tv;
2068
  reg06_td_net <= reg06_td;
2069
  reg06_tv_net <= reg06_tv;
2070
  reg07_td_net <= reg07_td;
2071
  reg07_tv_net <= reg07_tv;
2072
  reg08_td_net <= reg08_td;
2073
  reg08_tv_net <= reg08_tv;
2074
  reg09_td_net <= reg09_td;
2075
  reg09_tv_net <= reg09_tv;
2076
  reg10_td_net <= reg10_td;
2077
  reg10_tv_net <= reg10_tv;
2078
  reg11_td_net <= reg11_td;
2079
  reg11_tv_net <= reg11_tv;
2080
  reg12_td_net <= reg12_td;
2081
  reg12_tv_net <= reg12_tv;
2082
  reg13_td_net <= reg13_td;
2083
  reg13_tv_net <= reg13_tv;
2084
  reg14_td_net <= reg14_td;
2085
  reg14_tv_net <= reg14_tv;
2086
  data_in <= debug_in_2i_net;
2087
  data_in_x0 <= reg04_tv_net;
2088
  data_in_x1 <= reg04_td_net;
2089
  data_in_x10 <= debug_in_3i_net;
2090
  data_in_x11 <= debug_in_4i_net;
2091
  data_in_x12 <= reg09_tv_net;
2092
  data_in_x13 <= reg09_td_net;
2093
  data_in_x14 <= reg10_tv_net;
2094
  data_in_x15 <= reg10_td_net;
2095
  data_in_x16 <= reg08_tv_net;
2096
  data_in_x17 <= reg08_td_net;
2097
  data_in_x18 <= reg11_tv_net;
2098
  data_in_x19 <= reg11_td_net;
2099
  data_in_x2 <= reg05_tv_net;
2100
  data_in_x20 <= reg12_tv_net;
2101
  data_in_x21 <= reg01_tv_net;
2102
  data_in_x22 <= reg12_td_net;
2103
  data_in_x23 <= reg13_tv_net;
2104
  data_in_x24 <= reg13_td_net;
2105
  data_in_x25 <= reg14_tv_net;
2106
  data_in_x26 <= reg14_td_net;
2107
  data_in_x27 <= reg02_tv_net;
2108
  data_in_x28 <= reg02_td_net;
2109
  data_in_x29 <= debug_in_1i_net;
2110
  data_in_x3 <= reg05_td_net;
2111
  data_in_x30 <= reg01_td_net;
2112
  data_in_x31 <= reg03_tv_net;
2113
  data_in_x32 <= reg03_td_net;
2114
  data_in_x4 <= reg06_tv_net;
2115
  data_in_x5 <= reg06_td_net;
2116
  data_in_x6 <= reg07_tv_net;
2117
  data_in_x7 <= reg07_td_net;
2118
  data_in_x8 <= dma_host2board_busy_net;
2119
  data_in_x9 <= dma_host2board_done_net;
2120
  en <= constant5_op_net_x0;
2121
  en_x0 <= constant5_op_net_x0;
2122
  en_x1 <= constant5_op_net_x0;
2123
  en_x10 <= constant5_op_net_x0;
2124
  en_x11 <= constant5_op_net_x0;
2125
  en_x12 <= constant1_op_net_x0;
2126
  en_x13 <= constant1_op_net_x0;
2127
  en_x14 <= constant1_op_net_x0;
2128
  en_x15 <= constant1_op_net_x0;
2129
  en_x16 <= constant1_op_net_x0;
2130
  en_x17 <= constant1_op_net_x0;
2131
  en_x18 <= constant1_op_net_x0;
2132
  en_x19 <= constant1_op_net_x0;
2133
  en_x2 <= constant5_op_net_x0;
2134
  en_x20 <= constant1_op_net_x0;
2135
  en_x21 <= constant5_op_net_x0;
2136
  en_x22 <= constant1_op_net_x0;
2137
  en_x23 <= constant1_op_net_x0;
2138
  en_x24 <= constant1_op_net_x0;
2139
  en_x25 <= constant1_op_net_x0;
2140
  en_x26 <= constant1_op_net_x0;
2141
  en_x27 <= constant5_op_net_x0;
2142
  en_x28 <= constant5_op_net_x0;
2143
  en_x29 <= constant5_op_net_x0;
2144
  en_x3 <= constant5_op_net_x0;
2145
  en_x30 <= constant5_op_net_x0;
2146
  en_x31 <= constant5_op_net_x0;
2147
  en_x32 <= constant5_op_net_x0;
2148
  en_x4 <= constant5_op_net_x0;
2149
  en_x5 <= constant5_op_net_x0;
2150
  en_x6 <= constant5_op_net_x0;
2151
  en_x7 <= constant5_op_net_x0;
2152
  en_x8 <= constant5_op_net_x0;
2153
  en_x9 <= constant5_op_net_x0;
2154
  reg01_rd <= from_register3_data_out_net;
2155
  reg01_rv <= from_register1_data_out_net;
2156
  reg02_rd <= from_register5_data_out_net;
2157
  reg02_rv <= from_register2_data_out_net;
2158
  reg03_rd <= from_register7_data_out_net;
2159
  reg03_rv <= from_register6_data_out_net;
2160
  reg04_rd <= from_register8_data_out_net;
2161
  reg04_rv <= from_register4_data_out_net;
2162
  reg05_rd <= from_register10_data_out_net;
2163
  reg05_rv <= from_register9_data_out_net;
2164
  reg06_rd <= from_register11_data_out_net;
2165
  reg06_rv <= from_register12_data_out_net;
2166
  reg07_rd <= from_register13_data_out_net;
2167
  reg07_rv <= from_register14_data_out_net;
2168
  reg08_rd <= from_register15_data_out_net;
2169
  reg08_rv <= from_register16_data_out_net;
2170
  reg09_rd <= from_register17_data_out_net;
2171
  reg09_rv <= from_register18_data_out_net;
2172
  reg10_rd <= from_register19_data_out_net;
2173
  reg10_rv <= from_register20_data_out_net;
2174
  reg11_rd <= from_register21_data_out_net;
2175
  reg11_rv <= from_register22_data_out_net;
2176
  reg12_rd <= from_register23_data_out_net;
2177
  reg12_rv <= from_register24_data_out_net;
2178
  reg13_rd <= from_register25_data_out_net;
2179
  reg13_rv <= from_register26_data_out_net;
2180
  reg14_rd <= from_register27_data_out_net;
2181
  reg14_rv <= from_register28_data_out_net;
2182
 
2183
  constant1: entity work.constant_6293007044
2184
    port map (
2185
      ce => '0',
2186
      clk => '0',
2187
      clr => '0',
2188
      op(0) => constant1_op_net_x0
2189
    );
2190
 
2191
  constant5: entity work.constant_6293007044
2192
    port map (
2193
      ce => '0',
2194
      clk => '0',
2195
      clr => '0',
2196
      op(0) => constant5_op_net_x0
2197
    );
2198
 
2199
end structural;

powered by: WebSVN 2.1.0

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