SURF  1.0
AxiAds42lb69Deser.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : AxiAds42lb69Deser.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-03-20
5 -- Last update: 2015-05-19
6 -------------------------------------------------------------------------------
7 -- Description: ADC DDR Deserializer
8 -------------------------------------------------------------------------------
9 -- This file is part of 'SLAC Firmware Standard Library'.
10 -- It is subject to the license terms in the LICENSE.txt file found in the
11 -- top-level directory of this distribution and at:
12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13 -- No part of 'SLAC Firmware Standard Library', including this file,
14 -- may be copied, modified, propagated, or distributed except according to
15 -- the terms contained in the LICENSE.txt file.
16 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.std_logic_unsigned.all;
21 use ieee.std_logic_arith.all;
22 
23 use work.StdRtlPkg.all;
24 use work.AxiAds42lb69Pkg.all;
25 
26 library unisim;
27 use unisim.vcomponents.all;
28 
29 --! @see entity
30  --! @ingroup devices_Ti_ads42lb69
32  generic (
33  TPD_G : time := 1 ns;
34  USE_PLL_G : boolean := false;
35  ADC_CLK_FREQ_G : real := 250.0E+6;
36  DELAY_INIT_G : Slv9VectorArray(1 downto 0, 7 downto 0) := (others => (others => (others => '0')));
37  IODELAY_GROUP_G : string := "AXI_ADS42LB69_IODELAY_GRP";
38  XIL_DEVICE_G : string := "7SERIES");
39  port (
40  -- ADC Ports
41  clkP : out sl;
42  clkN : out sl;
43  syncP : out sl;
44  syncN : out sl;
45  clkFbP : in sl;
46  clkFbN : in sl;
47  dataP : in Slv8Array(1 downto 0);
48  dataN : in Slv8Array(1 downto 0);
49  -- ADC Data Interface (adcClk domain)
50  adcData : out Slv16Array(1 downto 0);
51  -- Register Interface
52  dmode : in slv(1 downto 0);
53  -- Register Interface (axiClk domain)
56  -- Clocks and Resets
57  axiClk : in sl;
58  axiRst : in sl;
59  adcClk : in sl;
60  adcRst : in sl;
61  adcSync : in sl;
63 end AxiAds42lb69Deser;
64 
65 architecture rtl of AxiAds42lb69Deser is
66 
67  signal adcClock : sl;
68  signal dmux : slv(1 downto 0);
69  signal adcDataPs : Slv8Array(1 downto 0);
70  signal adcDataNs : Slv8Array(1 downto 0);
71  signal adcDataP : Slv8Array(1 downto 0);
72  signal adcDataN : Slv8Array(1 downto 0);
73  signal adcDataNd : Slv8Array(1 downto 0);
74  signal adcDmuxA : Slv8Array(1 downto 0);
75  signal adcDmuxB : Slv8Array(1 downto 0);
76  signal data : Slv16Array(1 downto 0);
77 
78 begin
79 
80  AxiAds42lb69Pll_Inst : entity work.AxiAds42lb69Pll
81  generic map(
82  TPD_G => TPD_G,
86  port map (
87  -- ADC Clocking ports
88  adcClkP => clkP,
89  adcClkN => clkN,
90  adcSyncP => syncP,
91  adcSyncN => syncN,
92  adcClkFbP => clkFbP,
93  adcClkFbN => clkFbN,
94  -- ADC Reference Signals
95  adcSync => adcSync,
96  adcClk => adcClk,
97  adcRst => adcRst,
98  adcClock => adcClock);
99 
100  SynchVector_Inst : entity work.SynchronizerVector
101  generic map(
102  TPD_G => TPD_G,
103  WIDTH_G => 2)
104  port map(
105  clk => adcClock,
106  dataIn => dmode,
107  dataOut => dmux);
108 
109  GEN_7SERIES : if (XIL_DEVICE_G = "7SERIES") generate
110  attribute IODELAY_GROUP : string;
111  attribute IODELAY_GROUP of IDELAYCTRL_Inst : label is IODELAY_GROUP_G;
112  signal rstSync : sl;
113  begin
114  IDELAYCTRL_Inst : IDELAYCTRL
115  port map (
116  RDY => delayOut.rdy, -- 1-bit output: Ready output
117  REFCLK => refClk200MHz, -- 1-bit input: Reference clock input
118  RST => rstSync); -- 1-bit input: Active high reset input
119 
120  Sync_delayIn_rst : entity work.RstSync
121  generic map (
122  TPD_G => TPD_G,
123  RELEASE_DELAY_G => 16)
124  port map (
125  clk => refClk200MHz,
126  asyncRst => delayIn.rst,
127  syncRst => rstSync);
128 
129  end generate;
130 
131  GEN_CH :
132  for ch in 1 downto 0 generate
133  GEN_DAT :
134  for i in 7 downto 0 generate
135 
136  AxiAds42lb69DeserBit_Inst : entity work.AxiAds42lb69DeserBit
137  generic map(
138  TPD_G => TPD_G,
139  DELAY_INIT_G => DELAY_INIT_G(ch, i),
142  port map (
143  -- ADC Data (clk domain)
144  dataP => dataP(ch)(i),
145  dataN => dataN(ch)(i),
146  Q1 => adcDataPs(ch)(i),
147  Q2 => adcDataNs(ch)(i),
148  -- IO_Delay (delayClk domain)
149  delayInLoad => delayIn.load(ch)(i),
150  delayInData => delayIn.data,
151  delayOutData => delayOut.data(ch, i),
152  -- Clocks
153  clk => adcClock,
154  delayRst => axiRst,
155  delayClk => axiClk);
156 
157  end generate GEN_DAT;
158 
159  process(adcClock)
160  variable i : integer;
161  begin
162  if rising_edge(adcClock) then
163  adcDataP(ch) <= adcDataPs(ch) after TPD_G;
164  adcDataN(ch) <= adcDataNs(ch) after TPD_G;
165  adcDataNd(ch) <= adcDataN(ch) after TPD_G;
166  if dmux(ch) = '0' then
167  adcDmuxA(ch) <= adcDataNd(ch) after TPD_G;
168  adcDmuxB(ch) <= adcDataP(ch) after TPD_G;
169  else
170  adcDmuxA(ch) <= adcDataP(ch) after TPD_G;
171  adcDmuxB(ch) <= adcDataN(ch) after TPD_G;
172  end if;
173  for i in 7 downto 0 loop
174  data(ch)(2*i+1) <= adcDmuxB(ch)(i) after TPD_G;
175  data(ch)(2*i) <= adcDmuxA(ch)(i) after TPD_G;
176  end loop;
177  end if;
178  end process;
179 
180  SyncFifo_Inst : entity work.SynchronizerFifo
181  generic map(
182  TPD_G => TPD_G,
184  DATA_WIDTH_G => 16)
185  port map(
186  -- Asynchronous Reset
187  rst => adcRst,
188  --Write Ports (wr_clk domain)
189  wr_clk => adcClock,
190  din => data(ch),
191  --Read Ports (rd_clk domain)
192  rd_clk => adcClk,
193  dout => adcData(ch));
194 
195  end generate GEN_CH;
196 
197 end rtl;
slv( 8 downto 0) data
out syncRstsl
Definition: RstSync.vhd:36
out delayOutDataslv( 9 downto 0)
std_logic sl
Definition: StdRtlPkg.vhd:28
in dinslv( DATA_WIDTH_G- 1 downto 0)
XIL_DEVICE_Gstring := "7SERIES"
IODELAY_GROUP_Gstring := "AXI_ADS42LB69_IODELAY_GRP"
DELAY_INIT_Gslv( 8 downto 0) :=( others => '0')
in dataPSlv8Array( 1 downto 0)
out delayOutAxiAds42lb69DelayOutType
in delayInDataslv( 8 downto 0)
DELAY_INIT_GSlv9VectorArray ( 1 downto 0, 7 downto 0):=( others =>( others =>( others => '0')))
in dataInslv( WIDTH_G- 1 downto 0)
in asyncRstsl
Definition: RstSync.vhd:35
ADC_CLK_FREQ_Greal := 250.0E+6
_library_ ieeeieee
out doutslv( DATA_WIDTH_G- 1 downto 0)
in clksl
Definition: RstSync.vhd:34
IODELAY_GROUP_Gstring := "AXI_ADS42LB69_IODELAY_GRP"
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
Definition: RstSync.vhd:31
XIL_DEVICE_Gstring := "7SERIES"
COMMON_CLK_Gboolean := false
out adcDataSlv16Array( 1 downto 0)
ADC_CLK_FREQ_Greal := 250.0E+6
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
out dataOutslv( WIDTH_G- 1 downto 0)
in dmodeslv( 1 downto 0)
in dataNSlv8Array( 1 downto 0)
array(natural range <> ) of slv( 15 downto 0) Slv16Array
Definition: StdRtlPkg.vhd:395
USE_PLL_Gboolean := true
in delayInAxiAds42lb69DelayInType
array(natural range <> ,natural range <> ) of slv( 8 downto 0) Slv9VectorArray
Definition: StdRtlPkg.vhd:660
TPD_Gtime := 1 ns
array(natural range <> ) of slv( 7 downto 0) Slv8Array
Definition: StdRtlPkg.vhd:403
USE_PLL_Gboolean := false
XIL_DEVICE_Gstring := "7SERIES"
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
std_logic_vector slv
Definition: StdRtlPkg.vhd:29