AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
scrambler.vhd
1 -------------------------------------------------------------------------------
2 -- ____ ____
3 -- / /\/ /
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 2.3
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename : sfp3_v2_3_scrambler_64b66b.vhd
8 -- /___/ /\
9 -- \ \ / \
10 -- \___\/\___\
11 --
12 --
13 -- Module SFP3_v2_3_SCRAMBLER_64B66B
14 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
15 --
16 --
17 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
18 --
19 -- This file contains confidential and proprietary information
20 -- of Xilinx, Inc. and is protected under U.S. and
21 -- international copyright and other intellectual property
22 -- laws.
23 --
24 -- DISCLAIMER
25 -- This disclaimer is not a license and does not grant any
26 -- rights to the materials distributed herewith. Except as
27 -- otherwise provided in a valid license issued to you by
28 -- Xilinx, and to the maximum extent permitted by applicable
29 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
30 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
31 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
32 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
33 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
34 -- (2) Xilinx shall not be liable (whether in contract or tort,
35 -- including negligence, or under any other theory of
36 -- liability) for any loss or damage of any kind or nature
37 -- related to, arising under or in connection with these
38 -- materials, including for any direct, or any indirect,
39 -- special, incidental, or consequential loss or damage
40 -- (including loss of data, profits, goodwill, or any type of
41 -- loss or damage suffered as a result of any action brought
42 -- by a third party) even if such damage or loss was
43 -- reasonably foreseeable or Xilinx had been advised of the
44 -- possibility of the same.
45 --
46 -- CRITICAL APPLICATIONS
47 -- Xilinx products are not designed or intended to be fail-
48 -- safe, or for use in any application requiring fail-safe
49 -- performance, such as life-support or safety devices or
50 -- systems, Class III medical devices, nuclear facilities,
51 -- applications related to the deployment of airbags, or any
52 -- other applications that could lead to death, personal
53 -- injury, or severe property or environmental damage
54 -- (individually and collectively, "Critical
55 -- Applications"). Customer assumes the sole risk and
56 -- liability of any use of Xilinx products in Critical
57 -- Applications, subject only to applicable laws and
58 -- regulations governing limitations on product liability.
59 --
60 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
61 -- PART OF THIS FILE AT ALL TIMES.
62 
63 
64 library ieee;
65 use ieee.std_logic_1164.all;
66 use ieee.numeric_std.all;
67 library UNISIM;
68 use UNISIM.VCOMPONENTS.ALL;
69 
70 --***********************************Entity Declaration*******************************
71 
72 entity SCRAMBLER is
73 generic
74 (
75  TX_DATA_WIDTH : integer := 32
76 );
77 port
78 (
79  -- User Interface
80  UNSCRAMBLED_DATA_IN : in std_logic_vector((TX_DATA_WIDTH-1) downto 0);
81  SCRAMBLED_DATA_OUT : out std_logic_vector((TX_DATA_WIDTH-1) downto 0);
82  DATA_VALID_IN : in std_logic;
83 
84  -- System Interface
85  USER_CLK : in std_logic;
86  SYSTEM_RESET : in std_logic
87 );
88 
89 
90 end SCRAMBLER;
91 
92 architecture RTL of SCRAMBLER is
93 
94 
95 --***********************************Parameter Declarations********************
96 
97  constant DLY : time := 10 ps;
98 
99 --***************************Internal Register Declarations********************
100 
101  signal poly : std_logic_vector(57 downto 0);
102  signal scrambler : std_logic_vector(57 downto 0);
103  signal scrambled_data_i : std_logic_vector((TX_DATA_WIDTH-1) downto 0);
104  signal tempdata : std_logic_vector((TX_DATA_WIDTH-1) downto 0);
105 
106 --*********************************Main Body of Code***************************
107 begin
108 
109 
110  process( scrambler,UNSCRAMBLED_DATA_IN )
111  variable poly_i : std_logic_vector(57 downto 0);
112  variable tempData_i : std_logic_vector((TX_DATA_WIDTH-1) downto 0);
113  variable xorBit : std_logic;
114  variable i : integer;
115  begin
116  poly_i := scrambler;
117  for i in 0 to (TX_DATA_WIDTH-1) loop
118  xorBit := UNSCRAMBLED_DATA_IN(i) xor poly_i(38) xor poly_i(57);
119  poly_i := (poly_i(56 downto 0) & xorBit);
120  tempData_i(i) := xorBit;
121  end loop;
122  poly <= poly_i;
123  tempdata <= tempdata_i;
124  end process;
125 
126  --________________ Scrambled Data assignment to output port _______________
127 
128  process( USER_CLK )
129  begin
130  if(USER_CLK'event and USER_CLK = '1') then
131  if (SYSTEM_RESET = '1') then
132  scrambler <= "0101010101010101010101010101010101010101010101010101010101" after DLY;
133  SCRAMBLED_DATA_OUT <= (others => '0') after DLY;
134  elsif (DATA_VALID_IN = '1') then
135  scrambler <= poly after DLY;
136  SCRAMBLED_DATA_OUT <= tempdata after DLY;
137  end if;
138  end if;
139  end process;
140 
141 end RTL;
142