1 ---------------------------------------------------------------------------
3 -- Module : encode_8b10b_pkg.vhd
7 -- Last Update : 2008-10-31
9 -- Project : 8b/10b Encoder Reference Design
11 -- Description : 8b/10b Encoder package file
13 -- Company : Xilinx, Inc.
15 -- DISCLAIMER OF LIABILITY
17 -- This file contains proprietary and confidential information of
18 -- Xilinx, Inc. ("Xilinx"), that
is distributed under a license
19 -- from Xilinx, and may be used, copied and/or disclosed only
20 -- pursuant to the terms of a valid license agreement with Xilinx.
22 -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION
23 -- ("MATERIALS") "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER
24 -- EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT
25 -- LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT,
26 -- MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx
27 -- does not warrant that functions included in the Materials will
28 -- meet the requirements of Licensee, or that the operation of the
29 -- Materials will be uninterrupted or error-free, or that defects
30 -- in the Materials will be corrected. Furthermore, Xilinx does
31 -- not warrant or make any representations regarding use, or the
32 -- results of the use, of the Materials in terms of correctness,
33 -- accuracy, reliability or otherwise.
35 -- Xilinx products are not designed or intended to be fail-safe,
36 -- or for use in any application requiring fail-safe performance,
37 -- such as life-support or safety devices or systems, Class III
38 -- medical devices, nuclear facilities, applications related to
39 -- the deployment of airbags, or any other applications that could
40 -- lead to death, personal injury or severe property or
41 -- environmental damage (individually and collectively, "critical
42 -- applications"). Customer assumes the sole risk and liability
43 -- of any use of Xilinx products in critical applications,
44 -- subject only to applicable laws and regulations governing
45 -- limitations on product liability.
47 -- Copyright 2000,
2001,
2002,
2003,
2004,
2008 Xilinx, Inc.
48 -- All rights reserved.
50 -- This disclaimer and copyright notice must be retained as part
51 -- of this file at all times.
53 ---------------------------------------------------------------------------
57 -- Date Version Description
59 -- 10/31/2008 1.
1 Initial
release
61 -------------------------------------------------------------------------------
64 USE IEEE.STD_LOGIC_1164.
ALL;
65 USE IEEE.std_logic_misc.
ALL;
68 -------------------------------------------------------------------------------
69 -- Package Declaration
70 -------------------------------------------------------------------------------
73 -------------------------------------------------------------------------------
74 -- Constant Declaration
75 -------------------------------------------------------------------------------
76 CONSTANT TFF : := 2 ns;
78 -------------------------------------------------------------------------------
79 -- Function Declarations
80 -------------------------------------------------------------------------------
81 FUNCTION concat_force_code(
82 force_code_disp : ; force_code_val : )
87 FUNCTION boolean_to_std_logic(
94 C_HAS_BPORTS : ; has_aport :
99 -------------------------------------------------------------------------------
101 -------------------------------------------------------------------------------
104 -------------------------------------------------------------------------------
105 -- Determine initial value of DOUT based on C_FORCE_CODE_DISP and
107 -------------------------------------------------------------------------------
108 FUNCTION concat_force_code(
112 VARIABLE tmp :
(1 TO 12);
114 IF (force_code_disp =
1) THEN
115 tmp :=
"01" & force_code_val;
117 tmp :=
"00" & force_code_val;
120 END concat_force_code;
122 -------------------------------------------------------------------------------
123 -- Converts a containing 1's and 0's into a of
125 -------------------------------------------------------------------------------
126 FUNCTION str_to_slv(bitsin : ; nbits : )
128 VARIABLE ret :
(bitsin'
range);
129 VARIABLE ret0s :
(1 TO nbits
) :=
(OTHERS => '
0'
);
130 VARIABLE retpadded :
(1 TO nbits
) :=
(OTHERS => '
0'
);
131 VARIABLE offset : :=
0;
133 IF(bitsin'length =
0) THEN -- Make all '0's
136 IF(bitsin'length < nbits
) THEN -- pad MSBs with '0's
137 offset := nbits - bitsin'length;
138 FOR i
IN bitsin'
range LOOP
139 IF bitsin
(i
) = '
1'
THEN
140 retpadded
(i+offset
) := '
1';
141 ELSIF (bitsin
(i
) = 'X'
OR bitsin
(i
) = 'x'
) THEN
142 retpadded
(i+offset
) := 'X';
143 ELSIF (bitsin
(i
) = 'Z'
OR bitsin
(i
) = 'z'
) THEN
144 retpadded
(i+offset
) := 'Z';
145 ELSIF (bitsin
(i
) = '
0'
) THEN
146 retpadded
(i+offset
) := '
0';
149 retpadded
(1 TO offset
) :=
(OTHERS => '
0'
);
152 FOR i
IN bitsin'
range LOOP
153 IF bitsin
(i
) = '
1'
THEN
155 ELSIF (bitsin
(i
) = 'X'
OR bitsin
(i
) = 'x'
) THEN
157 ELSIF (bitsin
(i
) = 'Z'
OR bitsin
(i
) = 'z'
) THEN
159 ELSIF (bitsin
(i
) = '
0'
) THEN
167 -------------------------------------------------------------------------------
168 -- This function takes in a value and returns
170 -------------------------------------------------------------------------------
171 FUNCTION boolean_to_std_logic(value : )
RETURN IS
178 END boolean_to_std_logic;
180 -------------------------------------------------------------------------------
181 -- Converts a binary (0 or 1)
to a binary value.
182 -------------------------------------------------------------------------------
183 FUNCTION bint_2_sl (X : )
RETURN IS
192 -----------------------------------------------------------------------------
193 -- If C_HAS_BPORTS = 1,
then the optional B ports are configured the
194 -- same as the optional A ports
195 -- If C_HAS_BPORTS = 0,
then the optional B ports are disabled (=
0)
196 -----------------------------------------------------------------------------
201 VARIABLE has_bport : ;
203 IF (C_HAS_BPORTS =
1) THEN
204 has_bport := has_aport;
211 END encode_8b10b_pkg;