| 1 |
2 |
zguig52 |
-------------------------------
|
| 2 |
|
|
---- Project: EurySPACE CCSDS RX/TX with wishbone interface
|
| 3 |
|
|
---- Design Name: ccsds_rxtx_top
|
| 4 |
|
|
---- Version: 1.0.0
|
| 5 |
|
|
---- Description: CCSDS compliant RX/TX for space communications
|
| 6 |
|
|
---- TX Modulations: BPSK, QPSK, Offset-QPSK, QAM, Offset-QAM
|
| 7 |
|
|
---- RX Performances: QAM: min Eb/N0 = XdB, max frequency shift = X Hz (Doppler + speed), max frequency shift rate = X Hz / secs (Doppler + acceleration), synchronisation, agc / dynamic range, filters capabilities, multipaths, ...
|
| 8 |
|
|
---- This is the entry point / top level entity
|
| 9 |
|
|
---- WB slave interface, RX/TX external inputs/outputs
|
| 10 |
|
|
---- Synchronized with rising edge of clocks
|
| 11 |
|
|
-------------------------------
|
| 12 |
|
|
---- Author(s):
|
| 13 |
|
|
---- Guillaume REMBERT
|
| 14 |
|
|
-------------------------------
|
| 15 |
|
|
---- Licence:
|
| 16 |
|
|
---- MIT
|
| 17 |
|
|
-------------------------------
|
| 18 |
|
|
---- Changes list:
|
| 19 |
|
|
---- 2016/02/26: initial release - only basic RX-TX capabilities through direct R/W on WB Bus / no dynamic configuration capabilities
|
| 20 |
|
|
---- 2016/10/18: major rework / implementation of new architecture
|
| 21 |
|
|
-------------------------------
|
| 22 |
|
|
-- TODO: additionnal modulations: ASK, FSK, GMSK, OFDM, CDMA
|
| 23 |
|
|
-- TODO: dynamic modulation and coding
|
| 24 |
|
|
|
| 25 |
|
|
-- libraries used
|
| 26 |
|
|
library ieee;
|
| 27 |
|
|
use ieee.std_logic_1164.all;
|
| 28 |
|
|
library work;
|
| 29 |
|
|
use work.ccsds_rxtx_parameters.all;
|
| 30 |
|
|
use work.ccsds_rxtx_functions.all;
|
| 31 |
|
|
--use work.ccsds_rxtx_constants.all;
|
| 32 |
|
|
|
| 33 |
|
|
--=============================================================================
|
| 34 |
|
|
-- Entity declaration for ccsds_rxtx_top / overall rx-tx external physical inputs and outputs
|
| 35 |
|
|
--=============================================================================
|
| 36 |
|
|
entity ccsds_rxtx_top is
|
| 37 |
|
|
generic (
|
| 38 |
|
|
CCSDS_RXTX_RX_AUTO_ENABLED: boolean := RX_SYSTEM_AUTO_ENABLED;
|
| 39 |
|
|
CCSDS_RXTX_RX_PHYS_SIG_QUANT_DEPTH: integer := RX_PHYS_SIG_QUANT_DEPTH;
|
| 40 |
|
|
CCSDS_RXTX_TX_AUTO_ENABLED: boolean := TX_SYSTEM_AUTO_ENABLED;
|
| 41 |
|
|
CCSDS_RXTX_TX_AUTO_EXTERNAL: boolean := TX_SYSTEM_AUTO_EXTERNAL;
|
| 42 |
|
|
CCSDS_RXTX_TX_PHYS_SIG_QUANT_DEPTH: integer := TX_PHYS_SIG_QUANT_DEPTH;
|
| 43 |
|
|
CCSDS_RXTX_WB_ADDR_BUS_SIZE: integer := RXTX_SYSTEM_WB_ADDR_BUS_SIZE;
|
| 44 |
|
|
CCSDS_RXTX_WB_DATA_BUS_SIZE: integer := RXTX_SYSTEM_WB_DATA_BUS_SIZE
|
| 45 |
|
|
);
|
| 46 |
|
|
port(
|
| 47 |
|
|
-- system wide inputs
|
| 48 |
|
|
--rst_i: in std_logic; -- implement external system reset port?
|
| 49 |
|
|
-- system wide outputs
|
| 50 |
|
|
-- wishbone slave bus connections / to the master CPU
|
| 51 |
|
|
-- wb inputs
|
| 52 |
|
|
wb_adr_i: in std_logic_vector(CCSDS_RXTX_WB_ADDR_BUS_SIZE-1 downto 0); -- address input array
|
| 53 |
|
|
wb_clk_i: in std_logic; -- clock input / wb operations are always on rising edge of clk
|
| 54 |
|
|
wb_cyc_i: in std_logic; -- cycle input / valid bus cycle in progress
|
| 55 |
|
|
wb_dat_i: in std_logic_vector(CCSDS_RXTX_WB_DATA_BUS_SIZE-1 downto 0); -- data input array
|
| 56 |
|
|
--wb_lock_i: out std_logic; -- lock input / current bus cycle is uninterruptible
|
| 57 |
|
|
wb_rst_i: in std_logic; -- reset input
|
| 58 |
|
|
--wb_sel_i: in std_logic_vector(3 downto 0); -- select input array / related to wb_dat_i + wb_dat_o / indicates where valid data is placed on the array / provide data granularity
|
| 59 |
|
|
wb_stb_i: in std_logic; -- strobe input / slave is selected
|
| 60 |
|
|
--wb_tga_i: in std_logic; -- address tag type / related to wb_adr_i / qualified by wb_stb_i / TBD
|
| 61 |
|
|
--wb_tgc_i: in std_logic; -- cycle tag type / qualified by wb_cyc_i / TBD
|
| 62 |
|
|
--wb_tgd_i: in std_logic; -- data tag type / related to wb_dat_i / ex: parity protection, ecc, timestamps
|
| 63 |
|
|
wb_we_i: in std_logic; -- write enable input / indicates if cycle is of write or read type
|
| 64 |
|
|
-- wb outputs
|
| 65 |
|
|
wb_ack_o: out std_logic; -- acknowledge output / normal bus cycle termination
|
| 66 |
|
|
wb_dat_o: out std_logic_vector(CCSDS_RXTX_WB_DATA_BUS_SIZE-1 downto 0); -- data output array
|
| 67 |
|
|
wb_err_o: out std_logic; -- error output / abnormal bus cycle termination
|
| 68 |
|
|
wb_rty_o: out std_logic; -- retry output / not ready - retry bus cycle
|
| 69 |
|
|
--wb_tgd_o: out std_logic; -- data tag type / related to wb_dat_o / ex: parity protection, ecc, timestamps
|
| 70 |
|
|
-- RX connections
|
| 71 |
|
|
-- rx inputs
|
| 72 |
|
|
rx_clk_i: in std_logic; -- received samples clock
|
| 73 |
|
|
rx_sam_i_i: in std_logic_vector(CCSDS_RXTX_RX_PHYS_SIG_QUANT_DEPTH-1 downto 0); -- i samples
|
| 74 |
|
|
rx_sam_q_i: in std_logic_vector(CCSDS_RXTX_RX_PHYS_SIG_QUANT_DEPTH-1 downto 0); -- q samples
|
| 75 |
|
|
-- rx outputs
|
| 76 |
|
|
rx_ena_o: out std_logic; -- rx enabled status indicator
|
| 77 |
|
|
rx_irq_o: out std_logic; -- interrupt request output / data received indicator
|
| 78 |
|
|
-- TX connections
|
| 79 |
|
|
-- tx inputs
|
| 80 |
|
|
tx_clk_i: in std_logic; -- output samples clock
|
| 81 |
|
|
tx_dat_ser_i: in std_logic; -- direct data serial input
|
| 82 |
|
|
-- tx outputs
|
| 83 |
|
|
tx_buf_ful_o: out std_logic; -- buffer full / data overflow indicator
|
| 84 |
|
|
tx_clk_o: out std_logic; -- emitted samples clock
|
| 85 |
|
|
tx_ena_o: out std_logic; -- tx enabled status indicator
|
| 86 |
|
|
tx_idl_o: out std_logic; -- idle status / data-padding indicator
|
| 87 |
|
|
tx_sam_i_o: out std_logic_vector(CCSDS_RXTX_TX_PHYS_SIG_QUANT_DEPTH-1 downto 0); -- i samples
|
| 88 |
|
|
tx_sam_q_o: out std_logic_vector(CCSDS_RXTX_TX_PHYS_SIG_QUANT_DEPTH-1 downto 0) -- q samples
|
| 89 |
|
|
);
|
| 90 |
|
|
end ccsds_rxtx_top;
|
| 91 |
|
|
|
| 92 |
|
|
--=============================================================================
|
| 93 |
|
|
-- architecture declaration / internal connections
|
| 94 |
|
|
--=============================================================================
|
| 95 |
|
|
architecture structure of ccsds_rxtx_top is
|
| 96 |
|
|
-- components declaration
|
| 97 |
|
|
component ccsds_rx is
|
| 98 |
|
|
generic (
|
| 99 |
|
|
CCSDS_RX_PHYS_SIG_QUANT_DEPTH : integer;
|
| 100 |
|
|
CCSDS_RX_DATA_BUS_SIZE: integer
|
| 101 |
|
|
);
|
| 102 |
|
|
port(
|
| 103 |
|
|
rst_i: in std_logic; -- system reset
|
| 104 |
|
|
ena_i: in std_logic; -- system enable
|
| 105 |
|
|
clk_i: in std_logic; -- input samples clock
|
| 106 |
|
|
sam_i_i: in std_logic_vector(CCSDS_RX_PHYS_SIG_QUANT_DEPTH-1 downto 0); -- in-phased parallel complex samples
|
| 107 |
|
|
sam_q_i: in std_logic_vector(CCSDS_RX_PHYS_SIG_QUANT_DEPTH-1 downto 0); -- quadrature-phased parallel complex samples
|
| 108 |
|
|
dat_nxt_i: in std_logic; -- next data
|
| 109 |
|
|
irq_o: out std_logic; -- data ready to be read / IRQ signal
|
| 110 |
|
|
dat_o: out std_logic_vector(CCSDS_RX_DATA_BUS_SIZE-1 downto 0); -- received data parallel output
|
| 111 |
|
|
dat_val_o: out std_logic; -- data valid
|
| 112 |
|
|
buf_dat_ful_o: out std_logic; -- data buffer status indicator
|
| 113 |
|
|
buf_fra_ful_o: out std_logic; -- frames buffer status indicator
|
| 114 |
|
|
buf_bit_ful_o: out std_logic; -- bits buffer status indicator
|
| 115 |
|
|
ena_o: out std_logic -- enabled status indicator
|
| 116 |
|
|
);
|
| 117 |
|
|
end component;
|
| 118 |
|
|
component ccsds_tx is
|
| 119 |
|
|
generic (
|
| 120 |
|
|
CCSDS_TX_PHYS_SIG_QUANT_DEPTH : integer;
|
| 121 |
|
|
CCSDS_TX_DATA_BUS_SIZE: integer
|
| 122 |
|
|
);
|
| 123 |
|
|
port(
|
| 124 |
|
|
rst_i: in std_logic;
|
| 125 |
|
|
ena_i: in std_logic;
|
| 126 |
|
|
clk_i: in std_logic;
|
| 127 |
|
|
in_sel_i: in std_logic;
|
| 128 |
|
|
dat_val_i: in std_logic;
|
| 129 |
|
|
dat_par_i: in std_logic_vector(CCSDS_TX_DATA_BUS_SIZE-1 downto 0);
|
| 130 |
|
|
dat_ser_i: in std_logic;
|
| 131 |
|
|
buf_ful_o: out std_logic;
|
| 132 |
|
|
clk_o: out std_logic;
|
| 133 |
|
|
idl_o: out std_logic;
|
| 134 |
|
|
sam_i_o: out std_logic_vector(CCSDS_TX_PHYS_SIG_QUANT_DEPTH-1 downto 0);
|
| 135 |
|
|
sam_q_o: out std_logic_vector(CCSDS_TX_PHYS_SIG_QUANT_DEPTH-1 downto 0);
|
| 136 |
|
|
ena_o: out std_logic
|
| 137 |
|
|
);
|
| 138 |
|
|
end component;
|
| 139 |
|
|
signal wire_rst: std_logic;
|
| 140 |
|
|
signal wire_rx_ena: std_logic := convert_boolean_to_std_logic(CCSDS_RXTX_RX_AUTO_ENABLED);
|
| 141 |
|
|
signal wire_rx_data_valid: std_logic;
|
| 142 |
|
|
signal wire_rx_data_next: std_logic := '0';
|
| 143 |
|
|
signal wire_rx_buffer_data_full: std_logic;
|
| 144 |
|
|
signal wire_rx_buffer_frames_full: std_logic;
|
| 145 |
|
|
signal wire_rx_buffer_bits_full: std_logic;
|
| 146 |
|
|
signal wire_tx_clk: std_logic;
|
| 147 |
|
|
signal wire_tx_ena: std_logic := convert_boolean_to_std_logic(CCSDS_RXTX_TX_AUTO_ENABLED);
|
| 148 |
|
|
signal wire_tx_ext: std_logic := convert_boolean_to_std_logic(CCSDS_RXTX_TX_AUTO_EXTERNAL);
|
| 149 |
|
|
signal wire_tx_data_valid: std_logic := '0';
|
| 150 |
|
|
signal wire_tx_buf_ful: std_logic;
|
| 151 |
|
|
signal wire_rx_data: std_logic_vector(CCSDS_RXTX_WB_DATA_BUS_SIZE-1 downto 0);
|
| 152 |
|
|
signal wire_tx_data: std_logic_vector(CCSDS_RXTX_WB_DATA_BUS_SIZE-1 downto 0) := (others => '0');
|
| 153 |
|
|
|
| 154 |
|
|
--=============================================================================
|
| 155 |
|
|
-- architecture begin
|
| 156 |
|
|
--=============================================================================
|
| 157 |
|
|
begin
|
| 158 |
|
|
-- components entities instantiation
|
| 159 |
|
|
rx_001: ccsds_rx
|
| 160 |
|
|
generic map(
|
| 161 |
|
|
CCSDS_RX_PHYS_SIG_QUANT_DEPTH => CCSDS_RXTX_RX_PHYS_SIG_QUANT_DEPTH,
|
| 162 |
|
|
CCSDS_RX_DATA_BUS_SIZE => CCSDS_RXTX_WB_DATA_BUS_SIZE
|
| 163 |
|
|
)
|
| 164 |
|
|
port map(
|
| 165 |
|
|
rst_i => wb_rst_i,
|
| 166 |
|
|
ena_i => wire_rx_ena,
|
| 167 |
|
|
clk_i => rx_clk_i,
|
| 168 |
|
|
sam_i_i => rx_sam_i_i,
|
| 169 |
|
|
sam_q_i => rx_sam_q_i,
|
| 170 |
|
|
dat_nxt_i => wire_rx_data_next,
|
| 171 |
|
|
irq_o => rx_irq_o,
|
| 172 |
|
|
dat_o => wire_rx_data,
|
| 173 |
|
|
dat_val_o => wire_rx_data_valid,
|
| 174 |
|
|
buf_dat_ful_o => wire_rx_buffer_data_full,
|
| 175 |
|
|
buf_fra_ful_o => wire_rx_buffer_frames_full,
|
| 176 |
|
|
buf_bit_ful_o => wire_rx_buffer_bits_full,
|
| 177 |
|
|
ena_o => rx_ena_o
|
| 178 |
|
|
);
|
| 179 |
|
|
tx_001: ccsds_tx
|
| 180 |
|
|
generic map(
|
| 181 |
|
|
CCSDS_TX_PHYS_SIG_QUANT_DEPTH => CCSDS_RXTX_TX_PHYS_SIG_QUANT_DEPTH,
|
| 182 |
|
|
CCSDS_TX_DATA_BUS_SIZE => CCSDS_RXTX_WB_DATA_BUS_SIZE
|
| 183 |
|
|
)
|
| 184 |
|
|
port map(
|
| 185 |
|
|
clk_i => tx_clk_i,
|
| 186 |
|
|
rst_i => wb_rst_i,
|
| 187 |
|
|
ena_i => wire_tx_ena,
|
| 188 |
|
|
in_sel_i => wire_tx_ext,
|
| 189 |
|
|
dat_val_i => wire_tx_data_valid,
|
| 190 |
|
|
dat_par_i => wire_tx_data,
|
| 191 |
|
|
dat_ser_i => tx_dat_ser_i,
|
| 192 |
|
|
buf_ful_o => wire_tx_buf_ful,
|
| 193 |
|
|
clk_o => tx_clk_o,
|
| 194 |
|
|
idl_o => tx_idl_o,
|
| 195 |
|
|
sam_i_o => tx_sam_i_o,
|
| 196 |
|
|
sam_q_o => tx_sam_q_o,
|
| 197 |
|
|
ena_o => tx_ena_o
|
| 198 |
|
|
);
|
| 199 |
|
|
tx_buf_ful_o <= wire_tx_buf_ful;
|
| 200 |
|
|
--=============================================================================
|
| 201 |
|
|
-- Begin of wbstartp
|
| 202 |
|
|
-- In charge of wishbone bus interactions + rx/tx management through it
|
| 203 |
|
|
--=============================================================================
|
| 204 |
|
|
-- read: wb_clk_i, wb_rst_i, wb_cyc_i, wb_stb_i, wb_dat_i
|
| 205 |
|
|
-- write: wb_ack_o, wb_err_o, wb_rty_o, (rx_/tx_XXX:rst_i), wb_dat_o, wire_rst, wire_irq, wire_rx_ena, wire_tx_ena
|
| 206 |
|
|
-- r/w: wire_tx_ext
|
| 207 |
|
|
WBSTARTP : process (wb_clk_i)
|
| 208 |
|
|
variable ack_state: std_logic := '0';
|
| 209 |
|
|
-- variables instantiation
|
| 210 |
|
|
begin
|
| 211 |
|
|
-- on each wb clock rising edge
|
| 212 |
|
|
if rising_edge(wb_clk_i) then
|
| 213 |
|
|
-- wb reset signal received
|
| 214 |
|
|
if (wb_rst_i = '1') then
|
| 215 |
|
|
-- reinitialize all dyn elements to default value
|
| 216 |
|
|
ack_state := '0';
|
| 217 |
|
|
wire_rx_ena <= convert_boolean_to_std_logic(CCSDS_RXTX_RX_AUTO_ENABLED);
|
| 218 |
|
|
wire_tx_ena <= convert_boolean_to_std_logic(CCSDS_RXTX_TX_AUTO_ENABLED);
|
| 219 |
|
|
-- reinitialize all outputs
|
| 220 |
|
|
wire_tx_ext <= convert_boolean_to_std_logic(CCSDS_RXTX_TX_AUTO_EXTERNAL);
|
| 221 |
|
|
if (CCSDS_RXTX_TX_AUTO_EXTERNAL = false) then
|
| 222 |
|
|
wire_tx_data_valid <= '0';
|
| 223 |
|
|
else
|
| 224 |
|
|
wire_tx_data_valid <= '1';
|
| 225 |
|
|
end if;
|
| 226 |
|
|
wb_dat_o <= (others => '0');
|
| 227 |
|
|
wb_ack_o <= '0';
|
| 228 |
|
|
wb_err_o <= '0';
|
| 229 |
|
|
wb_rty_o <= '0';
|
| 230 |
|
|
else
|
| 231 |
|
|
if (wb_cyc_i = '1') and (wb_stb_i = '1') then
|
| 232 |
|
|
-- single classic standard read cycle
|
| 233 |
|
|
if (wb_we_i = '0') then
|
| 234 |
|
|
if (wb_adr_i = "0000") then
|
| 235 |
|
|
-- classic rx cycle - forward data from rx to master
|
| 236 |
|
|
if (ack_state = '0') then
|
| 237 |
|
|
wb_dat_o <= wire_rx_data;
|
| 238 |
|
|
wb_ack_o <= '0';
|
| 239 |
|
|
ack_state := '1';
|
| 240 |
|
|
else
|
| 241 |
|
|
wb_dat_o <= (others => '0');
|
| 242 |
|
|
wb_ack_o <= '1';
|
| 243 |
|
|
ack_state := '0';
|
| 244 |
|
|
end if;
|
| 245 |
|
|
else
|
| 246 |
|
|
wb_err_o <= '1';
|
| 247 |
|
|
wb_rty_o <= '1';
|
| 248 |
|
|
end if;
|
| 249 |
|
|
-- single write cycle
|
| 250 |
|
|
else
|
| 251 |
|
|
wb_dat_o <= (others => '0');
|
| 252 |
|
|
-- classic tx cycle - store and forward data from master to tx
|
| 253 |
|
|
if (wb_adr_i = "0000") then
|
| 254 |
|
|
-- check internal configuration
|
| 255 |
|
|
if (wire_tx_ext = '0') then
|
| 256 |
|
|
if (wire_tx_buf_ful = '0') and (ack_state = '0') then
|
| 257 |
|
|
wb_ack_o <= '1';
|
| 258 |
|
|
ack_state := '1';
|
| 259 |
|
|
wire_tx_data <= wb_dat_i;
|
| 260 |
|
|
wire_tx_data_valid <= '1';
|
| 261 |
|
|
else
|
| 262 |
|
|
if (ack_state = '1') then
|
| 263 |
|
|
wire_tx_data_valid <= '0';
|
| 264 |
|
|
wb_ack_o <= '0';
|
| 265 |
|
|
ack_state := '0';
|
| 266 |
|
|
else
|
| 267 |
|
|
wb_ack_o <= '0';
|
| 268 |
|
|
wb_err_o <= '1';
|
| 269 |
|
|
wb_rty_o <= '1';
|
| 270 |
|
|
end if;
|
| 271 |
|
|
end if;
|
| 272 |
|
|
else
|
| 273 |
|
|
wb_ack_o <= '0';
|
| 274 |
|
|
wb_err_o <= '1';
|
| 275 |
|
|
wb_rty_o <= '1';
|
| 276 |
|
|
end if;
|
| 277 |
|
|
-- RX configuration cycle - set general rx parameters
|
| 278 |
|
|
elsif (wb_adr_i = "0001") then
|
| 279 |
|
|
if (ack_state = '0') then
|
| 280 |
|
|
wire_rx_ena <= wb_dat_i(0);
|
| 281 |
|
|
wb_ack_o <= '1';
|
| 282 |
|
|
ack_state := '1';
|
| 283 |
|
|
else
|
| 284 |
|
|
wb_ack_o <= '0';
|
| 285 |
|
|
ack_state := '0';
|
| 286 |
|
|
end if;
|
| 287 |
|
|
-- TX configuration cycle - set general tx parameters
|
| 288 |
|
|
elsif (wb_adr_i = "0010") then
|
| 289 |
|
|
if (ack_state = '0') then
|
| 290 |
|
|
wire_tx_ena <= wb_dat_i(0);
|
| 291 |
|
|
wire_tx_ext <= wb_dat_i(1);
|
| 292 |
|
|
wb_ack_o <= '1';
|
| 293 |
|
|
ack_state := '1';
|
| 294 |
|
|
else
|
| 295 |
|
|
wb_ack_o <= '0';
|
| 296 |
|
|
ack_state := '0';
|
| 297 |
|
|
end if;
|
| 298 |
|
|
else
|
| 299 |
|
|
wb_ack_o <= '0';
|
| 300 |
|
|
wb_err_o <= '1';
|
| 301 |
|
|
wb_rty_o <= '1';
|
| 302 |
|
|
end if;
|
| 303 |
|
|
end if;
|
| 304 |
|
|
else
|
| 305 |
|
|
wb_dat_o <= (others => '0');
|
| 306 |
|
|
wb_ack_o <= '0';
|
| 307 |
|
|
wb_err_o <= '0';
|
| 308 |
|
|
wb_rty_o <= '0';
|
| 309 |
|
|
ack_state := '0';
|
| 310 |
|
|
if (wire_tx_ext = '0') then
|
| 311 |
|
|
wire_tx_data_valid <= '0';
|
| 312 |
|
|
else
|
| 313 |
|
|
wire_tx_data_valid <= '1';
|
| 314 |
|
|
end if;
|
| 315 |
|
|
end if;
|
| 316 |
|
|
end if;
|
| 317 |
|
|
end if;
|
| 318 |
|
|
end process;
|
| 319 |
|
|
end structure;
|
| 320 |
|
|
--=============================================================================
|
| 321 |
|
|
-- architecture end
|
| 322 |
|
|
--=============================================================================
|