1 |
2 |
zguig52 |
-------------------------------
|
2 |
|
|
---- Project: EurySPACE CCSDS RX/TX with wishbone interface
|
3 |
|
|
---- Design Name: ccsds_tx_manager
|
4 |
|
|
---- Version: 1.0.0
|
5 |
|
|
---- Description:
|
6 |
|
|
---- In charge of internal clocks generation + forwarding to reduce power draw + select TX input data
|
7 |
|
|
-------------------------------
|
8 |
|
|
---- Author(s):
|
9 |
|
|
---- Guillaume REMBERT
|
10 |
|
|
-------------------------------
|
11 |
|
|
---- Licence:
|
12 |
|
|
---- MIT
|
13 |
|
|
-------------------------------
|
14 |
|
|
---- Changes list:
|
15 |
|
|
---- 2016/10/16: initial release
|
16 |
|
|
---- 2016/10/31: add serdes sub-component
|
17 |
|
|
---- 2016/11/05: add clock generator sub-component
|
18 |
|
|
-------------------------------
|
19 |
|
|
|
20 |
|
|
-- libraries used
|
21 |
|
|
library ieee;
|
22 |
|
|
use ieee.std_logic_1164.all;
|
23 |
|
|
|
24 |
|
|
--=============================================================================
|
25 |
|
|
-- Entity declaration for ccsds_tx / unitary tx manager inputs and outputs
|
26 |
|
|
--=============================================================================
|
27 |
|
|
entity ccsds_tx_manager is
|
28 |
|
|
generic(
|
29 |
|
|
constant CCSDS_TX_MANAGER_BITS_PER_SYMBOL: integer;
|
30 |
|
|
constant CCSDS_TX_MANAGER_MODULATION_TYPE: integer;
|
31 |
|
|
constant CCSDS_TX_MANAGER_DATALINK_OVERHEAD_RATIO: integer := 2;
|
32 |
|
|
constant CCSDS_TX_MANAGER_PARALLELISM_MAX_RATIO: integer := 16;
|
33 |
|
|
constant CCSDS_TX_MANAGER_OVERSAMPLING_RATIO: integer;
|
34 |
|
|
constant CCSDS_TX_MANAGER_DATA_BUS_SIZE : integer
|
35 |
|
|
);
|
36 |
|
|
port(
|
37 |
|
|
-- inputs
|
38 |
|
|
clk_i: in std_logic;
|
39 |
|
|
dat_par_i: in std_logic_vector(CCSDS_TX_MANAGER_DATA_BUS_SIZE-1 downto 0);
|
40 |
|
|
dat_ser_i: in std_logic;
|
41 |
|
|
dat_val_i: in std_logic;
|
42 |
|
|
ena_i: in std_logic;
|
43 |
|
|
in_sel_i: in std_logic; -- 0 = parallel data / 1 = external serial data
|
44 |
|
|
rst_i: in std_logic;
|
45 |
|
|
-- outputs
|
46 |
|
|
clk_bit_o: out std_logic;
|
47 |
|
|
clk_dat_o: out std_logic;
|
48 |
|
|
clk_sam_o: out std_logic;
|
49 |
|
|
clk_sym_o: out std_logic;
|
50 |
|
|
dat_o: out std_logic_vector(CCSDS_TX_MANAGER_DATA_BUS_SIZE-1 downto 0);
|
51 |
|
|
dat_val_o: out std_logic;
|
52 |
|
|
ena_o: out std_logic
|
53 |
|
|
);
|
54 |
|
|
end ccsds_tx_manager;
|
55 |
|
|
|
56 |
|
|
--=============================================================================
|
57 |
|
|
-- architecture declaration / internal connections
|
58 |
|
|
--=============================================================================
|
59 |
|
|
architecture structure of ccsds_tx_manager is
|
60 |
|
|
component ccsds_rxtx_serdes is
|
61 |
|
|
generic (
|
62 |
|
|
constant CCSDS_RXTX_SERDES_DEPTH : integer
|
63 |
|
|
);
|
64 |
|
|
port(
|
65 |
|
|
clk_i: in std_logic;
|
66 |
|
|
dat_par_i: in std_logic_vector(CCSDS_RXTX_SERDES_DEPTH-1 downto 0);
|
67 |
|
|
dat_par_val_i: in std_logic;
|
68 |
|
|
dat_ser_i: in std_logic;
|
69 |
|
|
dat_ser_val_i: in std_logic;
|
70 |
|
|
rst_i: in std_logic;
|
71 |
|
|
bus_o: out std_logic;
|
72 |
|
|
dat_par_o: out std_logic_vector(CCSDS_RXTX_SERDES_DEPTH-1 downto 0);
|
73 |
|
|
dat_par_val_o: out std_logic;
|
74 |
|
|
dat_ser_o: out std_logic;
|
75 |
|
|
dat_ser_val_o: out std_logic
|
76 |
|
|
);
|
77 |
|
|
end component;
|
78 |
|
|
component ccsds_rxtx_clock_divider is
|
79 |
|
|
generic(
|
80 |
|
|
CCSDS_RXTX_CLOCK_DIVIDER: integer
|
81 |
|
|
);
|
82 |
|
|
port(
|
83 |
|
|
clk_i: in std_logic;
|
84 |
|
|
rst_i: in std_logic;
|
85 |
|
|
clk_o: out std_logic
|
86 |
|
|
);
|
87 |
|
|
end component;
|
88 |
|
|
|
89 |
|
|
-- internal constants
|
90 |
|
|
-- for simulation only / cannot be used when synthesizing
|
91 |
|
|
constant CCSDS_TX_MANAGER_DEBUG: std_logic := '0';
|
92 |
|
|
--------------------------------
|
93 |
|
|
-- Clocks ratios computations --
|
94 |
|
|
--------------------------------
|
95 |
|
|
-- clk_dat
|
96 |
|
|
---- clk_bit = clk_dat / parallelism * data_link_overhead_ratio
|
97 |
|
|
------ clk_sym = clk_bit * data_bus_size / (2 * bits_per_symbol)
|
98 |
|
|
-------- clk_sam = clk_sym * oversampling_ratio
|
99 |
|
|
constant CCSDS_TX_MANAGER_SAMPLES_TO_SYMBOLS_RATIO: integer := CCSDS_TX_MANAGER_OVERSAMPLING_RATIO;
|
100 |
|
|
constant CCSDS_TX_MANAGER_SAMPLES_TO_BITS_RATIO: integer := CCSDS_TX_MANAGER_MODULATION_TYPE*CCSDS_TX_MANAGER_SAMPLES_TO_SYMBOLS_RATIO*CCSDS_TX_MANAGER_DATA_BUS_SIZE/(CCSDS_TX_MANAGER_BITS_PER_SYMBOL*2);
|
101 |
|
|
constant CCSDS_TX_MANAGER_SAMPLES_TO_DATA_RATIO: integer := CCSDS_TX_MANAGER_SAMPLES_TO_BITS_RATIO*CCSDS_TX_MANAGER_DATALINK_OVERHEAD_RATIO/CCSDS_TX_MANAGER_PARALLELISM_MAX_RATIO;
|
102 |
|
|
|
103 |
|
|
-- interconnection signals
|
104 |
|
|
signal wire_serdes_dat_par_o: std_logic_vector(CCSDS_TX_MANAGER_DATA_BUS_SIZE-1 downto 0);
|
105 |
|
|
signal wire_serdes_dat_par_val_o: std_logic;
|
106 |
|
|
signal wire_serdes_dat_ser_val_i: std_logic;
|
107 |
|
|
signal wire_clk_dat: std_logic;
|
108 |
|
|
signal wire_rst_clk: std_logic;
|
109 |
|
|
|
110 |
|
|
begin
|
111 |
|
|
-- presynthesis checks
|
112 |
|
|
CHKMANAGERP0: if (CCSDS_TX_MANAGER_DEBUG = '1') generate
|
113 |
|
|
process
|
114 |
|
|
begin
|
115 |
|
|
report "INFO: TX CLOCK FREQUENCY HAS TO BE " & integer'image(CCSDS_TX_MANAGER_SAMPLES_TO_DATA_RATIO) & " x WB DATA CLOCK" severity note;
|
116 |
|
|
wait;
|
117 |
|
|
end process;
|
118 |
|
|
end generate CHKMANAGERP0;
|
119 |
|
|
-- components instanciation and mapping
|
120 |
|
|
clock_divider_bits_001: ccsds_rxtx_clock_divider
|
121 |
|
|
generic map(
|
122 |
|
|
CCSDS_RXTX_CLOCK_DIVIDER => CCSDS_TX_MANAGER_SAMPLES_TO_BITS_RATIO
|
123 |
|
|
)
|
124 |
|
|
port map(
|
125 |
|
|
clk_i => clk_i,
|
126 |
|
|
rst_i => wire_rst_clk,
|
127 |
|
|
clk_o => clk_bit_o
|
128 |
|
|
);
|
129 |
|
|
clock_divider_dat_001: ccsds_rxtx_clock_divider
|
130 |
|
|
generic map(
|
131 |
|
|
CCSDS_RXTX_CLOCK_DIVIDER => CCSDS_TX_MANAGER_SAMPLES_TO_DATA_RATIO
|
132 |
|
|
)
|
133 |
|
|
port map(
|
134 |
|
|
clk_i => clk_i,
|
135 |
|
|
rst_i => wire_rst_clk,
|
136 |
|
|
clk_o => wire_clk_dat
|
137 |
|
|
);
|
138 |
|
|
clock_divider_sam_001: ccsds_rxtx_clock_divider
|
139 |
|
|
generic map(
|
140 |
|
|
CCSDS_RXTX_CLOCK_DIVIDER => 1
|
141 |
|
|
)
|
142 |
|
|
port map(
|
143 |
|
|
clk_i => clk_i,
|
144 |
|
|
rst_i => wire_rst_clk,
|
145 |
|
|
clk_o => clk_sam_o
|
146 |
|
|
);
|
147 |
|
|
clock_divider_sym_001: ccsds_rxtx_clock_divider
|
148 |
|
|
generic map(
|
149 |
|
|
CCSDS_RXTX_CLOCK_DIVIDER => CCSDS_TX_MANAGER_SAMPLES_TO_SYMBOLS_RATIO
|
150 |
|
|
)
|
151 |
|
|
port map(
|
152 |
|
|
clk_i => clk_i,
|
153 |
|
|
rst_i => wire_rst_clk,
|
154 |
|
|
clk_o => clk_sym_o
|
155 |
|
|
);
|
156 |
|
|
serdes_001: ccsds_rxtx_serdes
|
157 |
|
|
generic map(
|
158 |
|
|
CCSDS_RXTX_SERDES_DEPTH => CCSDS_TX_MANAGER_DATA_BUS_SIZE
|
159 |
|
|
)
|
160 |
|
|
port map(
|
161 |
|
|
clk_i => wire_clk_dat,
|
162 |
|
|
dat_par_i => (others => '0'),
|
163 |
|
|
dat_par_val_i => '0',
|
164 |
|
|
dat_ser_i => dat_ser_i,
|
165 |
|
|
dat_ser_val_i => wire_serdes_dat_ser_val_i,
|
166 |
|
|
rst_i => rst_i,
|
167 |
|
|
dat_par_o => wire_serdes_dat_par_o,
|
168 |
|
|
dat_par_val_o => wire_serdes_dat_par_val_o
|
169 |
|
|
);
|
170 |
|
|
|
171 |
|
|
ena_o <= ena_i;
|
172 |
|
|
wire_rst_clk <= not(ena_i);
|
173 |
|
|
clk_dat_o <= wire_clk_dat;
|
174 |
|
|
--=============================================================================
|
175 |
|
|
-- Begin of selectp
|
176 |
|
|
-- Input selection
|
177 |
|
|
--=============================================================================
|
178 |
|
|
-- read: rst_i, ena_i, in_sel_i, dat_val_i
|
179 |
|
|
-- write: dat_o, dat_val_o, wire_serdes_dat_ser_val_i
|
180 |
|
|
-- r/w:
|
181 |
|
|
SELECTP : process (wire_clk_dat, ena_i)
|
182 |
|
|
-- variables instantiation
|
183 |
|
|
begin
|
184 |
|
|
-- on each clock rising edge
|
185 |
|
|
if rising_edge(wire_clk_dat) and (ena_i = '1') then
|
186 |
|
|
if (rst_i = '1') then
|
187 |
|
|
dat_o <= (others => '0');
|
188 |
|
|
dat_val_o <= '0';
|
189 |
|
|
wire_serdes_dat_ser_val_i <= '0';
|
190 |
|
|
else
|
191 |
|
|
if (in_sel_i = '1') then
|
192 |
|
|
wire_serdes_dat_ser_val_i <= '1';
|
193 |
|
|
dat_o <= wire_serdes_dat_par_o;
|
194 |
|
|
dat_val_o <= wire_serdes_dat_par_val_o;
|
195 |
|
|
else
|
196 |
|
|
wire_serdes_dat_ser_val_i <= '0';
|
197 |
|
|
dat_val_o <= dat_val_i;
|
198 |
|
|
dat_o <= dat_par_i;
|
199 |
|
|
end if;
|
200 |
|
|
end if;
|
201 |
|
|
end if;
|
202 |
|
|
end process;
|
203 |
|
|
end structure;
|