1 |
2 |
zguig52 |
-------------------------------
|
2 |
|
|
---- Project: EurySPACE CCSDS RX/TX with wishbone interface
|
3 |
|
|
---- Design Name: ccsds_tx_coder
|
4 |
|
|
---- Version: 1.0.0
|
5 |
|
|
---- Description:
|
6 |
|
|
---- Implementation of standard CCSDS 131.0-B-2
|
7 |
|
|
-------------------------------
|
8 |
|
|
---- Author(s):
|
9 |
|
|
---- Guillaume REMBERT
|
10 |
|
|
-------------------------------
|
11 |
|
|
---- Licence:
|
12 |
|
|
---- MIT
|
13 |
|
|
-------------------------------
|
14 |
|
|
---- Changes list:
|
15 |
|
|
---- 2016/11/05: initial release
|
16 |
|
|
-------------------------------
|
17 |
|
|
|
18 |
|
|
-- libraries used
|
19 |
|
|
library ieee;
|
20 |
|
|
use ieee.std_logic_1164.all;
|
21 |
|
|
|
22 |
|
|
--=============================================================================
|
23 |
|
|
-- Entity declaration for ccsds_tx / unitary tx coder inputs and outputs
|
24 |
|
|
--=============================================================================
|
25 |
|
|
entity ccsds_tx_coder is
|
26 |
|
|
generic(
|
27 |
|
|
constant CCSDS_TX_CODER_ASM_LENGTH: integer; -- Attached Synchronization Marker length / in Bytes
|
28 |
|
|
constant CCSDS_TX_CODER_DATA_BUS_SIZE: integer; -- in bits
|
29 |
|
|
constant CCSDS_TX_CODER_DIFFERENTIAL_BITS_PER_CODEWORD: integer; -- Number of bits per codeword (should be equal to bits per symbol of lower link)
|
30 |
|
|
constant CCSDS_TX_CODER_DIFFERENTIAL_ENABLED: boolean -- Enable differential coder
|
31 |
|
|
);
|
32 |
|
|
port(
|
33 |
|
|
-- inputs
|
34 |
|
|
clk_i: in std_logic;
|
35 |
|
|
dat_i: in std_logic_vector(CCSDS_TX_CODER_DATA_BUS_SIZE-1 downto 0);
|
36 |
|
|
dat_val_i: in std_logic;
|
37 |
|
|
rst_i: in std_logic;
|
38 |
|
|
-- outputs
|
39 |
|
|
dat_o: out std_logic_vector(CCSDS_TX_CODER_DATA_BUS_SIZE+CCSDS_TX_CODER_ASM_LENGTH*8-1 downto 0);
|
40 |
|
|
dat_val_o: out std_logic
|
41 |
|
|
);
|
42 |
|
|
end ccsds_tx_coder;
|
43 |
|
|
|
44 |
|
|
--=============================================================================
|
45 |
|
|
-- architecture declaration / internal components and connections
|
46 |
|
|
--=============================================================================
|
47 |
|
|
architecture structure of ccsds_tx_coder is
|
48 |
|
|
component ccsds_tx_coder_differential is
|
49 |
|
|
generic(
|
50 |
|
|
CCSDS_TX_CODER_DIFF_BITS_PER_CODEWORD: integer;
|
51 |
|
|
CCSDS_TX_CODER_DIFF_DATA_BUS_SIZE: integer
|
52 |
|
|
);
|
53 |
|
|
port(
|
54 |
|
|
clk_i: in std_logic;
|
55 |
|
|
dat_i: in std_logic_vector(CCSDS_TX_CODER_DIFF_DATA_BUS_SIZE-1 downto 0);
|
56 |
|
|
dat_val_i: in std_logic;
|
57 |
|
|
rst_i: in std_logic;
|
58 |
|
|
dat_o: out std_logic_vector(CCSDS_TX_CODER_DIFF_DATA_BUS_SIZE-1 downto 0);
|
59 |
|
|
dat_val_o: out std_logic
|
60 |
|
|
);
|
61 |
|
|
end component;
|
62 |
|
|
component ccsds_tx_randomizer is
|
63 |
|
|
generic(
|
64 |
|
|
CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE: integer
|
65 |
|
|
);
|
66 |
|
|
port(
|
67 |
|
|
clk_i: in std_logic;
|
68 |
|
|
dat_i: in std_logic_vector(CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE-1 downto 0);
|
69 |
|
|
dat_val_i: in std_logic;
|
70 |
|
|
rst_i: in std_logic;
|
71 |
|
|
dat_o: out std_logic_vector(CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE-1 downto 0);
|
72 |
|
|
dat_val_o: out std_logic
|
73 |
|
|
);
|
74 |
|
|
end component;
|
75 |
|
|
component ccsds_tx_synchronizer is
|
76 |
|
|
generic(
|
77 |
|
|
CCSDS_TX_ASM_LENGTH: integer;
|
78 |
|
|
CCSDS_TX_ASM_DATA_BUS_SIZE: integer
|
79 |
|
|
);
|
80 |
|
|
port(
|
81 |
|
|
clk_i: in std_logic;
|
82 |
|
|
dat_i: in std_logic_vector(CCSDS_TX_ASM_DATA_BUS_SIZE-1 downto 0);
|
83 |
|
|
dat_val_i: in std_logic;
|
84 |
|
|
rst_i: in std_logic;
|
85 |
|
|
dat_o: out std_logic_vector(CCSDS_TX_ASM_DATA_BUS_SIZE+CCSDS_TX_ASM_LENGTH*8-1 downto 0);
|
86 |
|
|
dat_val_o: out std_logic
|
87 |
|
|
);
|
88 |
|
|
end component;
|
89 |
|
|
-- internal constants
|
90 |
|
|
-- internal variable signals
|
91 |
|
|
signal wire_coder_diff_dat_o: std_logic_vector(CCSDS_TX_CODER_DATA_BUS_SIZE+CCSDS_TX_CODER_ASM_LENGTH*8-1 downto 0);
|
92 |
|
|
signal wire_coder_diff_dat_val_o: std_logic;
|
93 |
|
|
signal wire_randomizer_dat_o: std_logic_vector(CCSDS_TX_CODER_DATA_BUS_SIZE-1 downto 0);
|
94 |
|
|
signal wire_randomizer_dat_val_o: std_logic;
|
95 |
|
|
signal wire_synchronizer_dat_o: std_logic_vector(CCSDS_TX_CODER_DATA_BUS_SIZE+CCSDS_TX_CODER_ASM_LENGTH*8-1 downto 0);
|
96 |
|
|
signal wire_synchronizer_dat_val_o: std_logic;
|
97 |
|
|
-- components instanciation and mapping
|
98 |
|
|
begin
|
99 |
|
|
tx_coder_randomizer_0: ccsds_tx_randomizer
|
100 |
|
|
generic map(
|
101 |
|
|
CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE => CCSDS_TX_CODER_DATA_BUS_SIZE
|
102 |
|
|
)
|
103 |
|
|
port map(
|
104 |
|
|
clk_i => clk_i,
|
105 |
|
|
rst_i => rst_i,
|
106 |
|
|
dat_val_i => dat_val_i,
|
107 |
|
|
dat_i => dat_i,
|
108 |
|
|
dat_val_o => wire_randomizer_dat_val_o,
|
109 |
|
|
dat_o => wire_randomizer_dat_o
|
110 |
|
|
);
|
111 |
|
|
NODIFFCODERGENP: if (CCSDS_TX_CODER_DIFFERENTIAL_ENABLED = false) generate
|
112 |
|
|
tx_coder_synchronizer_0: ccsds_tx_synchronizer
|
113 |
|
|
generic map(
|
114 |
|
|
CCSDS_TX_ASM_LENGTH => CCSDS_TX_CODER_ASM_LENGTH,
|
115 |
|
|
CCSDS_TX_ASM_DATA_BUS_SIZE => CCSDS_TX_CODER_DATA_BUS_SIZE
|
116 |
|
|
)
|
117 |
|
|
port map(
|
118 |
|
|
clk_i => clk_i,
|
119 |
|
|
rst_i => rst_i,
|
120 |
|
|
dat_val_i => wire_randomizer_dat_val_o,
|
121 |
|
|
dat_i => wire_randomizer_dat_o,
|
122 |
|
|
dat_val_o => dat_val_o,
|
123 |
|
|
dat_o => dat_o
|
124 |
|
|
);
|
125 |
|
|
end generate NODIFFCODERGENP;
|
126 |
|
|
DIFFCODERGENP: if (CCSDS_TX_CODER_DIFFERENTIAL_ENABLED = true) generate
|
127 |
|
|
tx_coder_synchronizer_0: ccsds_tx_synchronizer
|
128 |
|
|
generic map(
|
129 |
|
|
CCSDS_TX_ASM_LENGTH => CCSDS_TX_CODER_ASM_LENGTH,
|
130 |
|
|
CCSDS_TX_ASM_DATA_BUS_SIZE => CCSDS_TX_CODER_DATA_BUS_SIZE
|
131 |
|
|
)
|
132 |
|
|
port map(
|
133 |
|
|
clk_i => clk_i,
|
134 |
|
|
rst_i => rst_i,
|
135 |
|
|
dat_val_i => wire_randomizer_dat_val_o,
|
136 |
|
|
dat_i => wire_randomizer_dat_o,
|
137 |
|
|
dat_val_o => wire_synchronizer_dat_val_o,
|
138 |
|
|
dat_o => wire_synchronizer_dat_o
|
139 |
|
|
);
|
140 |
|
|
tx_coder_differential_0: ccsds_tx_coder_differential
|
141 |
|
|
generic map(
|
142 |
|
|
CCSDS_TX_CODER_DIFF_BITS_PER_CODEWORD => CCSDS_TX_CODER_DIFFERENTIAL_BITS_PER_CODEWORD,
|
143 |
|
|
CCSDS_TX_CODER_DIFF_DATA_BUS_SIZE => CCSDS_TX_CODER_DATA_BUS_SIZE+CCSDS_TX_CODER_ASM_LENGTH*8
|
144 |
|
|
)
|
145 |
|
|
port map(
|
146 |
|
|
clk_i => clk_i,
|
147 |
|
|
rst_i => rst_i,
|
148 |
|
|
dat_val_i => wire_synchronizer_dat_val_o,
|
149 |
|
|
dat_i => wire_synchronizer_dat_o,
|
150 |
|
|
dat_val_o => dat_val_o,
|
151 |
|
|
dat_o => dat_o
|
152 |
|
|
);
|
153 |
|
|
end generate DIFFCODERGENP;
|
154 |
|
|
-- presynthesis checks
|
155 |
|
|
-- internal processing
|
156 |
|
|
end structure;
|