OpenCores
URL https://opencores.org/ocsvn/ccsds_rxtxsoc/ccsds_rxtxsoc/trunk

Subversion Repositories ccsds_rxtxsoc

[/] [ccsds_rxtxsoc/] [trunk/] [ccsds_rxtx_serdes.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 zguig52
-------------------------------
2
---- Project: EurySPACE CCSDS RX/TX with wishbone interface
3
---- Design Name: ccsds_rxtx_serdes
4
---- Version: 1.0.0
5
---- Description:
6
---- Constant rate data serialiser/deserialiser
7
---- Input: 1 clk / [SER2PAR: dat_ser_val_i <= '1' / dat_ser_i <= 'NEXTSERIALDATA' ] / [PAR2SER: dat_par_val_i <= '1' / dat_par_i <= "PARALLELDATA"]
8
---- Timing requirements: SER2PAR: 1 clock cycle - PAR2SER: CCSDS_RXTX_SERDES_DEPTH clock cycles
9
---- Output: [SER2PAR: dat_par_val_o <= "1" / dat_par_o <= "PARALLELIZEDDATA"] / [PAR2SER: dat_ser_val_o <= "1" / dat_ser_o <= "SERIALIZEDDATA"]
10
---- Ressources requirements: CCSDS_RXTX_SERDES_DEPTH + 2*|log(CCSDS_RXTX_SERDES_DEPTH-1)/log(2)| + 2 registers
11
-------------------------------
12
---- Author(s):
13
---- Guillaume Rembert
14
-------------------------------
15
---- Licence:
16
---- MIT
17
-------------------------------
18
---- Changes list:
19
---- 2015/11/18: initial release
20
---- 2016/10/27: review + add ser2par
21
-------------------------------
22
 
23
-- libraries used
24
library ieee;
25
use ieee.std_logic_1164.all;
26
library work;
27
use work.ccsds_rxtx_parameters.all;
28
 
29
--=============================================================================
30
-- Entity declaration for ccsds_rxtx_serdes / data serialiser/deserialiser
31
--=============================================================================
32
entity ccsds_rxtx_serdes is
33
  generic (
34
    constant CCSDS_RXTX_SERDES_DEPTH : integer
35
  );
36
  port(
37
    -- inputs
38
    clk_i: in std_logic; -- parallel input data clock
39
    dat_par_i: in std_logic_vector(CCSDS_RXTX_SERDES_DEPTH-1 downto 0); -- parallel input data
40
    dat_par_val_i: in std_logic; -- parallel data valid indicator
41
    dat_ser_i: in std_logic; -- serial input data
42
    dat_ser_val_i: in std_logic; -- serial data valid indicator
43
    rst_i: in std_logic; -- system reset input
44
    -- outputs
45
    bus_o: out std_logic; -- par2ser busy indicator
46
    dat_par_o: out std_logic_vector(CCSDS_RXTX_SERDES_DEPTH-1 downto 0); -- parallel output data
47
    dat_par_val_o: out std_logic; -- parallel output data valid indicator
48
    dat_ser_o: out std_logic; -- serial output data
49
    dat_ser_val_o: out std_logic -- serial output data valid indicator
50
  );
51
end ccsds_rxtx_serdes;
52
 
53
--=============================================================================
54
-- architecture declaration / internal processing
55
--=============================================================================
56
architecture rtl of ccsds_rxtx_serdes is
57
 
58
-- internal variable signals
59
  signal wire_busy: std_logic := '0';
60
  signal wire_data_par_valid: std_logic := '0';
61
  signal wire_data_ser_valid: std_logic := '0';
62
  signal serial_data_pointer: integer range 0 to CCSDS_RXTX_SERDES_DEPTH-1 := CCSDS_RXTX_SERDES_DEPTH-1;
63
  signal parallel_data_pointer: integer range 0 to CCSDS_RXTX_SERDES_DEPTH-1 := CCSDS_RXTX_SERDES_DEPTH-1;
64
 
65
  begin
66
-- components instanciation and mapping
67
  bus_o <= wire_busy;
68
  dat_par_val_o <= wire_data_par_valid;
69
  dat_ser_val_o <= wire_data_ser_valid;
70
-- presynthesis checks
71
-- internal processing
72
 
73
    --=============================================================================
74
    -- Begin of par2serp
75
    -- Serialization of parallel data received starting with MSB
76
    --=============================================================================
77
    -- read: clk_i, rst_i, dat_par_i, dat_par_val_i
78
    -- write: dat_ser_o, wire_data_ser_valid, wire_busy
79
    -- r/w: parallel_data_pointer
80
    PAR2SERP : process (clk_i)
81
      variable serdes_memory: std_logic_vector(CCSDS_RXTX_SERDES_DEPTH-1 downto 0) := (others => '0');
82
      begin
83
        -- on each clock rising edge
84
        if rising_edge(clk_i) then
85
          -- reset signal received
86
          if (rst_i = '1') then
87
            -- reset all
88
            wire_busy <= '0';
89
            dat_ser_o <= '0';
90
            wire_data_ser_valid <= '0';
91
            parallel_data_pointer <= CCSDS_RXTX_SERDES_DEPTH-1;
92
--            serdes_memory := (others => '0');
93
          else
94
            if (dat_par_val_i = '1') and (parallel_data_pointer = CCSDS_RXTX_SERDES_DEPTH-1) then
95
              wire_busy <= '1';
96
              serdes_memory := dat_par_i;
97
              -- serialise data on output_bus
98
              dat_ser_o <= dat_par_i(parallel_data_pointer);
99
              -- decrement position pointer
100
              parallel_data_pointer <= (parallel_data_pointer - 1) mod CCSDS_RXTX_SERDES_DEPTH;
101
              wire_data_ser_valid <= '1';
102
            else
103
              if (parallel_data_pointer /= CCSDS_RXTX_SERDES_DEPTH-1) then
104
                wire_busy <= '1';
105
                -- serialise data on output_bus
106
                dat_ser_o <= serdes_memory(parallel_data_pointer);
107
                -- decrement position pointer
108
                parallel_data_pointer <= (parallel_data_pointer - 1) mod CCSDS_RXTX_SERDES_DEPTH;
109
                wire_data_ser_valid <= '1';
110
              else
111
                -- nothing to do
112
                wire_busy <= '0';
113
                wire_data_ser_valid <= '0';
114
              end if;
115
            end if;
116
          end if;
117
        end if;
118
      end process;
119
    --=============================================================================
120
    -- Begin of ser2parp
121
    -- Parallelization of serial data received
122
    --=============================================================================
123
    -- read: clk_i, rst_i, dat_ser_i, dat_ser_val_i
124
    -- write: dat_par_o, wire_data_par_valid
125
    -- r/w: serial_data_pointer
126
    SER2PARP : process (clk_i)
127
      begin
128
        -- on each clock rising edge
129
        if rising_edge(clk_i) then
130
          -- reset signal received
131
          if (rst_i = '1') then
132
            -- reset all
133
            dat_par_o <= (others => '0');
134
            wire_data_par_valid <= '0';
135
            serial_data_pointer <= CCSDS_RXTX_SERDES_DEPTH-1;
136
          else
137
            if (dat_ser_val_i = '1') then
138
              -- serialise data on output_bus
139
              dat_par_o(serial_data_pointer) <= dat_ser_i;
140
              if (serial_data_pointer = 0) then
141
                wire_data_par_valid <= '1';
142
              else
143
                wire_data_par_valid <= '0';
144
              end if;
145
              -- decrement position pointer
146
              serial_data_pointer <= (serial_data_pointer - 1) mod CCSDS_RXTX_SERDES_DEPTH;
147
            else
148
              wire_data_par_valid <= '0';
149
            end if;
150
          end if;
151
        end if;
152
      end process;
153
end rtl;
154
--=============================================================================
155
-- architecture end
156
--=============================================================================

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.